From c2c4547b7c5bdd660927fc65da155f58cc6ebe35 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 4 Apr 2008 20:06:47 +0000 Subject: Remove uses of obsolete TRACE macros in tests. --- test/backupdiff/testbackupdiff.cpp | 47 ++++++++++++++++++++------------------ test/compress/testcompress.cpp | 3 ++- test/raidfile/testraidfile.cpp | 3 ++- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/test/backupdiff/testbackupdiff.cpp b/test/backupdiff/testbackupdiff.cpp index a91d6dfe..d61029cf 100644 --- a/test/backupdiff/testbackupdiff.cpp +++ b/test/backupdiff/testbackupdiff.cpp @@ -110,8 +110,10 @@ 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); - TRACE2("Reading index from '%s', has %lld blocks\n", filename, nblocks); - TRACE0("======== ===== ========== ======== ========\n Index Where EncSz/Idx Size WChcksm\n"); + BOX_TRACE("Reading index from '" << filename << "', has " << + nblocks << " blocks"); + BOX_TRACE("======== ===== ========== ======== ========"); + BOX_TRACE(" Index Where EncSz/Idx Size WChcksm"); // Read them all in int64_t nnew = 0, nold = 0; for(int64_t b = 0; b < nblocks; ++b) @@ -119,35 +121,36 @@ 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++; - #ifdef WIN32 - TRACE2("%8I64d this s=%8I64d", b, s); - #else - TRACE2("%8lld this s=%8lld", b, s); - #endif + 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)); } else { nold++; - #ifdef WIN32 - TRACE2("%8I64d other i=%8I64d", b, 0 - s); - #else - TRACE2("%8lld other i=%8lld", b, 0 - s); - #endif + 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)); } - // 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)); - } - TRACE0("======== ===== ========== ======== ========\n"); + BOX_TRACE("======== ===== ========== ======== ========"); TEST_THAT(new_blocks_expected == nnew); TEST_THAT(old_blocks_expected == nold); } diff --git a/test/compress/testcompress.cpp b/test/compress/testcompress.cpp index 592dd641..4a522d31 100644 --- a/test/compress/testcompress.cpp +++ b/test/compress/testcompress.cpp @@ -90,7 +90,8 @@ int test_stream() // Check sizes TEST_THAT(poutput->GetSize() < source.GetSize()); - TRACE2("compressed size = %d, source size = %d\n", poutput->GetSize(), source.GetSize()); + BOX_TRACE("compressed size = " << poutput->GetSize() << + ", source size = " << source.GetSize()); // Decompress the data { diff --git a/test/raidfile/testraidfile.cpp b/test/raidfile/testraidfile.cpp index 40703de5..f15fec27 100644 --- a/test/raidfile/testraidfile.cpp +++ b/test/raidfile/testraidfile.cpp @@ -622,7 +622,8 @@ int test(int argc, const char *argv[]) TEST_THAT(n2 != n3); TEST_THAT(n1 != n3); TEST_THAT(n1 == n4); // ie wraps around - TRACE3("Gen paths= '%s','%s',%s'\n", n1.c_str(), n2.c_str(), n3.c_str()); + BOX_TRACE("Gen paths = '" << n1 << "', '" << n2 << + "', '" << n3); } // Create a RaidFile -- cgit v1.2.3