[Box Backup-dev] COMMIT r611 - box/chris/general/test/backupstorepatch

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Mon Jun 5 14:02:01 BST 2006


Author: chris
Date: 2006-06-05 13:01:57 +0000 (Mon, 05 Jun 2006)
New Revision: 611

Modified:
   box/chris/general/test/backupstorepatch/testbackupstorepatch.cpp
Log:
* testbackupstorepatch.cpp
- Made to initialise Winsock library on Win32
- Fixed paths on Win32
- Fixed 64-bit format strings on Win32
- Wait for housekeeping instead of hupping the store daemon on Win32


Modified: box/chris/general/test/backupstorepatch/testbackupstorepatch.cpp
===================================================================
--- box/chris/general/test/backupstorepatch/testbackupstorepatch.cpp	2006-06-05 13:00:10 UTC (rev 610)
+++ box/chris/general/test/backupstorepatch/testbackupstorepatch.cpp	2006-06-05 13:01:57 UTC (rev 611)
@@ -283,6 +283,14 @@
 
 int test(int argc, const char *argv[])
 {
+#ifdef WIN32
+	// Under win32 we must initialise the Winsock library
+	// before using sockets
+
+	WSADATA info;
+	TEST_THAT(WSAStartup(0x0101, &info) != SOCKET_ERROR)
+#endif
+
 	// Allocate a buffer
 	buffer = ::malloc(BUFFER_SIZE);
 	TEST_THAT(buffer != 0);
@@ -309,8 +317,12 @@
 			"testfiles/clientTrustedCAs.pem");
 
 	// Create an account
+#ifdef WIN32
+	TEST_THAT_ABORTONFAIL(::system("..\\..\\bin\\bbstoreaccounts\\bbstoreaccounts -c testfiles/bbstored.conf create 01234567 0 30000B 40000B") == 0);
+#else
 	TEST_THAT_ABORTONFAIL(::system("../../bin/bbstoreaccounts/bbstoreaccounts -c testfiles/bbstored.conf create 01234567 0 30000B 40000B") == 0);
 	TestRemoteProcessMemLeaks("bbstoreaccounts.memleaks");
+#endif
 
 	// Create test files
 	create_test_files();
@@ -319,7 +331,12 @@
 	test_depends_in_dirs();
 
 	// First, try logging in without an account having been created... just make sure login fails.
+#ifdef WIN32
+	int pid = LaunchServer("..\\..\\bin\\bbstored\\bbstored testfiles/bbstored.conf", "testfiles/bbstored.pid");
+#else
 	int pid = LaunchServer("../../bin/bbstored/bbstored testfiles/bbstored.conf", "testfiles/bbstored.pid");
+#endif
+
 	TEST_THAT(pid != -1 && pid != 0);
 	if(pid > 0)
 	{
@@ -397,7 +414,13 @@
 					// Store details
 					test_files[f].IDOnServer = stored->GetObjectID();
 					test_files[f].IsCompletelyDifferent = isCompletelyDifferent;
-					printf("ID %lld, completely different: %s\n", test_files[f].IDOnServer,
+
+#ifdef WIN32
+					printf("ID %I64d, completely different: %s\n",
+#else
+					printf("ID %lld, completely different: %s\n", 
+#endif
+						test_files[f].IDOnServer,
 						test_files[f].IsCompletelyDifferent?"yes":"no");			
 				}
 				else
@@ -565,9 +588,14 @@
 				writedir.Commit(true);
 			}
 
-			// Send the server a restart signal, so it does housekeeping immedaitely, and wait for it to happen
+#ifdef WIN32
+			wait_for_operation(12);
+#else
+			// Send the server a restart signal, so it does housekeeping immediately, and wait for it to happen
 			::sleep(1);	// wait for old connections to terminate
 			::kill(pid, SIGHUP);
+#endif
+
 			// Get the revision number of the info file
 			int64_t first_revision = 0;
 			RaidFileRead::FileExists(0, "backup/01234567/o01", &first_revision);




More information about the Boxbackup-dev mailing list