[Box Backup-commit] COMMIT r1494 - box/chris/merge/test/backupstore

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Mar 25 00:15:46 GMT 2007


Author: chris
Date: 2007-03-25 00:15:46 +0000 (Sun, 25 Mar 2007)
New Revision: 1494

Modified:
   box/chris/merge/test/backupstore/testbackupstore.cpp
Log:
Use #defined paths for applications to fix cross unix/win32 compatibility.

Fix memory leak.

Reformat comments.

(refs #3)


Modified: box/chris/merge/test/backupstore/testbackupstore.cpp
===================================================================
--- box/chris/merge/test/backupstore/testbackupstore.cpp	2007-03-25 00:12:01 UTC (rev 1493)
+++ box/chris/merge/test/backupstore/testbackupstore.cpp	2007-03-25 00:15:46 UTC (rev 1494)
@@ -1684,7 +1684,10 @@
 			"testfiles/clientTrustedCAs.pem");
 
 	// First, try logging in without an account having been created... just make sure login fails.
-	int pid = LaunchServer("../../bin/bbstored/bbstored testfiles/bbstored.conf", "testfiles/bbstored.pid");
+
+	int pid = LaunchServer(BBSTORED " testfiles/bbstored.conf",
+		"testfiles/bbstored.pid");
+
 	TEST_THAT(pid != -1 && pid != 0);
 	if(pid > 0)
 	{
@@ -1713,12 +1716,17 @@
 		}
 
 		// Create an account for the test client
-		TEST_THAT_ABORTONFAIL(::system("../../bin/bbstoreaccounts/bbstoreaccounts -c testfiles/bbstored.conf create 01234567 0 10000B 20000B") == 0);
+		TEST_THAT_ABORTONFAIL(::system(BBSTOREACCOUNTS
+			" -c testfiles/bbstored.conf create 01234567 0 "
+			"10000B 20000B") == 0);
+
 		TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
+
 		TEST_THAT(TestDirExists("testfiles/0_0/backup/01234567"));
 		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
+		TEST_THAT(TestGetFileSize("testfiles/accounts.txt") > 8);
+		// make sure something is written to it
 
 		TEST_THAT(ServerIsAlive(pid));
 
@@ -1742,13 +1750,18 @@
 		TestRemoteProcessMemLeaks("bbstored.memleaks");
 #endif
 		
-		// Set a new limit on the account -- leave the hard limit high to make sure the target for
-		// freeing space is the soft limit.
-		TEST_THAT_ABORTONFAIL(::system("../../bin/bbstoreaccounts/bbstoreaccounts -c testfiles/bbstored.conf setlimit 01234567 10B 20000B") == 0);
+		// Set a new limit on the account -- leave the hard limit 
+		// high to make sure the target for freeing space is the 
+		// soft limit.
+		TEST_THAT_ABORTONFAIL(::system(BBSTOREACCOUNTS 
+			" -c testfiles/bbstored.conf setlimit 01234567 "
+			"10B 20000B") == 0);
 		TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
 
 		// Start things up
-		pid = LaunchServer("../../bin/bbstored/bbstored testfiles/bbstored.conf", "testfiles/bbstored.pid");
+		pid = LaunchServer(BBSTORED " testfiles/bbstored.conf", 
+			"testfiles/bbstored.pid");
+
 		::sleep(1);
 		TEST_THAT(ServerIsAlive(pid));
 		
@@ -1764,8 +1777,9 @@
 
 		// Count the objects again
 		recursive_count_objects_results after = {0,0,0};
-		recursive_count_objects("localhost", BackupProtocolClientListDirectory::RootDirectory, after);
-printf("after.objectsNotDel=%i, deleted=%i, old=%i\n",after.objectsNotDel, after.deleted, after.old);
+		recursive_count_objects("localhost", 
+			BackupProtocolClientListDirectory::RootDirectory, 
+			after);
 
 		// If these tests fail then try increasing the timeout above
 		TEST_THAT(after.objectsNotDel == before.objectsNotDel);
@@ -1773,7 +1787,9 @@
 		TEST_THAT(after.old == 0);
 		
 		// Set a really small hard limit
-		TEST_THAT_ABORTONFAIL(::system("../../bin/bbstoreaccounts/bbstoreaccounts -c testfiles/bbstored.conf setlimit 01234567 10B 20B") == 0);
+		TEST_THAT_ABORTONFAIL(::system(BBSTOREACCOUNTS 
+			" -c testfiles/bbstored.conf setlimit 01234567 "
+			"10B 20B") == 0);
 		TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
 
 		// Try to upload a file and create a directory, and check an error is generated
@@ -1837,11 +1853,16 @@
 	printf("Starting server for connection from remote machines...\n");
 
 	// Create an account for the test client
-	TEST_THAT_ABORTONFAIL(::system("../../bin/bbstoreaccounts/bbstoreaccounts -c testfiles/bbstored.conf create 01234567 0 30000B 40000B") == 0);
+	TEST_THAT_ABORTONFAIL(::system(BBSTOREACCOUNTS 
+		" -c testfiles/bbstored.conf create 01234567 0 "
+		"30000B 40000B") == 0);
 	TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
 
 	// First, try logging in without an account having been created... just make sure login fails.
-	int pid = LaunchServer("../../bin/bbstored/bbstored testfiles/bbstored_multi.conf", "testfiles/bbstored.pid");
+
+	int pid = LaunchServer(BBSTORED " testfiles/bbstored_multi.conf", 
+		"testfiles/bbstored.pid");
+
 	TEST_THAT(pid != -1 && pid != 0);
 	if(pid > 0)
 	{
@@ -1900,6 +1921,7 @@
 
 	CloseHandle(h2);
 	CloseHandle(h1);
+	delete [] wfile;
 
 	h1 = openfile("foo", O_CREAT | O_RDWR, 0);
 	TEST_THAT(h1 != INVALID_HANDLE_VALUE);




More information about the Boxbackup-commit mailing list