]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make IPC base path absolute in testRock
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 22 Sep 2012 18:46:52 +0000 (20:46 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 22 Sep 2012 18:46:52 +0000 (20:46 +0200)
src/tests/testRock.cc

index 088e347c77735cfe9d57845e2d1a034f15016c1c..e403d3a7453a23838a599f77c09d5acb578b0222 100644 (file)
@@ -21,6 +21,9 @@
 #if HAVE_STDEXCEPT
 #include <stdexcept>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #define TESTDIR "testRock__testRockSearch"
 
@@ -28,6 +31,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION( testRock );
 
 extern REMOVALPOLICYCREATE createRemovalPolicy_lru;
 
+static char cwd[MAXPATHLEN];
+
 static void
 addSwapDir(testRock::SwapDirPointer aStore)
 {
@@ -45,7 +50,9 @@ testRock::setUp()
         throw std::runtime_error("Failed to clean test work directory");
 
     // use current directory for shared segments (on path-based OSes)
-    Ipc::Mem::Segment::BasePath = ".";
+    Ipc::Mem::Segment::BasePath = getcwd(cwd,MAXPATHLEN);
+    if (Ipc::Mem::Segment::BasePath == NULL)
+        Ipc::Mem::Segment::BasePath = ".";
 
     Store::Root(new StoreController);