summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api/common/api_test.hpp
diff options
context:
space:
mode:
authorKlaus T. Aehlig <aehlig@linta.de>2024-02-06 19:45:55 +0100
committerKlaus T. Aehlig <aehlig@linta.de>2024-02-07 14:18:31 +0100
commitb2f2d647fc1bb7c38d801088ebfed5ff74a1e95a (patch)
tree92e1aa690a1f56a2487ae2fefae83b17efe5c1df /test/buildtool/execution_api/common/api_test.hpp
parent34f68e808a95413cbbbe46ce1b77e4aa3e6d5691 (diff)
downloadjustbuild-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.hpp24
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);