summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <randomdan@akira.random.lan>2014-11-26 21:06:25 +0000
committerDan Goodliffe <randomdan@akira.random.lan>2014-11-26 21:06:25 +0000
commitf4e0e4b065ce5c905d628341e5656923e5279185 (patch)
tree856ddaf33ef63eee0743510e2b4a2bd36af860da
parentAdd assertions that the correct data is passed to the presenter (diff)
downloadproject2-f4e0e4b065ce5c905d628341e5656923e5279185.tar.bz2
project2-f4e0e4b065ce5c905d628341e5656923e5279185.tar.xz
project2-f4e0e4b065ce5c905d628341e5656923e5279185.zip
Sorts out unique paths for tests, fixes test names, adds basics of daemon test
-rw-r--r--project2/ice/Jamfile.jam1
-rw-r--r--project2/ice/unittests/Jamfile.jam20
-rw-r--r--project2/ice/unittests/testClient.cpp4
-rw-r--r--project2/ice/unittests/testClientCompile.cpp10
-rw-r--r--project2/ice/unittests/testDaemon.cpp48
-rw-r--r--project2/ice/unittests/testDaemonCompile.cpp15
6 files changed, 85 insertions, 13 deletions
diff --git a/project2/ice/Jamfile.jam b/project2/ice/Jamfile.jam
index 1f418af..2a531cb 100644
--- a/project2/ice/Jamfile.jam
+++ b/project2/ice/Jamfile.jam
@@ -59,6 +59,7 @@ lib p2icedaemon :
: :
<library>../daemon/lib//p2daemonlib
<library>p2ice
+ <include>.
;
lib p2ice :
diff --git a/project2/ice/unittests/Jamfile.jam b/project2/ice/unittests/Jamfile.jam
index 5ae9e28..a793918 100644
--- a/project2/ice/unittests/Jamfile.jam
+++ b/project2/ice/unittests/Jamfile.jam
@@ -72,3 +72,23 @@ unit-test testDaemonCompile :
<library>..//boost_filesystem
;
+unit-test testDaemon :
+ [ glob testDaemon.cpp ]
+ :
+ <define>ROOT=\"$(me)\"
+ <dependency>unittest.ice
+ <library>unittestr
+ <implicit-dependency>unittestr
+ <library>..//p2icedaemon
+ <library>../../ut//p2ut
+ <library>../../xml//p2xml
+ <library>../../basics//p2basics
+ <library>..//Ice
+ <library>..//IceUtil
+ <library>..//boost_filesystem
+#<dependency>testDaemon/task.xml
+#<dependency>testDaemon/taskParams.xml
+#<dependency>testDaemon/view.xml
+#<dependency>testDaemon/viewParams.xml
+ ;
+
diff --git a/project2/ice/unittests/testClient.cpp b/project2/ice/unittests/testClient.cpp
index bade1b2..e5d45b7 100644
--- a/project2/ice/unittests/testClient.cpp
+++ b/project2/ice/unittests/testClient.cpp
@@ -100,9 +100,9 @@ unloadTests()
BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams"), NotSupported);
}
-BOOST_AUTO_TEST_CASE( compile_client_clientOnlySlicer )
+BOOST_AUTO_TEST_CASE( test_client )
{
- const std::string tmpdir = "/tmp/ut/project2.slice/clientOnlySlicer";
+ const std::string tmpdir = "/tmp/ut/project2.slice-client";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
diff --git a/project2/ice/unittests/testClientCompile.cpp b/project2/ice/unittests/testClientCompile.cpp
index 9e75d1b..c86b826 100644
--- a/project2/ice/unittests/testClientCompile.cpp
+++ b/project2/ice/unittests/testClientCompile.cpp
@@ -1,4 +1,4 @@
-#define BOOST_TEST_MODULE Client
+#define BOOST_TEST_MODULE ClientCompile
#include <boost/test/unit_test.hpp>
#include <boost/filesystem/operations.hpp>
#include "iceClient.h"
@@ -45,7 +45,7 @@ unloadTests()
BOOST_AUTO_TEST_CASE( compile_client_full )
{
- const std::string tmpdir = "/tmp/ut/project2.slice/full";
+ const std::string tmpdir = "/tmp/ut/project2.slice-clientCompile/full";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE( compile_client_full )
BOOST_AUTO_TEST_CASE( compile_client_clientOnly )
{
- const std::string tmpdir = "/tmp/ut/project2.slice/clientOnly";
+ const std::string tmpdir = "/tmp/ut/project2.slice-clientCompile/clientOnly";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
@@ -82,9 +82,9 @@ BOOST_AUTO_TEST_CASE( compile_client_clientOnly )
unloadTests();
}
-BOOST_AUTO_TEST_CASE( compile_client_clientOnlySlicer )
+BOOST_AUTO_TEST_CASE( compile_client_slicer )
{
- const std::string tmpdir = "/tmp/ut/project2.slice/clientOnlySlicer";
+ const std::string tmpdir = "/tmp/ut/project2.slice-clientCompile/slicer";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp
new file mode 100644
index 0000000..ce2630c
--- /dev/null
+++ b/project2/ice/unittests/testDaemon.cpp
@@ -0,0 +1,48 @@
+#define BOOST_TEST_MODULE Daemon
+#include <boost/test/unit_test.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <testOptionsSource.h>
+#include <unittest.h>
+#include <iceDaemon.h>
+
+#define XSTR(s) STR(s)
+#define STR(s) #s
+const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path();
+const boost::filesystem::path iceroot(XSTR(ROOT));
+const auto headers = iceroot.parent_path().parent_path();
+
+static
+void
+commonTests()
+{
+ BOOST_TEST_CHECKPOINT("Verify loaded");
+ BOOST_REQUIRE(IceDaemonAdapterHandlerLoader::getFor("UnitTest"));
+}
+
+static
+void
+unloadTests()
+{
+ BOOST_TEST_CHECKPOINT("Verify unloaded");
+ BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest"), NotSupported);
+}
+
+BOOST_AUTO_TEST_CASE( test_daemon )
+{
+ const std::string tmpdir = "/tmp/ut/project2.slice-daemon";
+ BOOST_TEST_CHECKPOINT("Clean up");
+ boost::filesystem::remove_all(tmpdir);
+
+ BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
+ TestOptionsSource::LoadTestOptions({
+ { "library", (bindir / "slicer-yes" / "libunittestr.so").string() },
+ { "ice.compile.tmpdir", tmpdir },
+ { "ice.compile.headers", headers.string() },
+ { "ice.daemon.slicerdaemon", (iceroot / "unittest.ice").string() }
+ });
+ commonTests();
+
+ TestOptionsSource::LoadTestOptions({ });
+ unloadTests();
+}
+
diff --git a/project2/ice/unittests/testDaemonCompile.cpp b/project2/ice/unittests/testDaemonCompile.cpp
index b92159b..7bda6dd 100644
--- a/project2/ice/unittests/testDaemonCompile.cpp
+++ b/project2/ice/unittests/testDaemonCompile.cpp
@@ -1,8 +1,9 @@
-#define BOOST_TEST_MODULE Daemon
+#define BOOST_TEST_MODULE DaemonCompile
#include <boost/test/unit_test.hpp>
#include <boost/filesystem/operations.hpp>
#include <testOptionsSource.h>
#include <exceptions.h>
+#include <iceDaemon.h>
#define XSTR(s) STR(s)
#define STR(s) #s
@@ -14,17 +15,19 @@ static
void
commonTests()
{
+ BOOST_REQUIRE(IceDaemonAdapterHandlerLoader::getFor("UnitTest"));
}
static
void
unloadTests()
{
+ BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest"), NotSupported);
}
BOOST_AUTO_TEST_CASE( compile_daemon_full )
{
- const std::string tmpdir = "/tmp/ut/project2.sliced/full";
+ const std::string tmpdir = "/tmp/ut/project2.slice-daemonCompile/full";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
@@ -40,9 +43,9 @@ BOOST_AUTO_TEST_CASE( compile_daemon_full )
unloadTests();
}
-BOOST_AUTO_TEST_CASE( compile_daemon_clientOnly )
+BOOST_AUTO_TEST_CASE( compile_daemon_daemonOnly )
{
- const std::string tmpdir = "/tmp/ut/project2.sliced/daemonOnly";
+ const std::string tmpdir = "/tmp/ut/project2.slice-daemonCompile/daemonOnly";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
@@ -59,9 +62,9 @@ BOOST_AUTO_TEST_CASE( compile_daemon_clientOnly )
unloadTests();
}
-BOOST_AUTO_TEST_CASE( compile_daemon_clientOnlySlicer )
+BOOST_AUTO_TEST_CASE( compile_daemon_slicer )
{
- const std::string tmpdir = "/tmp/ut/project2.sliced/clientOnlySlicer";
+ const std::string tmpdir = "/tmp/ut/project2.slice-daemonCompile/slicer";
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);