diff options
Diffstat (limited to 'test/buildtool/execution_engine/executor')
3 files changed, 117 insertions, 90 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS index ab257156..39a2c3de 100644 --- a/test/buildtool/execution_engine/executor/TARGETS +++ b/test/buildtool/execution_engine/executor/TARGETS @@ -10,6 +10,7 @@ , ["@", "src", "src/buildtool/execution_api/remote", "config"] , ["@", "src", "src/buildtool/execution_api/remote", "context"] , ["@", "src", "src/buildtool/execution_engine/dag", "dag"] + , ["@", "src", "src/buildtool/execution_engine/executor", "context"] , ["@", "src", "src/buildtool/execution_engine/executor", "executor"] , ["@", "src", "src/buildtool/file_system", "file_system_manager"] , ["@", "src", "src/buildtool/progress_reporting", "progress"] @@ -36,6 +37,7 @@ , ["@", "src", "src/buildtool/execution_api/remote", "config"] , ["@", "src", "src/buildtool/execution_api/remote", "context"] , ["@", "src", "src/buildtool/execution_engine/dag", "dag"] + , ["@", "src", "src/buildtool/execution_engine/executor", "context"] , ["@", "src", "src/buildtool/execution_engine/executor", "executor"] , ["@", "src", "src/buildtool/progress_reporting", "progress"] , ["@", "src", "src/buildtool/crypto", "hash_function"] diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 15752c94..961d5b0f 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -32,6 +32,7 @@ #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/execution_api/remote/context.hpp" +#include "src/buildtool/execution_engine/executor/context.hpp" #include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/progress_reporting/progress.hpp" @@ -298,12 +299,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -322,12 +323,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(not runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -346,12 +347,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(not runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -395,12 +396,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -422,12 +423,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -449,12 +450,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -479,12 +480,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -506,12 +507,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); @@ -536,12 +537,12 @@ TEST_CASE("Executor: Process action", "[executor]") { .retry_config = &retry_config, .exec_config = &remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{&repo_config, - &apis, - &remote_context, - hash_function, - &stats, - &progress}; + ExecutionContext const exec_context{.repo_config = &repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = &stats, + .progress = &progress}; + Executor runner{&exec_context}; CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id))); CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id))); diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index bef97e85..896279ef 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -35,6 +35,7 @@ #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/execution_api/remote/context.hpp" #include "src/buildtool/execution_engine/dag/dag.hpp" +#include "src/buildtool/execution_engine/executor/context.hpp" #include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/progress_reporting/progress.hpp" @@ -149,8 +150,13 @@ static inline void RunHelloWorldCompilation( auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{ - repo_config, &apis, &remote_context, hash_function, stats, progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; // upload local artifacts auto const* main_cpp_node = g.ArtifactNodeWithId(main_cpp_id); @@ -279,8 +285,13 @@ static inline void RunGreeterCompilation( auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{ - repo_config, &apis, &remote_context, hash_function, stats, progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; // upload local artifacts for (auto const& id : {greet_hpp_id, greet_cpp_id, main_cpp_id}) { @@ -449,8 +460,14 @@ static inline void TestUploadAndDownloadTrees( .exec_config = &*remote_config}; auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{ - repo_config, &apis, &remote_context, hash_function, stats, progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; + REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id))); REQUIRE(runner.Process(g.ArtifactNodeWithId(bar_id))); @@ -620,12 +637,13 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{repo_config, - &apis, - &remote_context, - hash_function, - stats, - progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; REQUIRE(runner.Process(action)); // read output @@ -673,12 +691,13 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{repo_config, - &apis, - &remote_context, - hash_function, - stats, - progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; REQUIRE(runner.Process(action)); // read output @@ -743,12 +762,13 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{repo_config, - &apis, - &remote_context, - hash_function, - stats, - progress}; + + ExecutionContext const exec_context{.repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; REQUIRE(runner.Process(action)); // read output @@ -815,12 +835,14 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{repo_config, - &apis, - &remote_context, - hash_function, - stats, - progress}; + + ExecutionContext const exec_context{ + .repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; CHECK_FALSE(runner.Process(action)); } @@ -840,12 +862,14 @@ static inline void TestRetrieveOutputDirectories( // run action auto api = factory(); auto const apis = CreateTestApiBundle(hash_function, api); - Executor runner{repo_config, - &apis, - &remote_context, - hash_function, - stats, - progress}; + + ExecutionContext const exec_context{ + .repo_config = repo_config, + .apis = &apis, + .remote_context = &remote_context, + .statistics = stats, + .progress = progress}; + Executor runner{&exec_context}; CHECK_FALSE(runner.Process(action)); } } |