From 519a2a37c575777c1301c64b489fdf95e5a97f69 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 16 Sep 2016 20:56:32 +0100 Subject: Speed up testbackupstorepatch on Windows. Detect when housekeeping has run and account is unlocked, and stop the loop early, so that we don't have to wait for 32 iterations of the loop. --- test/backupstorepatch/testbackupstorepatch.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'test/backupstorepatch/testbackupstorepatch.cpp') diff --git a/test/backupstorepatch/testbackupstorepatch.cpp b/test/backupstorepatch/testbackupstorepatch.cpp index e149a041..46f278ad 100644 --- a/test/backupstorepatch/testbackupstorepatch.cpp +++ b/test/backupstorepatch/testbackupstorepatch.cpp @@ -610,10 +610,13 @@ int test(int argc, const char *argv[]) writedir.Commit(true); } + // Get the revision number of the root directory, before housekeeping makes any changes. + int64_t first_revision = 0; + RaidFileRead::FileExists(0, "backup/01234567/o01", &first_revision); + #ifdef WIN32 - // Cannot signal bbstored to do housekeeping now, - // so just wait until we're sure it's done - wait_for_operation(12, "housekeeping to run"); + // Cannot signal bbstored to do housekeeping now, and we don't need to, as we will + // wait up to 32 seconds and detect automatically when it has finished. #else // Send the server a restart signal, so it does // housekeeping immediately, and wait for it to happen @@ -622,10 +625,8 @@ int test(int argc, const char *argv[]) ::kill(pid, SIGHUP); #endif - // Get the revision number of the info file - int64_t first_revision = 0; - RaidFileRead::FileExists(0, "backup/01234567/o01", &first_revision); - for(int l = 0; l < 32; ++l) + // Wait for changes to be written back to the root directory. + for(int secs_remaining = 32; secs_remaining >= 0; secs_remaining--) { // Sleep a while, and print a dot ::sleep(1); @@ -633,7 +634,7 @@ int test(int argc, const char *argv[]) ::fflush(stdout); // Early end? - if(l > 2) + if(!TestFileExists("testfiles/0_0/backup/01234567/write.lock")) { int64_t revid = 0; RaidFileRead::FileExists(0, "backup/01234567/o01", &revid); @@ -642,6 +643,8 @@ int test(int argc, const char *argv[]) break; } } + + TEST_LINE(secs_remaining != 0, "No changes detected to root directory after 32 seconds"); } ::printf("\n"); -- cgit v1.2.3