[Box Backup-commit] COMMIT r3270 - box/trunk/test/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Thu Feb 13 22:49:54 GMT 2014


Author: chris
Date: 2014-02-13 22:49:54 +0000 (Thu, 13 Feb 2014)
New Revision: 3270

Modified:
   box/trunk/test/backupstore/testbackupstore.cpp
Log:
White space and comment fixes.

Modified: box/trunk/test/backupstore/testbackupstore.cpp
===================================================================
--- box/trunk/test/backupstore/testbackupstore.cpp	2014-02-13 22:30:47 UTC (rev 3269)
+++ box/trunk/test/backupstore/testbackupstore.cpp	2014-02-13 22:49:54 UTC (rev 3270)
@@ -47,7 +47,6 @@
 
 #include "MemLeakFindOn.h"
 
-
 #define ENCFILE_SIZE	2765
 
 // Make some test attributes
@@ -54,6 +53,7 @@
 #define ATTR1_SIZE 	245
 #define ATTR2_SIZE 	23
 #define ATTR3_SIZE 	122
+
 int attr1[ATTR1_SIZE];
 int attr2[ATTR2_SIZE];
 int attr3[ATTR3_SIZE];
@@ -415,6 +415,7 @@
 			TEST_THAT(fn4.GetClearFilename() == "filenameXYZ");
 			TEST_THAT(fn4 == fn1);
 		}
+
 		// Bung it in a stream, get it out in a server non-Clear filename (two of them into the same var)
 		{
 			BackupStoreFilenameClear fno("pinglet dksfnsf jksjdf ");
@@ -428,6 +429,7 @@
 			fn5.ReadFromStream(stream, IOStream::TimeOutInfinite);
 			TEST_THAT(fn5 == fno);
 		}
+
 		// Same again with clear strings
 		{
 			BackupStoreFilenameClear fno("pinglet dksfnsf jksjdf ");
@@ -441,6 +443,7 @@
 			fn5.ReadFromStream(stream, IOStream::TimeOutInfinite);
 			TEST_THAT(fn5.GetClearFilename() == "pinglet dksfnsf jksjdf ");
 		}
+
 		// Test a very big filename
 		{
 			const char *fnr = "01234567890123456789012345678901234567890123456789"
@@ -460,6 +463,7 @@
 			TEST_THAT(fn9.GetClearFilename() == fnr);
 			TEST_THAT(fn9 == fnLong);
 		}
+
 		// Test a filename which went wrong once
 		{
 			BackupStoreFilenameClear dodgy("content-negotiation.html");
@@ -472,7 +476,7 @@
 {
 	{
 		// Now play with directories
-		
+
 		// Fill in...
 		BackupStoreDirectory dir1(12, 98);
 		for(int e = 0; e < DIR_NUM; ++e)
@@ -622,6 +626,7 @@
 		{
 			files++;
 		}
+
 		// Check it's deleted
 		TEST_THAT(en->GetFlags() & BackupProtocolListDirectory::Flags_Deleted);
 	}
@@ -926,7 +931,6 @@
 			FileStream f("testfiles/file1", O_WRONLY | O_CREAT);
 			f.Write(encfile, sizeof(encfile));
 		}
-		
 	}
 
 	// Read the root directory a few times (as it's cached, so make sure it doesn't hurt anything)
@@ -992,7 +996,10 @@
 		store1objid = stored->GetObjectID();
 		TEST_THAT(store1objid == 2);
 	}
+
+	// Update expected reference count of this new object
 	set_refcount(store1objid, 1);
+
 	// And retrieve it
 	{
 		// Retrieve as object
@@ -1031,6 +1038,7 @@
 			in.Read(encfile_i, sizeof(encfile_i));
 			TEST_THAT(memcmp(encfile, encfile_i, sizeof(encfile)) == 0);
 		}
+
 		{
 			FileStream in("testfiles/file1_upload_retrieved_str");
 			int encfile_i[ENCFILE_SIZE];
@@ -1046,6 +1054,7 @@
 			// Check against uploaded file
 			TEST_THAT(check_block_index("testfiles/file1_upload1", *blockIndexStream));
 		}
