diff options
-rw-r--r-- | test/buildtool/execution_api/common/TARGETS | 1 | ||||
-rw-r--r-- | test/buildtool/execution_api/common/api_test.hpp | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/buildtool/execution_api/common/TARGETS b/test/buildtool/execution_api/common/TARGETS index b8039b02..f1b0f211 100644 --- a/test/buildtool/execution_api/common/TARGETS +++ b/test/buildtool/execution_api/common/TARGETS @@ -6,6 +6,7 @@ [ ["@", "catch2", "", "catch2"] , ["@", "src", "src/buildtool/common", "artifact_factory"] , ["@", "src", "src/buildtool/execution_api/common", "common"] + , ["@", "src", "src/buildtool/execution_api/local", "config"] , ["@", "src", "src/buildtool/file_system", "file_system_manager"] ] , "stage": ["test", "buildtool", "execution_api", "common"] diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 2ac6ee10..be9abb1f 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -20,11 +20,27 @@ #include "src/buildtool/execution_api/common/execution_action.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/common/execution_response.hpp" +#include "src/buildtool/execution_api/local/config.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" using ApiFactory = std::function<IExecutionApi::Ptr()>; using ExecProps = std::map<std::string, std::string>; +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); + } +} + [[nodiscard]] static inline auto GetTestDir(std::string const& test_name) -> std::filesystem::path { auto* tmp_dir = std::getenv("TEST_TMPDIR"); @@ -46,6 +62,8 @@ using ExecProps = std::map<std::string, std::string>; auto action = api->CreateAction( *api->UploadTree({}), {"echo", "-n", test_content}, {}, {}, {}, props); + SetLauncher(); + SECTION("Cache execution result in action cache") { action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); |