diff options
author | Klaus T. Aehlig <aehlig@linta.de> | 2024-02-06 19:45:55 +0100 |
---|---|---|
committer | Klaus T. Aehlig <aehlig@linta.de> | 2024-02-07 14:18:31 +0100 |
commit | b2f2d647fc1bb7c38d801088ebfed5ff74a1e95a (patch) | |
tree | 92e1aa690a1f56a2487ae2fefae83b17efe5c1df /test/buildtool/execution_api/common/api_test.hpp | |
parent | 34f68e808a95413cbbbe46ce1b77e4aa3e6d5691 (diff) | |
download | justbuild-b2f2d647fc1bb7c38d801088ebfed5ff74a1e95a.tar.gz |
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".
Diffstat (limited to 'test/buildtool/execution_api/common/api_test.hpp')
-rw-r--r-- | test/buildtool/execution_api/common/api_test.hpp | 24 |
1 files changed, 21 insertions, 3 deletions
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<std::string, std::string>; bar_path.string()); }; + auto* path = std::getenv("PATH"); + std::map<std::string, std::string> 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<std::string, std::string> 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<std::string, std::string> 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); |