[Box Backup-commit] COMMIT r2276 - box/trunk/test/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Fri, 12 Sep 2008 21:39:45 +0100 (BST)


Author: chris
Date: 2008-09-12 21:39:45 +0100 (Fri, 12 Sep 2008)
New Revision: 2276

Modified:
   box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Test for read errors being reported at more points during the tests.

Test that symlink to self does not cause restore to fail.


Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp	2008-09-07 13:20:14 UTC (rev 2275)
+++ box/trunk/test/bbackupd/testbbackupd.cpp	2008-09-12 20:39:45 UTC (rev 2276)
@@ -1230,6 +1230,9 @@
 	}
 #endif // PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 
+	// Check that no read error has been reported yet
+	TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 	std::string cmd = BBACKUPD " " + bbackupd_args + 
 		" testfiles/bbackupd.conf";
 
@@ -1658,6 +1661,9 @@
 		}
 	}
 
+	// Check that no read error has been reported yet
+	TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 	#ifndef WIN32 // requires fork
 	printf("\n==== Testing that bbackupd responds correctly to "
 		"connection failure\n");
@@ -1820,6 +1826,9 @@
 			DIRECTORY_SEPARATOR "b"
 			DIRECTORY_SEPARATOR "link") == 0);
 
+		// also test symlink-to-self loop does not break restore
+		TEST_THAT(symlink("self", SYM_DIR "/self") == 0);
+
 		::wait_for_operation(4);
 		::sync_and_wait();
 
@@ -1919,6 +1928,9 @@
 	}
 	#endif // !WIN32
 
+	// Check that no read error has been reported yet
+	TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 	printf("\n==== Testing that redundant locations are deleted on time\n");
 
 	// BLOCK
@@ -2023,6 +2035,9 @@
 
 	if(bbackupd_pid > 0)
 	{
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		printf("\n==== Check that read-only directories and "
 			"their contents can be restored.\n");
 
@@ -2383,6 +2398,9 @@
 			BackupQueries::ReturnCode::Compare_Different);
 #endif // WIN32
 
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		TEST_THAT(ServerIsAlive(bbackupd_pid));
 		TEST_THAT(ServerIsAlive(bbstored_pid));
 		if (!ServerIsAlive(bbackupd_pid)) return 1;
@@ -2495,6 +2513,9 @@
 			}
 		}
 
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		TEST_THAT(ServerIsAlive(bbackupd_pid));
 		TEST_THAT(ServerIsAlive(bbstored_pid));
 		if (!ServerIsAlive(bbackupd_pid)) return 1;
@@ -3009,6 +3030,9 @@
 			BackupQueries::ReturnCode::Compare_Same);
 		TestRemoteProcessMemLeaks("bbackupquery.memleaks");
 		
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		TEST_THAT(ServerIsAlive(bbackupd_pid));
 		TEST_THAT(ServerIsAlive(bbstored_pid));
 		if (!ServerIsAlive(bbackupd_pid)) return 1;
@@ -3049,6 +3073,9 @@
 		if (!ServerIsAlive(bbackupd_pid)) return 1;
 		if (!ServerIsAlive(bbstored_pid)) return 1;
 
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		// Check that modifying files with old timestamps
 		// still get added
 		printf("\n==== Modify existing file, but change timestamp "
@@ -3108,6 +3135,9 @@
 		if (!ServerIsAlive(bbackupd_pid)) return 1;
 		if (!ServerIsAlive(bbstored_pid)) return 1;
 
+		// Check that no read error has been reported yet
+		TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 		// Add some files and directories which are marked as excluded
 		printf("\n==== Add files and dirs for exclusion test\n");
 		#ifdef WIN32
@@ -3194,6 +3224,9 @@
 		// These tests only work as non-root users.
 		if(::getuid() != 0)
 		{
+			// Check that the error has not been reported yet
+			TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.1"));
+
 			// Check that read errors are reported neatly
 			printf("\n==== Add unreadable files\n");
 			
@@ -3816,6 +3849,8 @@
 			// backed up on the next run.
 			CloseHandle(handle);
 			wait_for_sync_end();
+
+			// still no read errors?
 			TEST_THAT(!TestFileExists("testfiles/"
 				"notifyran.read-error.2"));