summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2009-03-15 22:45:45 +0000
committerChris Wilson <chris+github@qwirx.com>2009-03-15 22:45:45 +0000
commit162d50a4734f7833efc684e1ee7021ed98fc63ab (patch)
treeb6582a0beacee73dad0f65c141adcfaf38ec48f8
parent8daccb301b174beaa9d39d9a0173399ea6c94fb5 (diff)
Fix race condition where bbackupd would run just before test finished
waiting for its 90 second error timeout on slow machines, e.g. FreeBSD VM, causing bbackupd test to fail.
-rw-r--r--test/bbackupd/testbbackupd.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp
index 0e61ac76..2870da3e 100644
--- a/test/bbackupd/testbbackupd.cpp
+++ b/test/bbackupd/testbbackupd.cpp
@@ -2618,6 +2618,8 @@ int test_bbackupd()
TEST_THAT(::rename("testfiles/0_2/backup/01234567/info.rf.bak",
"testfiles/0_2/backup/01234567/info.rf") == 0);
+ int store_fixed_time = time(NULL);
+
// Check that we DO get errors on compare (cannot do this
// until after we fix the store, which creates a race)
compareReturnValue = ::system(BBACKUPQUERY " "
@@ -2632,7 +2634,7 @@ int test_bbackupd()
TEST_THAT(!TestFileExists("testfiles/"
"notifyran.backup-start.wait-snapshot.1"));
- // Set a tag for the notify script to distinguist from
+ // Set a tag for the notify script to distinguish from
// previous runs.
{
int fd1 = open("testfiles/notifyscript.tag",
@@ -2642,8 +2644,9 @@ int test_bbackupd()
TEST_THAT(close(fd1) == 0);
}
- // bbackupd should pause for about 90 seconds
- wait_for_backup_operation(85);
+ // bbackupd should pause for about 90 seconds from store_fixed_time,
+ // so check that it hasn't run after 85 seconds from store_fixed_time
+ wait_for_backup_operation(85 - time(NULL) + store_fixed_time);
TEST_THAT(!TestFileExists("testfiles/"
"notifyran.backup-start.wait-snapshot.1"));
@@ -2713,6 +2716,8 @@ int test_bbackupd()
TEST_THAT(::rename("testfiles/0_2/backup/01234567/info.rf.bak",
"testfiles/0_2/backup/01234567/info.rf") == 0);
+ store_fixed_time = time(NULL);
+
// Check that we DO get errors on compare (cannot do this
// until after we fix the store, which creates a race)
compareReturnValue = ::system(BBACKUPQUERY " "
@@ -2737,8 +2742,9 @@ int test_bbackupd()
TEST_THAT(close(fd1) == 0);
}
- // bbackupd should pause for at least 90 seconds
- wait_for_backup_operation(85);
+ // bbackupd should pause for about 90 seconds from store_fixed_time,
+ // so check that it hasn't run after 85 seconds from store_fixed_time
+ wait_for_backup_operation(85 - time(NULL) + store_fixed_time);
TEST_THAT(!TestFileExists("testfiles/"
"notifyran.backup-start.wait-automatic.1"));