From: robertc <> Date: Tue, 25 Apr 2006 16:39:25 +0000 (+0000) Subject: Fix store tests on windows X-Git-Tag: SQUID_3_0_PRE4~227 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e050051cbf1a39d0d2460cd07fefe4d998d33dd;p=thirdparty%2Fsquid.git Fix store tests on windows --- diff --git a/src/tests/testCoss.cc b/src/tests/testCoss.cc index 09d00cb5f9..4c4f65f71a 100644 --- a/src/tests/testCoss.cc +++ b/src/tests/testCoss.cc @@ -12,6 +12,8 @@ #include "HttpReply.h" #include "StoreFileSystem.h" +#define TESTDIR "testCoss__testCossSearch" + CPPUNIT_TEST_SUITE_REGISTRATION( testCoss ); typedef RefCount 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"); } diff --git a/src/tests/testNull.cc b/src/tests/testNull.cc index 24da87d9d3..fe6aff2589 100644 --- a/src/tests/testNull.cc +++ b/src/tests/testNull.cc @@ -12,6 +12,8 @@ #include "HttpReply.h" #include "StoreFileSystem.h" +#define TESTDIR "testNull__testNullSearch" + CPPUNIT_TEST_SUITE_REGISTRATION( testNull ); typedef RefCount 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); diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index b14f0ab425..1efcb5cc21 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -10,6 +10,8 @@ #include "HttpHeader.h" #include "HttpReply.h" +#define TESTDIR "testUfs__testUfsSearch" + CPPUNIT_TEST_SUITE_REGISTRATION( testUfs ); typedef RefCount 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"); }