Modify atf::fs::path::get_process_helpers_path API to properly

handle pathing with detail/ tests. Based on patch pushed upstream to
ATF project.

Obtained from:	Garrett Cooper <yaneurabeya@gmail.com>
This commit is contained in:
Marcel Moolenaar 2013-05-29 19:41:36 +00:00
parent 021a0587d1
commit 5686c6c38a
4 changed files with 12 additions and 8 deletions

View File

@ -61,7 +61,7 @@ std::auto_ptr< atf::check::check_result >
do_exec(const atf::tests::tc* tc, const char* helper_name)
{
std::vector< std::string > argv;
argv.push_back(get_process_helpers_path(*tc).str());
argv.push_back(get_process_helpers_path(*tc, false).str());
argv.push_back(helper_name);
std::cout << "Executing " << argv[0] << " " << argv[1] << "\n";
@ -74,7 +74,7 @@ std::auto_ptr< atf::check::check_result >
do_exec(const atf::tests::tc* tc, const char* helper_name, const char *carg2)
{
std::vector< std::string > argv;
argv.push_back(get_process_helpers_path(*tc).str());
argv.push_back(get_process_helpers_path(*tc, false).str());
argv.push_back(helper_name);
argv.push_back(carg2);
std::cout << "Executing " << argv[0] << " " << argv[1] << " "

View File

@ -64,10 +64,10 @@ exec_process_helpers(const atf::tests::tc& tc, const char* helper_name)
using atf::process::exec;
std::vector< std::string > argv;
argv.push_back(get_process_helpers_path(tc).leaf_name());
argv.push_back(get_process_helpers_path(tc, true).leaf_name());
argv.push_back(helper_name);
return exec(get_process_helpers_path(tc),
return exec(get_process_helpers_path(tc, true),
atf::process::argv_array(argv),
atf::process::stream_inherit(),
atf::process::stream_inherit());

View File

@ -82,10 +82,14 @@ header_check(const char *hdrname)
}
atf::fs::path
get_process_helpers_path(const atf::tests::tc& tc)
get_process_helpers_path(const atf::tests::tc& tc, bool is_detail)
{
return atf::fs::path(tc.get_config_var("srcdir")) /
".." / "atf-c" / "detail" / "process_helpers";
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";
}
bool

View File

@ -86,7 +86,7 @@ class tc;
void header_check(const char*);
void build_check_cxx_o(const atf::tests::tc&, const char*, const char*, bool);
atf::fs::path get_process_helpers_path(const atf::tests::tc&);
atf::fs::path get_process_helpers_path(const atf::tests::tc&, bool);
bool grep_file(const char*, const char*);
bool grep_string(const std::string&, const char*);