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
This commit is contained in:
Julio Merino 2014-01-10 23:41:01 +00:00
parent 762c167ede
commit b17b15d8ea
2 changed files with 24 additions and 6 deletions

View File

@ -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

View File

@ -38,6 +38,7 @@ CFLAGS+= -DATF_BUILD_CPPFLAGS='"${_CPPFLAGS}"'
CFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
CFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
CFLAGS+= -DATF_CONFDIR='"${CONFDIR}/atf"'
CFLAGS+= -DATF_C_TESTS_BASE='"${TESTSBASE}/lib/atf/libatf-c"'
CFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
CFLAGS+= -DATF_LIBDIR='"${LIBDIR}"'
CFLAGS+= -DATF_LIBEXECDIR='"${LIBEXECDIR}"'