summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-11-04 03:24:11 +0000
committerChris Wilson <chris+github@qwirx.com>2007-11-04 03:24:11 +0000
commit44b4c618d2506c861503bc1f6b4e0842339e051a (patch)
tree88a38375e59f415eb78f2fee4261c4ee7fd79792 /lib
parentf0bb6dbac03b50177a433727e31a5b5b3ee80c17 (diff)
Move sync helper functions from test/bbackupd to Test.h to share with
other tests, particularly test/backupstorefix.
Diffstat (limited to 'lib')
-rw-r--r--lib/common/Test.h58
1 files changed, 43 insertions, 15 deletions
diff --git a/lib/common/Test.h b/lib/common/Test.h
index f6704db4..d377bce6 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -24,6 +24,22 @@
#include <string>
+#ifdef WIN32
+#define BBACKUPCTL "..\\..\\bin\\bbackupctl\\bbackupctl.exe"
+#define BBACKUPD "..\\..\\bin\\bbackupd\\bbackupd.exe"
+#define BBSTORED "..\\..\\bin\\bbstored\\bbstored.exe"
+#define BBACKUPQUERY "..\\..\\bin\\bbackupquery\\bbackupquery.exe"
+#define BBSTOREACCOUNTS "..\\..\\bin\\bbstoreaccounts\\bbstoreaccounts.exe"
+#define TEST_RETURN(actual, expected) TEST_THAT(actual == expected);
+#else
+#define BBACKUPCTL "../../bin/bbackupctl/bbackupctl"
+#define BBACKUPD "../../bin/bbackupd/bbackupd"
+#define BBSTORED "../../bin/bbstored/bbstored"
+#define BBACKUPQUERY "../../bin/bbackupquery/bbackupquery"
+#define BBSTOREACCOUNTS "../../bin/bbstoreaccounts/bbstoreaccounts"
+#define TEST_RETURN(actual, expected) TEST_THAT(actual == expected*256);
+#endif
+
extern int failures;
extern int first_fail_line;
extern std::string first_fail_file;
@@ -353,21 +369,33 @@ inline void TestRemoteProcessMemLeaksFunc(const char *filename,
#endif
}
-#ifdef WIN32
-#define BBACKUPCTL "..\\..\\bin\\bbackupctl\\bbackupctl.exe"
-#define BBACKUPD "..\\..\\bin\\bbackupd\\bbackupd.exe"
-#define BBSTORED "..\\..\\bin\\bbstored\\bbstored.exe"
-#define BBACKUPQUERY "..\\..\\bin\\bbackupquery\\bbackupquery.exe"
-#define BBSTOREACCOUNTS "..\\..\\bin\\bbstoreaccounts\\bbstoreaccounts.exe"
-#define TEST_RETURN(actual, expected) TEST_THAT(actual == expected);
-#else
-#define BBACKUPCTL "../../bin/bbackupctl/bbackupctl"
-#define BBACKUPD "../../bin/bbackupd/bbackupd"
-#define BBSTORED "../../bin/bbstored/bbstored"
-#define BBACKUPQUERY "../../bin/bbackupquery/bbackupquery"
-#define BBSTOREACCOUNTS "../../bin/bbstoreaccounts/bbstoreaccounts"
-#define TEST_RETURN(actual, expected) TEST_THAT(actual == expected*256);
-#endif
+inline void force_sync()
+{
+ TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
+ "force-sync") == 0);
+ TestRemoteProcessMemLeaks("bbackupctl.memleaks");
+}
+
+inline void wait_for_sync_start()
+{
+ TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
+ "wait-for-sync") == 0);
+ TestRemoteProcessMemLeaks("bbackupctl.memleaks");
+}
+
+inline void wait_for_sync_end()
+{
+ TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
+ "wait-for-end") == 0);
+ TestRemoteProcessMemLeaks("bbackupctl.memleaks");
+}
+
+inline void sync_and_wait()
+{
+ TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
+ "force-sync") == 0);
+ TestRemoteProcessMemLeaks("bbackupctl.memleaks");
+}
inline void terminate_bbackupd(int pid)
{