[Box Backup-commit] COMMIT r1538 - box/chris/merge/test/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 21 Apr 2007 12:36:57 +0100


Author: chris
Date: 2007-04-21 12:36:57 +0100 (Sat, 21 Apr 2007)
New Revision: 1538

Modified:
   box/chris/merge/test/bbackupd/testbbackupd.cpp
Log:
Work around lack of pipe support in Win32 system() command (refs #3)


Modified: box/chris/merge/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/merge/test/bbackupd/testbbackupd.cpp	2007-04-21 11:34:34 UTC (rev 1537)
+++ box/chris/merge/test/bbackupd/testbbackupd.cpp	2007-04-21 11:36:57 UTC (rev 1538)
@@ -757,8 +757,15 @@
 
 	// unpack the files for the initial test
 	TEST_THAT(::system("rm -rf testfiles/TestDir1") == 0);
-	TEST_THAT(::system("mkdir testfiles/TestDir1") == 0);
-	TEST_THAT(::system("gzip -d < testfiles/spacetest1.tgz | ( cd testfiles/TestDir1 && tar xf - )") == 0);
+	TEST_THAT(::mkdir("testfiles/TestDir1", 0) == 0);
+
+	#ifdef WIN32
+		TEST_THAT(::system("tar xzvf testfiles/spacetest1.tgz "
+			"-C testfiles/TestDir1") == 0);
+	#else
+		TEST_THAT(::system("gzip -d < testfiles/spacetest1.tgz "
+			"| ( cd testfiles/TestDir1 && tar xf - )") == 0);
+	#endif
 	
 #ifdef PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
 	printf("Skipping intercept-based KeepAlive tests on this platform.\n");