]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make IPC base path absolute in testRock
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 24 Sep 2012 11:10:23 +0000 (05:10 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 24 Sep 2012 11:10:23 +0000 (05:10 -0600)
src/tests/testRock.cc

index c64f9167ecf37e9b6cb690ae27241c1460c01927..34b1ff112dd6222f1d6a8ec3636412127471a0d2 100644 (file)
@@ -17,6 +17,9 @@
 #if HAVE_STDEXCEPT
 #include <stdexcept>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #define TESTDIR "testRock__testRockSearch"
 
@@ -24,6 +27,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION( testRock );
 
 extern REMOVALPOLICYCREATE createRemovalPolicy_lru;
 
+static char cwd[MAXPATHLEN];
+
 static void
 addSwapDir(testRock::SwapDirPointer aStore)
 {
@@ -41,7 +46,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);