diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-29 17:11:53 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-30 12:10:06 +0200 |
commit | ab0e0b86fff94bed224f894be6b555272857e336 (patch) | |
tree | a7b7abf004e761b34e58bf68986b6ee2c7d71440 /test | |
parent | e607a21fcf2c1b50e347adbc66c0af3ed0df75aa (diff) | |
download | justbuild-ab0e0b86fff94bed224f894be6b555272857e336.tar.gz |
Pass LocalContext to ApiBundle
Diffstat (limited to 'test')
-rw-r--r-- | test/buildtool/build_engine/target_map/TARGETS | 1 | ||||
-rw-r--r-- | test/buildtool/build_engine/target_map/target_map.test.cpp | 65 | ||||
-rw-r--r-- | test/buildtool/graph_traverser/TARGETS | 1 | ||||
-rw-r--r-- | test/buildtool/graph_traverser/graph_traverser.test.hpp | 117 |
4 files changed, 98 insertions, 86 deletions
diff --git a/test/buildtool/build_engine/target_map/TARGETS b/test/buildtool/build_engine/target_map/TARGETS index 9b3865d8..af1a400e 100644 --- a/test/buildtool/build_engine/target_map/TARGETS +++ b/test/buildtool/build_engine/target_map/TARGETS @@ -33,6 +33,7 @@ , ["@", "src", "src/buildtool/common", "common"] , ["@", "src", "src/buildtool/common/remote", "retry_config"] , ["@", "src", "src/buildtool/execution_api/local", "config"] + , ["@", "src", "src/buildtool/execution_api/local", "context"] , ["@", "src", "src/buildtool/execution_api/remote", "config"] , ["@", "src", "src/buildtool/file_system", "file_root"] , ["@", "src", "src/buildtool/progress_reporting", "progress"] diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp index 18927cf4..4524d1b0 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -32,6 +32,7 @@ #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/execution_api/local/config.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/main/analyse_context.hpp" @@ -112,9 +113,11 @@ TEST_CASE("simple targets", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -566,9 +569,11 @@ TEST_CASE("configuration deduplication", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -665,9 +670,11 @@ TEST_CASE("generator functions in string arguments", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -776,9 +783,11 @@ TEST_CASE("built-in rules", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -999,9 +1008,11 @@ TEST_CASE("target reference", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -1153,9 +1164,11 @@ TEST_CASE("trees", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -1271,9 +1284,11 @@ TEST_CASE("RESULT error reporting", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, @@ -1448,9 +1463,11 @@ TEST_CASE("wrong arguments", "[target_map]") { RemoteExecutionConfig remote_exec_config{}; Auth auth{}; RetryConfig retry_config{}; - ApiBundle const apis{&storage_config.Get(), - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config.Get(), + .storage = &storage}; + ApiBundle const apis{&local_context, /*repo_config=*/nullptr, &auth, &retry_config, diff --git a/test/buildtool/graph_traverser/TARGETS b/test/buildtool/graph_traverser/TARGETS index 0ed5533f..189ad233 100644 --- a/test/buildtool/graph_traverser/TARGETS +++ b/test/buildtool/graph_traverser/TARGETS @@ -9,6 +9,7 @@ , ["@", "src", "src/buildtool/common", "common"] , ["@", "src", "src/buildtool/common/remote", "retry_config"] , ["@", "src", "src/buildtool/execution_api/local", "config"] + , ["@", "src", "src/buildtool/execution_api/local", "context"] , ["@", "src", "src/buildtool/execution_api/remote", "config"] , ["@", "src", "src/buildtool/file_system", "file_system_manager"] , ["@", "src", "src/buildtool/file_system", "jsonfs"] diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp index 4fe78886..c28f3a6c 100644 --- a/test/buildtool/graph_traverser/graph_traverser.test.hpp +++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp @@ -33,6 +33,7 @@ #include "src/buildtool/common/statistics.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/execution_api/local/config.hpp" +#include "src/buildtool/execution_api/local/context.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/jsonfs.hpp" @@ -171,13 +172,12 @@ class TestProject { Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -205,9 +205,7 @@ class TestProject { SECTION("Executable is retrieved as executable") { auto const clargs_exec = p.CmdLineArgs("_entry_points_get_executable"); RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, + ApiBundle const apis{&local_context, p.GetRepoConfig(), auth, &retry_config, @@ -251,13 +249,12 @@ class TestProject { Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -292,13 +289,12 @@ class TestProject { Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser const gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -353,9 +349,11 @@ class TestProject { Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{&local_context, full_hello_world.GetRepoConfig(), auth, &retry_config, @@ -420,13 +418,12 @@ static void TestBlobsUploadedAndUsed( Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -469,13 +466,12 @@ static void TestEnvironmentVariablesSetAndUsed( Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -518,13 +514,12 @@ static void TestTreesUsed( Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -567,13 +562,12 @@ static void TestNestedTreesUsed( Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; GraphTraverser gt{clargs.gtargs, p.GetRepoConfig(), remote_config->platform_properties, @@ -615,13 +609,12 @@ static void TestFlakyHelloWorldDetected( Statistics stats{}; Progress progress{}; RetryConfig retry_config{}; // default retry config - ApiBundle const apis{&storage_config, - &storage, - &local_exec_config, - p.GetRepoConfig(), - auth, - &retry_config, - remote_config}; + // pack the local context instances to be passed to ApiBundle + LocalContext const local_context{.exec_config = &local_exec_config, + .storage_config = &storage_config, + .storage = &storage}; + ApiBundle const apis{ + &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config}; { auto clargs = p.CmdLineArgs("_entry_points_ctimes"); |