From 5686c6c38a3e1cc78804eaf5f880bda23dcf592f Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 29 May 2013 19:41:36 +0000 Subject: [PATCH] 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 --- contrib/atf/atf-c++/check_test.cpp | 4 ++-- contrib/atf/atf-c++/detail/process_test.cpp | 4 ++-- contrib/atf/atf-c++/detail/test_helpers.cpp | 10 +++++++--- contrib/atf/atf-c++/detail/test_helpers.hpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/atf/atf-c++/check_test.cpp b/contrib/atf/atf-c++/check_test.cpp index fd528e9d31a7..a4c499388b8f 100644 --- a/contrib/atf/atf-c++/check_test.cpp +++ b/contrib/atf/atf-c++/check_test.cpp @@ -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] << " " diff --git a/contrib/atf/atf-c++/detail/process_test.cpp b/contrib/atf/atf-c++/detail/process_test.cpp index d13ab9453a8c..a40f663108f3 100644 --- a/contrib/atf/atf-c++/detail/process_test.cpp +++ b/contrib/atf/atf-c++/detail/process_test.cpp @@ -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()); diff --git a/contrib/atf/atf-c++/detail/test_helpers.cpp b/contrib/atf/atf-c++/detail/test_helpers.cpp index 42bd711dc7d6..107b45a9403f 100644 --- a/contrib/atf/atf-c++/detail/test_helpers.cpp +++ b/contrib/atf/atf-c++/detail/test_helpers.cpp @@ -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 diff --git a/contrib/atf/atf-c++/detail/test_helpers.hpp b/contrib/atf/atf-c++/detail/test_helpers.hpp index 059a0a5b4b7b..1f9c41c2fd83 100644 --- a/contrib/atf/atf-c++/detail/test_helpers.hpp +++ b/contrib/atf/atf-c++/detail/test_helpers.hpp @@ -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*);