+
 		// and again, by name
 		{
 			std::auto_ptr<BackupProtocolSuccess> getblockindex(protocol.QueryGetBlockIndexByName(BackupProtocolListDirectory::RootDirectory, store1name));
@@ -1055,6 +1064,7 @@
 			TEST_THAT(check_block_index("testfiles/file1_upload1", *blockIndexStream));
 		}
 	}
+
 	// Get the directory again, and see if the entry is in it
 	{
 		// Command
@@ -1651,6 +1661,7 @@
 					attrnew));
 			TEST_THAT(changereply->GetObjectID() == subdirid);
 		}
+
 		// Check the new attributes
 		{
 			// Command
@@ -1760,6 +1771,7 @@
 		int64_t subsubdirid = 0;
 		int64_t subsubfileid = 0;
 		{
+			// TODO FIXME use create_dir() and create_file() instead.
 			BackupStoreFilenameClear nd("sub2");
 			// Attributes
 			std::auto_ptr<IOStream> attr(new MemBlockStream(attr1,
@@ -1836,13 +1848,13 @@
 				TEST_THAT(fn.GetClearFilename() == testnames[l]);
 			}
 		}
-		
+			
 //}	skip:
 
 		std::auto_ptr<BackupStoreRefCountDatabase> apRefCount(
 			BackupStoreRefCountDatabase::Load(
 				apAccounts->GetEntry(0x1234567), true));
-	
+
 		// Create some nice recursive directories
 		int64_t dirtodelete = create_test_data_subdirs(*apProtocol,
 			BackupProtocolListDirectory::RootDirectory,
@@ -1881,7 +1893,7 @@
 			// Then... check everything's deleted
 			test_everything_deleted(protocolReadOnly, dirtodelete);
 		}
-			
+
 		// Finish the connections
 #ifndef WIN32
 		protocolReadOnly.QueryFinished();
@@ -1909,7 +1921,7 @@
 		{
 			encfile[l] = l * 173;
 		}
-		
+
 		// Encode and decode a small block (shouldn't be compressed)
 		{
 			#define SMALL_BLOCK_SIZE	251
@@ -2050,8 +2062,10 @@
 
 			TEST_THAT(decoded->GetNumBlocks() == 3);
 		}
-		
 #ifndef WIN32 // no symlinks on Win32
+
+	// TODO FIXME indentation
+
 		// Try out doing this on a symlink
 		{
 			UNLINK_IF_EXISTS("testfiles/testsymlink");
@@ -2058,11 +2072,13 @@
 			TEST_THAT(::symlink("does/not/exist", "testfiles/testsymlink") == 0);
 			BackupStoreFilenameClear name("testsymlink");
 			std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFile("testfiles/testsymlink", 32, name));
+
 			// Can't decode it from the stream, because it's in file order, and doesn't have the 
 			// required properties to be able to reorder it. So buffer it...
 			CollectInBufferStream b;
 			encoded->CopyStreamTo(b);
 			b.SetForReading();
+
 			// Decode it
 			UNLINK_IF_EXISTS("testfiles/testsymlink_2");
 			BackupStoreFile::DecodeFile(b, "testfiles/testsymlink_2", IOStream::TimeOutInfinite);
@@ -2103,6 +2119,7 @@
 		TEST_CHECK_THROWS(info->RemovedDeletedDirectory(9), BackupStoreException, StoreInfoDirNotInList);
 		info->Save();
 	}
+
 	{
 		std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76, "test-info/", 0, true));
 		TEST_THAT(info->GetBlocksUsed() == 7);
@@ -2174,8 +2191,8 @@
 	TEST_THAT(TestDirExists("testfiles/0_1/backup/01234567"));
 	TEST_THAT(TestDirExists("testfiles/0_2/backup/01234567"));
 	TEST_THAT(TestGetFileSize("testfiles/accounts.txt") > 8);
+
 	// make sure something is written to it
-	
 	std::auto_ptr<BackupStoreAccountDatabase> apAccounts(
 		BackupStoreAccountDatabase::Read("testfiles/accounts.txt"));
 




More information about the Boxbackup-commit mailing list