summaryrefslogtreecommitdiffstats
path: root/contrib/atf/atf-c++/detail/test_helpers.cpp
diff options
context:
space:
mode:
authorjmmv <jmmv@FreeBSD.org>2014-01-10 23:41:01 +0000
committerjmmv <jmmv@FreeBSD.org>2014-01-10 23:41:01 +0000
commita243e8b5026111351c044402454aa4be2e77e6d1 (patch)
tree053446401422ce3978c4348969f0db285c9abc62 /contrib/atf/atf-c++/detail/test_helpers.cpp
parente2cefed6a55741b47c724c2b99d20713c700a6a8 (diff)
downloadFreeBSD-src-a243e8b5026111351c044402454aa4be2e77e6d1.zip
FreeBSD-src-a243e8b5026111351c044402454aa4be2e77e6d1.tar.gz
Fix path to the process_helpers for the libatf-c++ tests.
Because we respect the FreeBSD src tree layout under /usr/tests, and because the layout of the tests in the atf distfile does not match the former, the tests for atf-c++ were not able to find the process_helper binary. Fix this by explicitly hardcoding the right path in the FreeBSD test suite. Obtained from: atf (git 1f0e878f7f127741a3762883ef24aef317e239d5) MFC after: 1 week
Diffstat (limited to 'contrib/atf/atf-c++/detail/test_helpers.cpp')
-rw-r--r--contrib/atf/atf-c++/detail/test_helpers.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/contrib/atf/atf-c++/detail/test_helpers.cpp b/contrib/atf/atf-c++/detail/test_helpers.cpp
index dc35da9..92f588d 100644
--- a/contrib/atf/atf-c++/detail/test_helpers.cpp
+++ b/contrib/atf/atf-c++/detail/test_helpers.cpp
@@ -40,6 +40,18 @@
#include "process.hpp"
#include "test_helpers.hpp"
+// Path to the directory containing the libatf-c tests, used to locate the
+// process_helpers program. If NULL (the default), the code will use a
+// relative path. Otherwise, the provided path will be used; this is so
+// that we can locate the helpers binary if the installation uses a
+// different layout than the one we provide (as is the case in FreeBSD).
+#if defined(ATF_C_TESTS_BASE)
+static const char* atf_c_tests_base = ATF_C_TESTS_BASE;
+#else
+static const char* atf_c_tests_base = NULL;
+#endif
+#undef ATF_C_TESTS_BASE
+
void
build_check_cxx_o_aux(const atf::fs::path& sfile, const char* failmsg,
const bool expect_pass)
@@ -80,12 +92,17 @@ header_check(const char *hdrname)
atf::fs::path
get_process_helpers_path(const atf::tests::tc& tc, bool is_detail)
{
- if (is_detail)
- return atf::fs::path(tc.get_config_var("srcdir")) /
- ".." / ".." / "atf-c" / "detail" / "process_helpers";
- else
- return atf::fs::path(tc.get_config_var("srcdir")) /
- ".." / "atf-c" / "detail" / "process_helpers";
+ const char* helper = "detail/process_helpers";
+ if (atf_c_tests_base == NULL) {
+ if (is_detail)
+ return atf::fs::path(tc.get_config_var("srcdir")) /
+ ".." / ".." / "atf-c" / helper;
+ else
+ return atf::fs::path(tc.get_config_var("srcdir")) /
+ ".." / "atf-c" / helper;
+ } else {
+ return atf::fs::path(atf_c_tests_base) / helper;
+ }
}
void
OpenPOWER on IntegriCloud