[Box Backup-commit] COMMIT r1952 - in box/chris/general: lib/common test/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat Dec 8 21:50:20 GMT 2007


Author: chris
Date: 2007-12-08 21:50:19 +0000 (Sat, 08 Dec 2007)
New Revision: 1952

Modified:
   box/chris/general/lib/common/Test.h
   box/chris/general/test/bbackupd/testbbackupd.cpp
Log:
Move sync helper functions from test/bbackupd to Test.h to share with
other tests, particularly test/backupstorefix. (merges [1908], [1910])


Modified: box/chris/general/lib/common/Test.h
===================================================================
--- box/chris/general/lib/common/Test.h	2007-12-08 21:48:11 UTC (rev 1951)
+++ box/chris/general/lib/common/Test.h	2007-12-08 21:50:19 UTC (rev 1952)
@@ -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,22 +369,34 @@
 #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)
 {
 	TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "

Modified: box/chris/general/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/general/test/bbackupd/testbbackupd.cpp	2007-12-08 21:48:11 UTC (rev 1951)
+++ box/chris/general/test/bbackupd/testbbackupd.cpp	2007-12-08 21:50:19 UTC (rev 1952)
@@ -544,34 +544,6 @@
 }
 #endif // !WIN32
 
-void force_sync()
-{
-	TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
-		"force-sync") == 0);
-	TestRemoteProcessMemLeaks("bbackupctl.memleaks");
-}
-
-void wait_for_sync_start()
-{
-	TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
-		"wait-for-sync") == 0);
-	TestRemoteProcessMemLeaks("bbackupctl.memleaks");
-}
-
-void wait_for_sync_end()
-{
-	TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
-		"wait-for-end") == 0);
-	TestRemoteProcessMemLeaks("bbackupctl.memleaks");
-}
-
-void sync_and_wait()
-{
-	TEST_THAT(::system(BBACKUPCTL " -q -c testfiles/bbackupd.conf "
-		"force-sync") == 0);
-	TestRemoteProcessMemLeaks("bbackupctl.memleaks");
-}
-
 #ifdef WIN32
 bool set_file_time(const char* filename, FILETIME creationTime, 
 	FILETIME lastModTime, FILETIME lastAccessTime)




More information about the Boxbackup-commit mailing list