From e3cfa5134b5674f262ae04cdc146cdcbbff52234 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 11 Feb 2016 01:03:25 +0000 Subject: Use pid in test directory so that parallel running tests don't clobber each other --- netfs/unittests/Jamfile.jam | 1 + netfs/unittests/mockDaemon.cpp | 4 +++- netfs/unittests/testCore.cpp | 5 +++-- 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 : boost_utf ROOT=\"$(me)\" : : + ..//adhocutil boost_system boost_filesystem 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 #include +#include -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(); -- cgit v1.2.3