summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-26 10:56:00 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commit138c171f3d3c24642074329a303932f46e9f19d1 (patch)
tree77c90e23a015b52410c1fc1d058ba51d84b9b824 /test
parent09fb60908a7f00a7c858a45ced77633bac33bd29 (diff)
downloadjustbuild-138c171f3d3c24642074329a303932f46e9f19d1.tar.gz
Pass RemoteContext to Executor/Rebuilder
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/execution_engine/executor/TARGETS3
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp101
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp53
3 files changed, 80 insertions, 77 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS
index 58a6dbdb..ef01b6fc 100644
--- a/test/buildtool/execution_engine/executor/TARGETS
+++ b/test/buildtool/execution_engine/executor/TARGETS
@@ -8,6 +8,7 @@
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/execution_api/common", "common"]
, ["@", "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", "executor"]
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
@@ -31,6 +32,8 @@
, ["@", "src", "src/buildtool/common", "config"]
, ["@", "src", "src/buildtool/common/remote", "retry_config"]
, ["@", "src", "src/buildtool/execution_api/common", "common"]
+ , ["@", "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", "executor"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index dcdfd2dd..2e8a03aa 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -30,6 +30,8 @@
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#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/executor.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/progress_reporting/progress.hpp"
@@ -289,15 +291,16 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -312,15 +315,16 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -335,15 +339,16 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -383,15 +388,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -409,15 +415,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -435,15 +442,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -464,15 +472,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -490,15 +499,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
@@ -519,15 +529,16 @@ TEST_CASE("Executor: Process action", "[executor]") {
Statistics stats{};
Progress progress{};
Auth auth{};
- RetryConfig retry_config{}; // default retry config
+ RetryConfig retry_config{}; // default retry config
+ RemoteExecutionConfig remote_config{}; // default remote config
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_config};
Executor runner{&repo_config,
api.get(),
api.get(),
- /*properties=*/{},
- /*dispatch_list=*/{},
+ &remote_context,
hash_function,
- &auth,
- &retry_config,
&stats,
&progress};
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index e49ab4c4..7bbc9d8f 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -33,6 +33,7 @@
#include "src/buildtool/crypto/hash_function.hpp"
#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/dag/dag.hpp"
#include "src/buildtool/execution_engine/executor/executor.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
@@ -137,6 +138,9 @@ static inline void RunHelloWorldCompilation(
REQUIRE(remote_config);
RetryConfig retry_config{}; // default retry config
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = &*remote_config};
HashFunction const hash_function{Compatibility::IsCompatible()
? HashFunction::Type::PlainSHA256
@@ -146,11 +150,8 @@ static inline void RunHelloWorldCompilation(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
@@ -271,6 +272,9 @@ static inline void RunGreeterCompilation(
REQUIRE(remote_config);
RetryConfig retry_config{}; // default retry config
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = &*remote_config};
HashFunction const hash_function{Compatibility::IsCompatible()
? HashFunction::Type::PlainSHA256
@@ -280,11 +284,8 @@ static inline void RunGreeterCompilation(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
@@ -450,15 +451,15 @@ static inline void TestUploadAndDownloadTrees(
REQUIRE(remote_config);
RetryConfig retry_config{}; // default retry config
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = &*remote_config};
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id)));
@@ -610,6 +611,9 @@ static inline void TestRetrieveOutputDirectories(
REQUIRE(remote_config);
RetryConfig retry_config{}; // default retry config
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = &*remote_config};
SECTION("entire action output as directory") {
auto const make_tree_desc = create_action({}, {""});
@@ -629,11 +633,8 @@ static inline void TestRetrieveOutputDirectories(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -685,11 +686,8 @@ static inline void TestRetrieveOutputDirectories(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -758,11 +756,8 @@ static inline void TestRetrieveOutputDirectories(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
REQUIRE(runner.Process(action));
@@ -833,11 +828,8 @@ static inline void TestRetrieveOutputDirectories(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
CHECK_FALSE(runner.Process(action));
@@ -861,11 +853,8 @@ static inline void TestRetrieveOutputDirectories(
Executor runner{repo_config,
api.get(),
api.get(),
- remote_config->platform_properties,
- remote_config->dispatch,
+ &remote_context,
hash_function,
- auth,
- &retry_config,
stats,
progress};
CHECK_FALSE(runner.Process(action));