]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix store tests on windows
authorrobertc <>
Tue, 25 Apr 2006 16:39:25 +0000 (16:39 +0000)
committerrobertc <>
Tue, 25 Apr 2006 16:39:25 +0000 (16:39 +0000)
src/tests/testCoss.cc
src/tests/testNull.cc
src/tests/testUfs.cc

index 09d00cb5f9b265631c7317338c0b355c45c62581..4c4f65f71ad0e3761818e88042fcc59165e20e1e 100644 (file)
@@ -12,6 +12,8 @@
 #include "HttpReply.h"
 #include "StoreFileSystem.h"
 
+#define TESTDIR "testCoss__testCossSearch"
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testCoss );
 
 typedef RefCount<CossSwapDir> SwapDirPointer;
@@ -74,7 +76,7 @@ testCoss::commonInit()
 void
 testCoss::testCossCreate()
 {
-    if (0 > system ("rm -rf testCoss::testCossSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 
     StorePointer aRoot (new StoreController);
@@ -87,7 +89,7 @@ testCoss::testCossCreate()
 
     commonInit();
 
-    char *path=xstrdup("testCoss::testCossSearch");
+    char *path=xstrdup(TESTDIR);
 
     char *config_line=xstrdup("foo 100 max-size=102400 block-size=512 IOEngine=Blocking");
 
@@ -104,7 +106,7 @@ testCoss::testCossCreate()
 
     struct stat sb;
 
-    CPPUNIT_ASSERT(::stat("testCoss::testCossSearch", &sb) == 0);
+    CPPUNIT_ASSERT(::stat(TESTDIR, &sb) == 0);
 
     /* TODO: check the size */
 
@@ -116,7 +118,7 @@ testCoss::testCossCreate()
 
     //    safe_free(Config.replPolicy->type);
     //    delete Config.replPolicy;
-    if (0 > system ("rm -rf testCoss::testCossSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 }
 
@@ -140,7 +142,7 @@ testCoss::testCossSearch()
      * check the entries we find are what we want
      */
 
-    if (0 > system ("rm -rf testCoss::testCossSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 
     StorePointer aRoot (new StoreController);
@@ -153,7 +155,7 @@ testCoss::testCossSearch()
 
     commonInit();
 
-    char *path=xstrdup("testCoss::testCossSearch");
+    char *path=xstrdup(TESTDIR);
 
     char *config_line=xstrdup("foo 100 max-size=102400 block-size=512 IOEngine=Blocking");
 
@@ -260,6 +262,6 @@ testCoss::testCossSearch()
     //TODO: do this once, or each time.    safe_free(Config.replPolicy->type);
     //    delete Config.replPolicy;
 
-    if (0 > system ("rm -rf testCoss::testCossSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 }
index 24da87d9d3323511d2ed413a68ab76c14076ad2f..fe6aff2589aa10fa88ed631c70e5e5ebfe85b48a 100644 (file)
@@ -12,6 +12,8 @@
 #include "HttpReply.h"
 #include "StoreFileSystem.h"
 
+#define TESTDIR "testNull__testNullSearch"
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testNull );
 
 typedef RefCount<NullSwapDir> SwapDirPointer;
@@ -81,7 +83,7 @@ testNull::testNullCreate()
 
     commonInit();
 
-    char *path=xstrdup("testNull::testNullSearch");
+    char *path=xstrdup(TESTDIR);
     char *config_line=xstrdup("foo");
     strtok(config_line, w_space);
     aStore->parse(0, path);
@@ -126,7 +128,7 @@ testNull::testNullSearch()
 
     commonInit();
 
-    char *path=xstrdup("testNull::testNullSearch");
+    char *path=xstrdup(TESTDIR);
     char *config_line=xstrdup("foo");
     strtok(config_line, w_space);
     aStore->parse(0, path);
index b14f0ab425c13562d3fbd4611df33574240c93ce..1efcb5cc211eb0cac260b064c122936c3b215746 100644 (file)
@@ -10,6 +10,8 @@
 #include "HttpHeader.h"
 #include "HttpReply.h"
 
+#define TESTDIR "testUfs__testUfsSearch"
+
 CPPUNIT_TEST_SUITE_REGISTRATION( testUfs );
 
 typedef RefCount<UFSSwapDir> SwapDirPointer;
@@ -43,7 +45,7 @@ testUfs::testUfsSearch()
      * check the entries we find are what we want
      */
 
-    if (0 > system ("rm -rf testUfs::testUfsSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 
     StorePointer aRoot (new StoreController);
@@ -85,7 +87,7 @@ testUfs::testUfsSearch()
 
     mem_policy = createRemovalPolicy(Config.replPolicy);
 
-    char *path=xstrdup("testUfs::testUfsSearch");
+    char *path=xstrdup(TESTDIR);
 
     char *config_line=xstrdup("foo 100 1 1");
 
@@ -192,6 +194,6 @@ testUfs::testUfsSearch()
     safe_free(Config.replPolicy->type);
     delete Config.replPolicy;
 
-    if (0 > system ("rm -rf testUfs::testUfsSearch"))
+    if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 }