From 7dbfe09c29254f0532234c4b19c33544d4e479ce Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 26 Nov 2014 21:06:25 +0000 Subject: Sorts out unique paths for tests, fixes test names, adds basics of daemon test --- project2/ice/Jamfile.jam | 1 + project2/ice/unittests/Jamfile.jam | 20 ++++++++++++ project2/ice/unittests/testClient.cpp | 4 +-- project2/ice/unittests/testClientCompile.cpp | 10 +++--- project2/ice/unittests/testDaemon.cpp | 48 ++++++++++++++++++++++++++++ project2/ice/unittests/testDaemonCompile.cpp | 15 +++++---- 6 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 project2/ice/unittests/testDaemon.cpp 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 : : : ../daemon/lib//p2daemonlib p2ice + . ; 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 : ..//boost_filesystem ; +unit-test testDaemon : + [ glob testDaemon.cpp ] + : + ROOT=\"$(me)\" + unittest.ice + unittestr + unittestr + ..//p2icedaemon + ../../ut//p2ut + ../../xml//p2xml + ../../basics//p2basics + ..//Ice + ..//IceUtil + ..//boost_filesystem +#testDaemon/task.xml +#testDaemon/taskParams.xml +#testDaemon/view.xml +#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 #include #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 +#include +#include +#include +#include + +#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 #include #include #include +#include #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); -- cgit v1.2.3