diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-13 16:18:36 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-02-13 17:43:20 +0100 |
commit | 3de6a28f79ddb6e81c360b48eaea3ba10a53ab1f (patch) | |
tree | 184bbd156f180d2f25ce3b7730fb4daa3d9d0c89 /test/buildtool/execution_api/local/local_execution.test.cpp | |
parent | 90baaac7d69d5fd21471b32b0285bd9b562a5137 (diff) | |
download | justbuild-3de6a28f79ddb6e81c360b48eaea3ba10a53ab1f.tar.gz |
local-execution test: set launcher
... to not rely on env implicitly pulling in echo to PATH.
Diffstat (limited to 'test/buildtool/execution_api/local/local_execution.test.cpp')
-rw-r--r--[-rwxr-xr-x] | test/buildtool/execution_api/local/local_execution.test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp index 36615d89..41b416a4 100755..100644 --- a/test/buildtool/execution_api/local/local_execution.test.cpp +++ b/test/buildtool/execution_api/local/local_execution.test.cpp @@ -19,6 +19,7 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact_factory.hpp" #include "src/buildtool/common/repository_config.hpp" +#include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/execution_api/local/local_api.hpp" #include "test/utils/hermeticity/local.hpp" @@ -33,6 +34,21 @@ namespace { "test/buildtool/execution_api/local"; } +inline void SetLauncher() { + std::vector<std::string> launcher{"env"}; + auto* env_path = std::getenv("PATH"); + if (env_path != nullptr) { + launcher.emplace_back(std::string{"PATH="} + std::string{env_path}); + } + else { + launcher.emplace_back("PATH=/bin:/usr/bin"); + } + if (not LocalExecutionConfig::SetLauncher(launcher)) { + Logger::Log(LogLevel::Error, "Failure setting the local launcher."); + std::exit(EXIT_FAILURE); + } +} + } // namespace TEST_CASE_METHOD(HermeticLocalTestFixture, @@ -47,6 +63,8 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, api.CreateAction(*api.UploadTree({}), cmdline, {}, {}, {}, {}); REQUIRE(action); + SetLauncher(); + SECTION("Cache execution result in action cache") { // run execution action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); |