summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-02-11 01:03:25 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-02-11 01:03:25 +0000
commite3cfa5134b5674f262ae04cdc146cdcbbff52234 (patch)
tree8857a21fb25421c28a7f628dd293dc36a75560a3
parentRemove the readonly bits... never made sense (diff)
downloadnetfs-e3cfa5134b5674f262ae04cdc146cdcbbff52234.tar.bz2
netfs-e3cfa5134b5674f262ae04cdc146cdcbbff52234.tar.xz
netfs-e3cfa5134b5674f262ae04cdc146cdcbbff52234.zip
Use pid in test directory so that parallel running tests don't clobber each other
-rw-r--r--netfs/unittests/Jamfile.jam1
-rw-r--r--netfs/unittests/mockDaemon.cpp4
-rw-r--r--netfs/unittests/testCore.cpp5
3 files changed, 7 insertions, 3 deletions
diff --git a/netfs/unittests/Jamfile.jam b/netfs/unittests/Jamfile.jam
index 0065b13..1aebcec 100644
--- a/netfs/unittests/Jamfile.jam
+++ b/netfs/unittests/Jamfile.jam
@@ -23,6 +23,7 @@ lib testMocks :
<library>boost_utf
<define>ROOT=\"$(me)\"
: :
+ <library>..//adhocutil
<library>boost_system
<library>boost_filesystem
<define>ROOT=\"$(me)\"
diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp
index a345b59..af3cf04 100644
--- a/netfs/unittests/mockDaemon.cpp
+++ b/netfs/unittests/mockDaemon.cpp
@@ -1,8 +1,10 @@
#include "mockDaemon.h"
#include <boost/filesystem/operations.hpp>
#include <definedDirs.h>
+#include <buffer.h>
-const boost::filesystem::path TestExportRoot(rootDir / "testExport");
+const boost::filesystem::path TestExportRoot(rootDir /
+ stringbf("testExport-%d", getpid()));
MockDaemon::MockDaemon(const std::string & ep) :
NetFSDaemon(),
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp
index 7e5136e..9c8419b 100644
--- a/netfs/unittests/testCore.cpp
+++ b/netfs/unittests/testCore.cpp
@@ -50,6 +50,7 @@ BOOST_AUTO_TEST_CASE ( clientInitialised )
BOOST_AUTO_TEST_CASE( testSandboxing )
{
+ const auto testExport = stringbf("testExport-%d", getpid());
// A previous (bad) run might create one or more of these:
boost::filesystem::remove(rootDir / "outside");
boost::filesystem::remove(rootDir / "sub" / "outside");
@@ -71,11 +72,11 @@ BOOST_AUTO_TEST_CASE( testSandboxing )
int fd = fuse->create("/inside", 0666, &fi);
BOOST_REQUIRE(fd >= 0);
fuse->release("/inside", &fi);
- BOOST_REQUIRE(boost::filesystem::exists(rootDir / "testExport" / "inside"));
+ BOOST_REQUIRE(boost::filesystem::exists(rootDir / testExport / "inside"));
int fd2 = fuse->create("inside", 0666, &fi);
BOOST_REQUIRE(fd2 >= 0);
fuse->release("inside", &fi);
- BOOST_REQUIRE(boost::filesystem::exists(rootDir / "testExport" / "inside"));
+ BOOST_REQUIRE(boost::filesystem::exists(rootDir / testExport / "inside"));
}
BOOST_AUTO_TEST_SUITE_END();