From c6dad127486b569d683ae9cdff4f10693a3b4453 Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 23 Jan 2015 14:12:53 -0500 Subject: [PATCH] Using usleep for more resolution, --- test/lib/BackRestTest/BackupTest.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm index ef7e29423..63bdbc07f 100755 --- a/test/lib/BackRestTest/BackupTest.pm +++ b/test/lib/BackRestTest/BackupTest.pm @@ -16,6 +16,7 @@ use File::Copy 'cp'; use File::stat; use Fcntl ':mode'; use DBI; +use Time::HiRes qw(gettimeofday usleep); use lib dirname($0) . '/../lib'; use BackRest::Utility; @@ -1627,7 +1628,10 @@ sub BackRestTestBackup_Test my $lBeginTime = $oStat->mtime; # Sleep .5 seconds to give a reasonable amount of time for the file to be copied after the manifest was generated - sleep(.5); + # Sleep for a while to show there is a large window where this can happen + &log(INFO, 'time ' . gettimeofday()); + usleep(.5 * 1000000); + &log(INFO, 'time ' . gettimeofday()); # Insert another row BackRestTestBackup_PgExecute("insert into test_collision values (1)"); @@ -1717,7 +1721,9 @@ sub BackRestTestBackup_Test BackRestTestCommon_Execute($strCommand, false, false, true); # Sleep for a while to show there is a large window where this can happen - sleep(.9); + &log(INFO, 'time ' . gettimeofday()); + usleep(.5 * 1000000); + &log(INFO, 'time ' . gettimeofday()); # Modify the test file within the same second &log(INFO, "modify test file");