From b2f2d647fc1bb7c38d801088ebfed5ff74a1e95a Mon Sep 17 00:00:00 2001 From: "Klaus T. Aehlig" Date: Tue, 6 Feb 2024 19:45:55 +0100 Subject: execution-api tests: provide PATH where needed ... to make tests pass also on systems where /bin/sh does not, by default, pull in a path to "the standard tools". --- test/buildtool/execution_api/common/api_test.hpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'test/buildtool/execution_api/common/api_test.hpp') diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index ce0e3dd2..2ac6ee10 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -360,11 +360,17 @@ using ExecProps = std::map; bar_path.string()); }; + auto* path = std::getenv("PATH"); + std::map env{}; + if (path != nullptr) { + env.emplace("PATH", path); + } + auto action = api->CreateAction(*api->UploadTree({}), {"/bin/sh", "-c", make_cmd("root")}, {}, {"root"}, - {}, + env, props); action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); @@ -426,11 +432,17 @@ TestRetrieveFileAndSymlinkWithSameContentToPath(ApiFactory const& api_factory, bar_path.string()); }; + auto* path = std::getenv("PATH"); + std::map env{}; + if (path != nullptr) { + env.emplace("PATH", path); + } + auto action = api->CreateAction(*api->UploadTree({}), {"/bin/sh", "-c", make_cmd("root")}, {}, {"root"}, - {}, + env, props); action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); @@ -488,11 +500,17 @@ TestRetrieveFileAndSymlinkWithSameContentToPath(ApiFactory const& api_factory, foo_path.string(), link_path.string()); + auto* path = std::getenv("PATH"); + std::map env{}; + if (path != nullptr) { + env.emplace("PATH", path); + } + auto action = api->CreateAction(*api->UploadTree({}), {"/bin/sh", "-c", cmd}, {foo_path.string(), link_path.string()}, {bar_path.parent_path().string()}, - {}, + env, props); action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); -- cgit v1.2.3