[Box Backup-commit] COMMIT r2499 - box/trunk/test/bbackupd

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Fri Apr 10 00:06:43 BST 2009


Author: chris
Date: 2009-04-10 00:06:42 +0100 (Fri, 10 Apr 2009)
New Revision: 2499

Modified:
   box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Fix race conditions where backups happen too slowly and tests fail.


Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp	2009-04-09 23:05:28 UTC (rev 2498)
+++ box/trunk/test/bbackupd/testbbackupd.cpp	2009-04-09 23:06:42 UTC (rev 2499)
@@ -1755,7 +1755,7 @@
 			return 1;
 		}
 
-		test_run_bbstored();
+		TEST_THAT(test_run_bbstored() == 0);
 
 		cmd = BBACKUPD " " + bbackupd_args +
 			" testfiles/bbackupd.conf";
@@ -2541,9 +2541,13 @@
 				> 1024);
 		}
 
-		// wait for backup daemon to do it's stuff, and compare again
-		wait_for_backup_operation("bbackupd to sync the changes");
+		// wait long enough for new files to be old enough to backup
+		wait_for_operation(5, "new files to be old enough");
 
+		// wait for backup daemon to do it's stuff
+		sync_and_wait();
+
+		// compare to make sure that it worked
 		compareReturnValue = ::system(BBACKUPQUERY " -Wwarning "
 			"-c testfiles/bbackupd.conf "
 			"-l testfiles/query2.log "
@@ -2994,10 +2998,13 @@
 		TEST_THAT(TestFileExists("testfiles/TestDir1/tracked-1"));
 		TEST_THAT(TestFileExists("testfiles/TestDir1/tracked-2"));
 
+		// wait for them to be old enough to back up
+		wait_for_operation(5, "tracked files to be old enough");
+		
 		// back up both files
-		wait_for_operation(5, "tracked files to be old enough");
-		wait_for_backup_operation("bbackupd to sync the tracked files");
+		sync_and_wait();
 
+		// compare to make sure that it worked
 		compareReturnValue = ::system(BBACKUPQUERY " "
 			"-c testfiles/bbackupd.conf "
 			"-l testfiles/query3h.log "
@@ -4039,6 +4046,7 @@
 	if(r != 0) return r;
 
 	r = test_run_bbstored();
+	TEST_THAT(r == 0);
 	if(r != 0) return r;
 	
 	r = test_bbackupd();




More information about the Boxbackup-commit mailing list