diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/backupdiff/testbackupdiff.cpp | 47 | ||||
-rw-r--r-- | test/basicserver/testbasicserver.cpp | 4 | ||||
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 21 | ||||
-rw-r--r-- | test/bbackupd/testfiles/bbackupd-temploc.conf | 1 | ||||
-rw-r--r-- | test/bbackupd/testfiles/bbackupd.conf.in | 1 | ||||
-rw-r--r-- | test/bbackupd/testfiles/bbstored.conf | 2 | ||||
-rw-r--r-- | test/common/testcommon.cpp | 37 | ||||
-rw-r--r-- | test/compress/testcompress.cpp | 3 | ||||
-rw-r--r-- | test/raidfile/testraidfile.cpp | 3 |
9 files changed, 54 insertions, 65 deletions
diff --git a/test/backupdiff/testbackupdiff.cpp b/test/backupdiff/testbackupdiff.cpp index fb972b2b..a91d6dfe 100644 --- a/test/backupdiff/testbackupdiff.cpp +++ b/test/backupdiff/testbackupdiff.cpp @@ -110,10 +110,8 @@ void check_encoded_file(const char *filename, int64_t OtherFileID, int new_block TEST_THAT((uint64_t)box_ntoh64(hdr.mOtherFileID) == (uint64_t)OtherFileID); // number of blocks int64_t nblocks = box_ntoh64(hdr.mNumBlocks); - BOX_TRACE("Reading index from '" << filename << "', has " << - nblocks << " blocks"); - BOX_TRACE("======== ===== ========== ======== ========"); - BOX_TRACE(" Index Where EncSz/Idx Size WChcksm"); + TRACE2("Reading index from '%s', has %lld blocks\n", filename, nblocks); + TRACE0("======== ===== ========== ======== ========\n Index Where EncSz/Idx Size WChcksm\n"); // Read them all in int64_t nnew = 0, nold = 0; for(int64_t b = 0; b < nblocks; ++b) @@ -121,36 +119,35 @@ void check_encoded_file(const char *filename, int64_t OtherFileID, int new_block file_BlockIndexEntry en; TEST_THAT(enc.ReadFullBuffer(&en, sizeof(en), 0)); int64_t s = box_ntoh64(en.mEncodedSize); - - // Decode the rest - uint64_t iv = box_ntoh64(hdr.mEntryIVBase); - iv += b; - sBlowfishDecryptBlockEntry.SetIV(&iv); - file_BlockIndexEntryEnc entryEnc; - sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, - sizeof(entryEnc), en.mEnEnc, sizeof(en.mEnEnc)); - - if(s > 0) { nnew++; - BOX_TRACE(std::setw(8) << b << " this s=" << - std::setw(8) << s << " " << - std::setw(8) << ntohl(entryEnc.mSize) << " " << - std::setw(8) << std::setfill('0') << - std::hex << ntohl(entryEnc.mWeakChecksum)); + #ifdef WIN32 + TRACE2("%8I64d this s=%8I64d", b, s); + #else + TRACE2("%8lld this s=%8lld", b, s); + #endif } else { nold++; - BOX_TRACE(std::setw(8) << b << " other i=" << - std::setw(8) << (0-s) << " " << - std::setw(8) << ntohl(entryEnc.mSize) << " " << - std::setw(8) << std::setfill('0') << - std::hex << ntohl(entryEnc.mWeakChecksum)); + #ifdef WIN32 + TRACE2("%8I64d other i=%8I64d", b, 0 - s); + #else + TRACE2("%8lld other i=%8lld", b, 0 - s); + #endif } + // Decode the rest + uint64_t iv = box_ntoh64(hdr.mEntryIVBase); + iv += b; + sBlowfishDecryptBlockEntry.SetIV(&iv); + file_BlockIndexEntryEnc entryEnc; + sBlowfishDecryptBlockEntry.TransformBlock(&entryEnc, sizeof(entryEnc), + en.mEnEnc, sizeof(en.mEnEnc)); + TRACE2(" %8d %08x\n", ntohl(entryEnc.mSize), ntohl(entryEnc.mWeakChecksum)); + } - BOX_TRACE("======== ===== ========== ======== ========"); + TRACE0("======== ===== ========== ======== ========\n"); TEST_THAT(new_blocks_expected == nnew); TEST_THAT(old_blocks_expected == nold); } diff --git a/test/basicserver/testbasicserver.cpp b/test/basicserver/testbasicserver.cpp index 18bc0aa8..18329441 100644 --- a/test/basicserver/testbasicserver.cpp +++ b/test/basicserver/testbasicserver.cpp @@ -185,7 +185,7 @@ const ConfigurationVerify *testserver::GetConfigVerify() const { static ConfigurationVerifyKey verifyserverkeys[] = { - SERVERSTREAM_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses + SERVERSTREAM_VERIFY_SERVER_KEYS(0) // no default addresses }; static ConfigurationVerify verifyserver[] = @@ -258,7 +258,7 @@ const ConfigurationVerify *testTLSserver::GetConfigVerify() const { static ConfigurationVerifyKey verifyserverkeys[] = { - SERVERTLS_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default listen addresses + SERVERTLS_VERIFY_SERVER_KEYS(0) // no default listen addresses }; static ConfigurationVerify verifyserver[] = diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 27ca4ecb..3f165dc2 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -514,8 +514,7 @@ void do_interrupted_restore(const TLSContext &context, int64_t restoredirid) { // connect and log in SocketStreamTLS conn; - conn.Open(context, Socket::TypeINET, "localhost", - 22011); + conn.Open(context, Socket::TypeINET, "localhost", BOX_PORT_BBSTORED); BackupProtocolClient protocol(conn); protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION); std::auto_ptr<BackupProtocolClientLoginConfirmed> loginConf(protocol.QueryLogin(0x01234567, BackupProtocolClientLogin::Flags_ReadOnly)); @@ -608,7 +607,7 @@ SocketStreamTLS sSocket; std::auto_ptr<BackupProtocolClient> Connect(TLSContext& rContext) { sSocket.Open(rContext, Socket::TypeINET, - "localhost", 22011); + "localhost", BOX_PORT_BBSTORED); std::auto_ptr<BackupProtocolClient> connection; connection.reset(new BackupProtocolClient(sSocket)); connection->Handshake(); @@ -2560,6 +2559,13 @@ int test_bbackupd() true /* print progress dots */) == Restore_TargetExists); + // Make sure you can't restore to a nonexistant path + printf("Try to restore to a path that doesn't exist\n"); + TEST_THAT(BackupClientRestore(*client, restoredirid, + "testfiles/no-such-path/subdir", + true /* print progress dots */) + == Restore_TargetPathNotFound); + // Find ID of the deleted directory deldirid = GetDirID(*client, "x1", restoredirid); TEST_THAT(deldirid != 0); @@ -2572,15 +2578,6 @@ int test_bbackupd() true /* deleted files */) == Restore_Complete); - // Make sure you can't restore to a nonexistant path - printf("\n\n==== Try to restore to a path " - "that doesn't exist\n"); - fflush(stdout); - TEST_THAT(BackupClientRestore(*client, restoredirid, - "testfiles/no-such-path/subdir", - true /* print progress dots */) - == Restore_TargetPathNotFound); - // Log out client->QueryFinished(); sSocket.Close(); diff --git a/test/bbackupd/testfiles/bbackupd-temploc.conf b/test/bbackupd/testfiles/bbackupd-temploc.conf index 57d66bca..86901298 100644 --- a/test/bbackupd/testfiles/bbackupd-temploc.conf +++ b/test/bbackupd/testfiles/bbackupd-temploc.conf @@ -8,7 +8,6 @@ KeysFile = testfiles/bbackupd.keys DataDirectory = testfiles/bbackupd-data StoreHostname = localhost -StorePort = 22011 AccountNumber = 0x01234567 UpdateStoreInterval = 3 diff --git a/test/bbackupd/testfiles/bbackupd.conf.in b/test/bbackupd/testfiles/bbackupd.conf.in index 712b58b2..aecb3884 100644 --- a/test/bbackupd/testfiles/bbackupd.conf.in +++ b/test/bbackupd/testfiles/bbackupd.conf.in @@ -8,7 +8,6 @@ KeysFile = testfiles/bbackupd.keys DataDirectory = testfiles/bbackupd-data StoreHostname = localhost -StorePort = 22011 AccountNumber = 0x01234567 UpdateStoreInterval = 3 diff --git a/test/bbackupd/testfiles/bbstored.conf b/test/bbackupd/testfiles/bbstored.conf index 87f4fe6b..18c73a40 100644 --- a/test/bbackupd/testfiles/bbstored.conf +++ b/test/bbackupd/testfiles/bbstored.conf @@ -9,7 +9,7 @@ TimeBetweenHousekeeping = 5 Server { PidFile = testfiles/bbstored.pid - ListenAddresses = inet:localhost:22011 + ListenAddresses = inet:localhost CertificateFile = testfiles/serverCerts.pem PrivateKeyFile = testfiles/serverPrivKey.pem TrustedCAsFile = testfiles/serverTrustedCAs.pem diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp index 46d36c73..eb057228 100644 --- a/test/common/testcommon.cpp +++ b/test/common/testcommon.cpp @@ -57,15 +57,15 @@ void test_conversions() ConfigurationVerifyKey verifykeys1_1_1[] = { - ConfigurationVerifyKey("bing", ConfigTest_Exists), - ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), - ConfigurationVerifyKey("terrible", ConfigTest_Exists | ConfigTest_LastEntry) + {"bing", 0, ConfigTest_Exists, 0}, + {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, + {"terrible", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} }; ConfigurationVerifyKey verifykeys1_1_2[] = { - ConfigurationVerifyKey("fish", ConfigTest_Exists | ConfigTest_IsInt), - ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) + {"fish", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, + {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} }; @@ -89,15 +89,15 @@ ConfigurationVerify verifysub1_1[] = ConfigurationVerifyKey verifykeys1_1[] = { - ConfigurationVerifyKey("value", ConfigTest_Exists | ConfigTest_IsInt), - ConfigurationVerifyKey("string1", ConfigTest_Exists), - ConfigurationVerifyKey("string2", ConfigTest_Exists | ConfigTest_LastEntry) + {"value", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, + {"string1", 0, ConfigTest_Exists, 0}, + {"string2", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} }; ConfigurationVerifyKey verifykeys1_2[] = { - ConfigurationVerifyKey("carrots", ConfigTest_Exists | ConfigTest_IsInt), - ConfigurationVerifyKey("string", ConfigTest_Exists | ConfigTest_LastEntry) + {"carrots", 0, ConfigTest_Exists | ConfigTest_IsInt, 0}, + {"string", 0, ConfigTest_Exists | ConfigTest_LastEntry, 0} }; ConfigurationVerify verifysub1[] = @@ -120,15 +120,14 @@ ConfigurationVerify verifysub1[] = ConfigurationVerifyKey verifykeys1[] = { - ConfigurationVerifyKey("notExpected", 0), - ConfigurationVerifyKey("HasDefaultValue", 0, "Lovely default value"), - ConfigurationVerifyKey("MultiValue", ConfigTest_MultiValueAllowed), - ConfigurationVerifyKey("BoolTrue1", ConfigTest_IsBool), - ConfigurationVerifyKey("BoolTrue2", ConfigTest_IsBool), - ConfigurationVerifyKey("BoolFalse1", ConfigTest_IsBool), - ConfigurationVerifyKey("BoolFalse2", ConfigTest_IsBool), - ConfigurationVerifyKey("TOPlevel", - ConfigTest_LastEntry | ConfigTest_Exists) + {"notExpected", 0, 0, 0}, + {"HasDefaultValue", "Lovely default value", 0, 0}, + {"MultiValue", 0, ConfigTest_MultiValueAllowed, 0}, + {"BoolTrue1", 0, ConfigTest_IsBool, 0}, + {"BoolTrue2", 0, ConfigTest_IsBool, 0}, + {"BoolFalse1", 0, ConfigTest_IsBool, 0}, + {"BoolFalse2", 0, ConfigTest_IsBool, 0}, + {"TOPlevel", 0, ConfigTest_LastEntry | ConfigTest_Exists, 0} }; ConfigurationVerify verify = diff --git a/test/compress/testcompress.cpp b/test/compress/testcompress.cpp index 4a522d31..592dd641 100644 --- a/test/compress/testcompress.cpp +++ b/test/compress/testcompress.cpp @@ -90,8 +90,7 @@ int test_stream() // Check sizes TEST_THAT(poutput->GetSize() < source.GetSize()); - BOX_TRACE("compressed size = " << poutput->GetSize() << - ", source size = " << source.GetSize()); + TRACE2("compressed size = %d, source size = %d\n", poutput->GetSize(), source.GetSize()); // Decompress the data { diff --git a/test/raidfile/testraidfile.cpp b/test/raidfile/testraidfile.cpp index f15fec27..40703de5 100644 --- a/test/raidfile/testraidfile.cpp +++ b/test/raidfile/testraidfile.cpp @@ -622,8 +622,7 @@ int test(int argc, const char *argv[]) TEST_THAT(n2 != n3); TEST_THAT(n1 != n3); TEST_THAT(n1 == n4); // ie wraps around - BOX_TRACE("Gen paths = '" << n1 << "', '" << n2 << - "', '" << n3); + TRACE3("Gen paths= '%s','%s',%s'\n", n1.c_str(), n2.c_str(), n3.c_str()); } // Create a RaidFile |