Skip to content

Commit

Permalink
Speed up testbackupstorepatch on Windows.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
qris committed Sep 16, 2016
1 parent 4807831 commit 519a2a3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/backupstorepatch/testbackupstorepatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -622,18 +625,16 @@ 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);
::printf(".");
::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);
Expand All @@ -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");

Expand Down

0 comments on commit 519a2a3

Please sign in to comment.