From 3de6a28f79ddb6e81c360b48eaea3ba10a53ab1f Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 13 Feb 2024 16:18:36 +0100 Subject: local-execution test: set launcher ... to not rely on env implicitly pulling in echo to PATH. --- .../execution_api/local/local_execution.test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) mode change 100755 => 100644 test/buildtool/execution_api/local/local_execution.test.cpp (limited to 'test/buildtool/execution_api/local/local_execution.test.cpp') diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp old mode 100755 new mode 100644 index 36615d89..41b416a4 --- 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 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); -- cgit v1.2.3