tests: remove temporary directory on setup and teardown
Change-Id: I012b11a9d6a46769dc5f6e388ab6bd3f2644607e
diff --git a/tests/daemon/face/unix-stream-channel.t.cpp b/tests/daemon/face/unix-stream-channel.t.cpp
index a767d23..605597d 100644
--- a/tests/daemon/face/unix-stream-channel.t.cpp
+++ b/tests/daemon/face/unix-stream-channel.t.cpp
@@ -42,17 +42,12 @@
UnixStreamChannelFixture()
{
listenerEp = unix_stream::Endpoint(socketPath.string());
-
- // in case an earlier test run crashed without a chance to run the destructor
- boost::system::error_code ec;
- fs::remove_all(testDir, ec);
}
~UnixStreamChannelFixture() override
{
- // cleanup
boost::system::error_code ec;
- fs::remove_all(testDir, ec);
+ fs::remove_all(testDir, ec); // ignore error
}
shared_ptr<UnixStreamChannel>
@@ -86,8 +81,8 @@
}
protected:
- fs::path testDir = fs::path(UNIT_TESTS_TMPDIR) / "unix-stream-channel";
- fs::path socketPath = testDir / "test" / "foo.sock";
+ static inline const fs::path testDir = fs::path(UNIT_TESTS_TMPDIR) / "unix-stream-channel";
+ static inline const fs::path socketPath = testDir / "test" / "foo.sock";
};
BOOST_AUTO_TEST_SUITE(Face)
diff --git a/tests/daemon/face/unix-stream-transport-fixture.hpp b/tests/daemon/face/unix-stream-transport-fixture.hpp
index 253e05c..8aca3da 100644
--- a/tests/daemon/face/unix-stream-transport-fixture.hpp
+++ b/tests/daemon/face/unix-stream-transport-fixture.hpp
@@ -34,7 +34,7 @@
#include "tests/daemon/face/dummy-link-service.hpp"
#include "tests/daemon/face/transport-test-common.hpp"
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
namespace nfd::tests {