summaryrefslogtreecommitdiff
path: root/test/backupstore/testbackupstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/backupstore/testbackupstore.cpp')
-rw-r--r--test/backupstore/testbackupstore.cpp52
1 files changed, 38 insertions, 14 deletions
diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp
index a5eacc7d..0266d097 100644
--- a/test/backupstore/testbackupstore.cpp
+++ b/test/backupstore/testbackupstore.cpp
@@ -72,7 +72,7 @@ static const char *ens_filenames[] = {"obj1ertewt", "obj2", "obj3", "obj4dfedfg4
typedef struct
{
- char *fnextra;
+ const char *fnextra;
BackupStoreFilenameClear name;
int seed;
int size;
@@ -232,7 +232,8 @@ int test1(int argc, const char *argv[])
TEST_THAT(fn1 == fn3);
// Check that it's been encrypted
- TEST_THAT(fn2.find("name") == fn2.npos);
+ std::string name(fn2.GetEncodedFilename());
+ TEST_THAT(name.find("name") == name.npos);
// Bung it in a stream, get it out in a Clear filename
{
@@ -974,6 +975,9 @@ int test_server(const char *hostname)
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 +1052,16 @@ int test_server(const char *hostname)
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 +1158,8 @@ int test_server(const char *hostname)
*upload));
subdirfileid = stored->GetObjectID();
}
+
+ printf("\n==== Checking upload using read-only connection\n");
// Check the directories on the read only connection
{
// Command
@@ -1181,6 +1192,7 @@ int test_server(const char *hostname)
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 +1223,7 @@ int test_server(const char *hostname)
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 +1271,9 @@ int test_server(const char *hostname)
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 +1297,6 @@ int test_server(const char *hostname)
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 +1355,9 @@ int test_server(const char *hostname)
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;
@@ -1763,9 +1779,12 @@ int test3(int argc, const char *argv[])
TEST_THAT(KillServer(pid));
::sleep(1);
TEST_THAT(!ServerIsAlive(pid));
-#ifndef WIN32
- TestRemoteProcessMemLeaks("bbstored.memleaks");
-#endif
+
+ #ifdef WIN32
+ TEST_THAT(unlink("testfiles/bbstored.pid") == 0);
+ #else
+ TestRemoteProcessMemLeaks("bbstored.memleaks");
+ #endif
// Set a new limit on the account -- leave the hard limit
// high to make sure the target for freeing space is the
@@ -1857,9 +1876,11 @@ int test3(int argc, const char *argv[])
::sleep(1);
TEST_THAT(!ServerIsAlive(pid));
-#ifndef WIN32
- TestRemoteProcessMemLeaks("bbstored.memleaks");
-#endif
+ #ifdef WIN32
+ TEST_THAT(unlink("testfiles/bbstored.pid") == 0);
+ #else
+ TestRemoteProcessMemLeaks("bbstored.memleaks");
+ #endif
}
return 0;
@@ -1896,9 +1917,12 @@ int multi_server()
TEST_THAT(KillServer(pid));
::sleep(1);
TEST_THAT(!ServerIsAlive(pid));
-#ifndef WIN32
- TestRemoteProcessMemLeaks("bbstored.memleaks");
-#endif
+
+ #ifdef WIN32
+ TEST_THAT(unlink("testfiles/bbstored.pid") == 0);
+ #else
+ TestRemoteProcessMemLeaks("bbstored.memleaks");
+ #endif
}