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

boxbackup-dev at boxbackup.org boxbackup-dev at boxbackup.org
Sun Apr 26 15:39:22 BST 2009


Author: chris
Date: 2009-04-26 15:39:21 +0100 (Sun, 26 Apr 2009)
New Revision: 2510

Modified:
   box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Log while sleeping in test/bbackupd.

Only show warning about diff test time taken if it's out of bounds.


Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp	2009-04-26 11:55:58 UTC (rev 2509)
+++ box/trunk/test/bbackupd/testbbackupd.cpp	2009-04-26 14:39:21 UTC (rev 2510)
@@ -2443,10 +2443,10 @@
 			// next poll should happen within the next
 			// 5 seconds (normally about 3 seconds)
 
-			safe_sleep(1); // 2 seconds before
+			wait_for_operation(1, "2 seconds before next run");
 			TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR 
 				"syncallowscript.notifyran.1", &st) != 0);
-			safe_sleep(4); // 2 seconds after
+			wait_for_operation(4, "2 seconds after run");
 			TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR 
 				"syncallowscript.notifyran.1", &st) == 0);
 			TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR 
@@ -2455,10 +2455,10 @@
 			// next poll should happen within the next
 			// 10 seconds (normally about 8 seconds)
 
-			safe_sleep(6); // 2 seconds before
+			wait_for_operation(6, "2 seconds before next run");
 			TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR 
 				"syncallowscript.notifyran.2", &st) != 0);
-			safe_sleep(4); // 2 seconds after
+			wait_for_operation(4, "2 seconds after run");
 			TEST_THAT(stat("testfiles" DIRECTORY_SEPARATOR 
 				"syncallowscript.notifyran.2", &st) == 0);
 
@@ -2481,9 +2481,14 @@
 			long end_time = time(NULL);
 
 			long wait_time = end_time - start_time + 2;
+
 			// should be about 10 seconds
-			printf("Waited for %ld seconds, should have been %s",
-				wait_time, control_string);
+			if (wait_time < 8 || wait_time > 12)
+			{
+				printf("Waited for %ld seconds, should have "
+					"been %s", wait_time, control_string);
+			}
+
 			TEST_THAT(wait_time >= 8);
 			TEST_THAT(wait_time <= 12);
 




More information about the Boxbackup-commit mailing list