[Box Backup-commit] COMMIT r3527 - box/trunk/test/backupstorepatch

subversion at boxbackup.org subversion at boxbackup.org
Mon Feb 23 21:38:17 GMT 2015


Author: chris
Date: 2015-02-23 21:38:16 +0000 (Mon, 23 Feb 2015)
New Revision: 3527

Modified:
   box/trunk/test/backupstorepatch/testbackupstorepatch.cpp
Log:
Fix misisng timeouts on network operations.

They cause a lot of noise in the Travis build logs.


Modified: box/trunk/test/backupstorepatch/testbackupstorepatch.cpp
===================================================================
--- box/trunk/test/backupstorepatch/testbackupstorepatch.cpp	2015-02-21 18:40:09 UTC (rev 3526)
+++ box/trunk/test/backupstorepatch/testbackupstorepatch.cpp	2015-02-23 21:38:16 UTC (rev 3527)
@@ -74,6 +74,7 @@
 #define NUMBER_FILES	((sizeof(test_files) / sizeof(test_files[0])))
 #define FIRST_FILE_SIZE	(64*1024+3)
 #define BUFFER_SIZE		(256*1024)
+#define SHORT_TIMEOUT 5000
 
 // Chunk of memory to use for copying files, etc
 static void *buffer = 0;
@@ -194,7 +195,7 @@
 		FileStream out(fnt, O_WRONLY | O_CREAT);
 		
 		// Copy up to the change point
-		int b = previous.Read(buffer, test_files[f].ChangePoint, IOStream::TimeOutInfinite);
+		int b = previous.Read(buffer, test_files[f].ChangePoint, SHORT_TIMEOUT);
 		out.Write(buffer, b);
 		
 		// Add new bytes?
@@ -209,7 +210,7 @@
 			previous.Seek(test_files[f].DeleteBytes, IOStream::SeekType_Relative);
 		}
 		// Copy rest of data
-		b = previous.Read(buffer, BUFFER_SIZE, IOStream::TimeOutInfinite);
+		b = previous.Read(buffer, BUFFER_SIZE, SHORT_TIMEOUT);
 		out.Write(buffer, b);
 	}
 }
@@ -245,7 +246,7 @@
 		// Load the directory back in
 		BackupStoreDirectory dir2;
 		FileStream in("testfiles/dir.1");
-		dir2.ReadFromStream(in, IOStream::TimeOutInfinite);
+		dir2.ReadFromStream(in, SHORT_TIMEOUT);
 		// Check entries
 		TEST_THAT(dir2.GetNumberOfEntries() == 4);
 		for(int i = 2; i <= 5; ++i)
@@ -273,7 +274,7 @@
 		{
 			BackupStoreDirectory dir3;
 			FileStream in("testfiles/dir.2");
-			dir3.ReadFromStream(in, IOStream::TimeOutInfinite);
+			dir3.ReadFromStream(in, SHORT_TIMEOUT);
 			dir3.Dump(0, true);
 			for(int i = 2; i <= 5; ++i)
 			{
@@ -442,7 +443,7 @@
 				// Stream
 				BackupStoreDirectory dir;
 				std::auto_ptr<IOStream> dirstream(protocol.ReceiveStream());
-				dir.ReadFromStream(*dirstream, IOStream::TimeOutInfinite);
+				dir.ReadFromStream(*dirstream, SHORT_TIMEOUT);
 				
 				BackupStoreDirectory::Iterator i(dir);
 				BackupStoreDirectory::Entry *en = 0;
@@ -482,7 +483,7 @@
 			BackupStoreDirectory dir;
 			{
 				std::auto_ptr<RaidFileRead> dirStream(RaidFileRead::Open(0, "backup/01234567/o01"));
-				dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite);
+				dir.ReadFromStream(*dirStream, SHORT_TIMEOUT);
 				dir.Dump(0, true);
 				
 				// Check that dependency info is correct
@@ -567,7 +568,7 @@
 						// Get stream
 						std::auto_ptr<IOStream> filestream(protocol.ReceiveStream());
 						// Get and decode
-						BackupStoreFile::DecodeFile(*filestream, filename_fetched, IOStream::TimeOutInfinite);
+						BackupStoreFile::DecodeFile(*filestream, filename_fetched, SHORT_TIMEOUT);
 					}
 				}
 				// Test for identicalness
@@ -578,7 +579,7 @@
 					std::auto_ptr<BackupProtocolSuccess> getblockindex(protocol.QueryGetBlockIndexByID(test_files[f].IDOnServer));
 					TEST_THAT(getblockindex->GetObjectID() == test_files[f].IDOnServer);
 					std::auto_ptr<IOStream> blockIndexStream(protocol.ReceiveStream());
-					TEST_THAT(BackupStoreFile::CompareFileContentsAgainstBlockIndex(filename, *blockIndexStream, IOStream::TimeOutInfinite));
+					TEST_THAT(BackupStoreFile::CompareFileContentsAgainstBlockIndex(filename, *blockIndexStream, SHORT_TIMEOUT));
 				}
 			}
 




More information about the Boxbackup-commit mailing list