From 908b00761cdb8953ec88a9cb08a17b815b92c92a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 20 Aug 2018 20:31:04 +0100 Subject: Remove comically GCC specific buildVariant from definedDirs Replace it in its one use by just passing the library path on the test command line --- libadhocutil/definedDirs.h | 12 ------------ libadhocutil/unittests/Jamfile.jam | 2 +- libadhocutil/unittests/testDirs.cpp | 2 -- libadhocutil/unittests/testPluginsRuntime.cpp | 10 +++++++++- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/libadhocutil/definedDirs.h b/libadhocutil/definedDirs.h index 9c1cc84..d3e6507 100644 --- a/libadhocutil/definedDirs.h +++ b/libadhocutil/definedDirs.h @@ -10,21 +10,9 @@ #define XSTR(s) STR(s) #define STR(s) #s -namespace AdHoc { - static boost::filesystem::path getBuildVariant(boost::filesystem::path binDir) - { - boost::filesystem::path p; - while (strncmp(p.c_str(), "gcc-", 4)) { - p = binDir.leaf() / p; - binDir = binDir.parent_path(); - } - return p; - } -} const boost::filesystem::path selfExe = boost::filesystem::canonical("/proc/self/exe"); const boost::filesystem::path binDir = selfExe.parent_path(); const boost::filesystem::path rootDir(XSTR(ROOT)); -const boost::filesystem::path buildVariant = AdHoc::getBuildVariant(binDir); #endif diff --git a/libadhocutil/unittests/Jamfile.jam b/libadhocutil/unittests/Jamfile.jam index dd0a80f..fbf92b4 100644 --- a/libadhocutil/unittests/Jamfile.jam +++ b/libadhocutil/unittests/Jamfile.jam @@ -196,7 +196,7 @@ run run testPluginsRuntime.cpp - : : : + : : utilTestClasses : ROOT=\"$(me)\" BOOST_TEST_DYN_LINK ..//adhocutil diff --git a/libadhocutil/unittests/testDirs.cpp b/libadhocutil/unittests/testDirs.cpp index f215d49..4e07f94 100644 --- a/libadhocutil/unittests/testDirs.cpp +++ b/libadhocutil/unittests/testDirs.cpp @@ -12,7 +12,5 @@ BOOST_AUTO_TEST_CASE( iexist ) BOOST_REQUIRE_EQUAL("unittests", rootDir.leaf().string()); BOOST_REQUIRE(boost::filesystem::is_directory(binDir)); BOOST_REQUIRE_EQUAL("libadhocutil", rootDir.parent_path().leaf().string()); - BOOST_REQUIRE(buildVariant.is_relative()); - BOOST_REQUIRE_EQUAL(selfExe, rootDir / "bin" / "testDirs.test" / buildVariant / "testDirs"); } diff --git a/libadhocutil/unittests/testPluginsRuntime.cpp b/libadhocutil/unittests/testPluginsRuntime.cpp index 654c6ad..b333104 100644 --- a/libadhocutil/unittests/testPluginsRuntime.cpp +++ b/libadhocutil/unittests/testPluginsRuntime.cpp @@ -9,7 +9,15 @@ using namespace AdHoc; -auto lib = rootDir / "bin" / buildVariant / "libutilTestClasses.so"; +boost::filesystem::path lib; +struct GetLibPath { + GetLibPath() + { + BOOST_REQUIRE_EQUAL(2, boost::unit_test::framework::master_test_suite().argc); + lib = boost::unit_test::framework::master_test_suite().argv[1]; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GetLibPath); static std::optional nullResolver(const std::type_info &, const std::string &); static std::optional badResolver(const std::type_info &, const std::string &); -- cgit v1.2.3