summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/unittests/mockDaemon.cpp10
-rw-r--r--netfs/unittests/testCore.cpp14
-rw-r--r--netfs/unittests/testEdgeCases.cpp28
-rw-r--r--netfs/unittests/testGlacier.cpp14
4 files changed, 21 insertions, 45 deletions
diff --git a/netfs/unittests/mockDaemon.cpp b/netfs/unittests/mockDaemon.cpp
index fa8c1a0..a345b59 100644
--- a/netfs/unittests/mockDaemon.cpp
+++ b/netfs/unittests/mockDaemon.cpp
@@ -1,14 +1,8 @@
#include "mockDaemon.h"
#include <boost/filesystem/operations.hpp>
+#include <definedDirs.h>
-#ifndef ROOT
-#error "ROOT needs to be defined at compilation time"
-#endif
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const boost::filesystem::path RootDir(XSTR(ROOT));
-const boost::filesystem::path TestExportRoot(RootDir / "testExport");
+const boost::filesystem::path TestExportRoot(rootDir / "testExport");
MockDaemon::MockDaemon(const std::string & ep) :
NetFSDaemon(),
diff --git a/netfs/unittests/testCore.cpp b/netfs/unittests/testCore.cpp
index 927262b..c18f1cb 100644
--- a/netfs/unittests/testCore.cpp
+++ b/netfs/unittests/testCore.cpp
@@ -2,26 +2,20 @@
#include <boost/test/unit_test.hpp>
#include "mockDaemon.h"
#include "mockFuse.h"
+#include <definedDirs.h>
#include <boost/filesystem/path.hpp>
-#ifndef ROOT
-#error "ROOT needs to be defined at compilation time"
-#endif
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const boost::filesystem::path RootDir(XSTR(ROOT));
const std::string testEndpoint("tcp -h localhost -p 12012");
class Core {
public:
Core(const std::string & daemonConfig = "defaultDaemon.xml", const std::string & fuseConfig = "defaultFuse.xml") :
daemonHost(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / daemonConfig).string()
+ "--NetFSD.ConfigPath=" + (rootDir / daemonConfig).string()
}),
fuseHost(testEndpoint, {
- (RootDir / fuseConfig).string() + ":testvol",
- (RootDir / "test").string()
+ (rootDir / fuseConfig).string() + ":testvol",
+ (rootDir / "test").string()
}),
ic(daemonHost.ic),
fuse(fuseHost.fuse)
diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp
index 7bf543c..3fa5df3 100644
--- a/netfs/unittests/testEdgeCases.cpp
+++ b/netfs/unittests/testEdgeCases.cpp
@@ -3,24 +3,18 @@
#include "mockDaemon.h"
#include "mockFuse.h"
#include <boost/filesystem/path.hpp>
+#include <definedDirs.h>
-#ifndef ROOT
-#error "ROOT needs to be defined at compilation time"
-#endif
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const boost::filesystem::path RootDir(XSTR(ROOT));
const std::string testEndpoint("tcp -h localhost -p 12014");
BOOST_AUTO_TEST_CASE ( createAndDaemonRestart )
{
MockDaemonHost daemon(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ "--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()
});
FuseMockHost fuse(testEndpoint, {
- (RootDir / "defaultFuse.xml:testvol").string(),
- (RootDir / "test").string()
+ (rootDir / "defaultFuse.xml:testvol").string(),
+ (rootDir / "test").string()
});
struct statvfs s;
@@ -61,14 +55,14 @@ BOOST_AUTO_TEST_CASE ( createAndDaemonRestart )
BOOST_AUTO_TEST_CASE( noDaemonAtStartUp )
{
FuseMockHost fuse(testEndpoint, {
- (RootDir / "defaultFuse.xml:testvol").string(),
- (RootDir / "test").string()
+ (rootDir / "defaultFuse.xml:testvol").string(),
+ (rootDir / "test").string()
});
struct statvfs s;
BOOST_REQUIRE_EQUAL(-ENOSYS, fuse.fuse->statfs("/", &s));
MockDaemonHost daemon(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ "--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()
});
BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s));
@@ -77,13 +71,13 @@ BOOST_AUTO_TEST_CASE( noDaemonAtStartUp )
BOOST_AUTO_TEST_CASE ( daemonUnavailableAfterUse )
{
FuseMockHost fuse(testEndpoint, {
- (RootDir / "defaultFuse.xml:testvol").string(),
- (RootDir / "test").string()
+ (rootDir / "defaultFuse.xml:testvol").string(),
+ (rootDir / "test").string()
});
struct statvfs s;
{
MockDaemonHost daemon(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ "--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()
});
BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s));
@@ -91,7 +85,7 @@ BOOST_AUTO_TEST_CASE ( daemonUnavailableAfterUse )
BOOST_REQUIRE_EQUAL(-ENOSYS, fuse.fuse->statfs("/", &s));
{
MockDaemonHost daemon(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ "--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()
});
BOOST_REQUIRE_EQUAL(0, fuse.fuse->statfs("/", &s));
diff --git a/netfs/unittests/testGlacier.cpp b/netfs/unittests/testGlacier.cpp
index 8c9a79c..b21b7e6 100644
--- a/netfs/unittests/testGlacier.cpp
+++ b/netfs/unittests/testGlacier.cpp
@@ -4,14 +4,8 @@
#include "mockFuse.h"
#include <boost/filesystem/path.hpp>
#include <boost/scope_exit.hpp>
+#include <definedDirs.h>
-#ifndef ROOT
-#error "ROOT needs to be defined at compilation time"
-#endif
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-const boost::filesystem::path RootDir(XSTR(ROOT));
const std::string testEndpoint("tcp -h localhost -p 12013");
BOOST_AUTO_TEST_CASE ( withRouter )
@@ -26,11 +20,11 @@ BOOST_AUTO_TEST_CASE ( withRouter )
{
MockDaemonHost daemon(testEndpoint, {
- "--NetFSD.ConfigPath=" + (RootDir / "defaultDaemon.xml").string()
+ "--NetFSD.ConfigPath=" + (rootDir / "defaultDaemon.xml").string()
});
FuseMockHost fuse(testEndpoint, {
- (RootDir / "defaultFuse.xml:testvol").string(),
- (RootDir / "test").string(),
+ (rootDir / "defaultFuse.xml:testvol").string(),
+ (rootDir / "test").string(),
"--Ice.Default.Router=Glacier2/router:tcp -h localhost -p 14063"
});