[Box Backup-commit] COMMIT r1289 - box/chris/general/infrastructure

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Wed Feb 14 23:18:34 GMT 2007


Author: chris
Date: 2007-02-14 23:18:34 +0000 (Wed, 14 Feb 2007)
New Revision: 1289

Modified:
   box/chris/general/infrastructure/buildenv-testmain-template.cpp
Log:
Initialise Windows Sockets before each test, removes the need for 
duplicate code in tests that use sockets.


Modified: box/chris/general/infrastructure/buildenv-testmain-template.cpp
===================================================================
--- box/chris/general/infrastructure/buildenv-testmain-template.cpp	2007-02-14 23:17:40 UTC (rev 1288)
+++ box/chris/general/infrastructure/buildenv-testmain-template.cpp	2007-02-14 23:18:34 UTC (rev 1289)
@@ -30,6 +30,8 @@
 	#include <syslog.h>
 #endif
 
+#include "Test.h"
+
 #include "MemLeakFindOn.h"
 
 int test(int argc, const char *argv[]);
@@ -75,7 +77,8 @@
 {
 	if(filedes_open_at_beginning == -1)
 	{
-		// Not used correctly, pretend that there were things left open so this gets invesitgated
+		// Not used correctly, pretend that there were things 
+		// left open so this gets investigated
 		return true;
 	}
 
@@ -103,6 +106,14 @@
 
 		// banner
 		printf("Running test TEST_NAME in " MODE_TEXT " mode...\n");
+
+		#ifdef WIN32
+			// Under win32 we must initialise the Winsock library
+			// before using sockets
+
+			WSADATA info;
+			TEST_THAT(WSAStartup(0x0101, &info) != SOCKET_ERROR)
+		#endif
 	}
 	try
 	{




More information about the Boxbackup-commit mailing list