[Box Backup-commit] COMMIT r2083 - box/trunk/test/backupstore
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Thu, 31 Jan 2008 23:53:27 +0000 (UTC)
Author: chris
Date: 2008-01-31 23:53:27 +0000 (Thu, 31 Jan 2008)
New Revision: 2083
Modified:
box/trunk/test/backupstore/testbackupstore.cpp
Log:
Add a sleep after every access to the read-only connection, to ensure that
subsequent changes in the other connection get a new whole-second timestamp
and hopefully fix test failures reported by Alex Harper on MacOS X.
Modified: box/trunk/test/backupstore/testbackupstore.cpp
===================================================================
--- box/trunk/test/backupstore/testbackupstore.cpp 2008-01-31 23:52:08 UTC (rev 2082)
+++ box/trunk/test/backupstore/testbackupstore.cpp 2008-01-31 23:53:27 UTC (rev 2083)
@@ -974,6 +974,9 @@
test_server_1(protocol, protocolReadOnly);
+ // sleep to ensure that the timestamp on the file will change
+ ::safe_sleep(1);
+
// Create and upload some test files
int64_t maxID = 0;
for(int t = 0; t < UPLOAD_NUM; ++t)
@@ -1048,11 +1051,16 @@
StreamableMemBlock attrtest(attr3, sizeof(attr3));
// Use the read only connection to verify that the directory is as we expect
+ printf("\n\n==== Reading directory using read-only connection\n");
check_dir_after_uploads(protocolReadOnly, attrtest);
+ printf("done.\n\n");
// And on the read/write one
check_dir_after_uploads(protocol, attrtest);
}
+ // sleep to ensure that the timestamp on the file will change
+ ::safe_sleep(1);
+
// Check diffing and rsync like stuff...
// Build a modified file
{
@@ -1149,6 +1157,8 @@
*upload));
subdirfileid = stored->GetObjectID();
}
+
+ printf("\n==== Checking upload using read-only connection\n");
// Check the directories on the read only connection
{
// Command
@@ -1181,6 +1191,7 @@
TEST_THAT(en->GetObjectID() == subdirid);
TEST_THAT(en->GetModificationTime() == 0); // dirs don't have modification times.
}
+
{
// Command
std::auto_ptr<BackupProtocolClientSuccess> dirreply(protocolReadOnly.QueryListDirectory(
@@ -1211,6 +1222,7 @@
StreamableMemBlock attr(attr1, sizeof(attr1));
TEST_THAT(dir.GetAttributes() == attr);
}
+ printf("done.\n\n");
// Check that we don't get attributes if we don't ask for them
{
@@ -1258,6 +1270,9 @@
TEST_THAT(dir.GetAttributes() == attrtest);
}
+ // sleep to ensure that the timestamp on the file will change
+ ::safe_sleep(1);
+
// Test moving a file
{
BackupStoreFilenameClear newName("moved-files");
@@ -1281,9 +1296,6 @@
ConnectionException, Conn_Protocol_UnexpectedReply);
}
- // sleep to ensure that the timestamp on the file will change
- ::safe_sleep(1);
-
// Rename within a directory
{
BackupStoreFilenameClear newName("moved-files-x");
@@ -1342,6 +1354,9 @@
TEST_THAT(foundOld);
}
+ // sleep to ensure that the timestamp on the file will change
+ ::safe_sleep(1);
+
// make a little bit more of a thing to look at
int64_t subsubdirid = 0;
int64_t subsubfileid = 0;