[Box Backup-commit] COMMIT r2122 - in box/trunk/test: backupdiff compress raidfile

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Apr 4 21:06:48 BST 2008


Author: chris
Date: 2008-04-04 20:06:47 +0000 (Fri, 04 Apr 2008)
New Revision: 2122

Modified:
   box/trunk/test/backupdiff/testbackupdiff.cpp
   box/trunk/test/compress/testcompress.cpp
   box/trunk/test/raidfile/testraidfile.cpp
Log:
Remove uses of obsolete TRACE macros in tests.


Modified: box/trunk/test/backupdiff/testbackupdiff.cpp
===================================================================
--- box/trunk/test/backupdiff/testbackupdiff.cpp	2008-04-03 22:32:46 UTC (rev 2121)
+++ box/trunk/test/backupdiff/testbackupdiff.cpp	2008-04-04 20:06:47 UTC (rev 2122)
@@ -110,8 +110,10 @@
 	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 @@
 		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);
 }

Modified: box/trunk/test/compress/testcompress.cpp
===================================================================
--- box/trunk/test/compress/testcompress.cpp	2008-04-03 22:32:46 UTC (rev 2121)
+++ box/trunk/test/compress/testcompress.cpp	2008-04-04 20:06:47 UTC (rev 2122)
@@ -90,7 +90,8 @@
 		
 		// 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
 		{

Modified: box/trunk/test/raidfile/testraidfile.cpp
===================================================================
--- box/trunk/test/raidfile/testraidfile.cpp	2008-04-03 22:32:46 UTC (rev 2121)
+++ box/trunk/test/raidfile/testraidfile.cpp	2008-04-04 20:06:47 UTC (rev 2122)
@@ -622,7 +622,8 @@
 		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




More information about the Boxbackup-commit mailing list