summaryrefslogtreecommitdiff
path: root/test/buildtool/build_engine
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-25 17:02:03 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commitb5a92a60035ea3731a96bbdc8bca18986b558a05 (patch)
tree088d85e95d929b31cf74afb1a922b34c4afa7138 /test/buildtool/build_engine
parentdeba068d8692bf6d265926885de5601d72f5d461 (diff)
downloadjustbuild-b5a92a60035ea3731a96bbdc8bca18986b558a05.tar.gz
Pass RemoteContext to ApiBundle
The CreateRemote method is also updated to receive all remote-related information as arguments, such that it does not have to rely on the ApiBundle internal fields which will eventually be removed.
Diffstat (limited to 'test/buildtool/build_engine')
-rw-r--r--test/buildtool/build_engine/target_map/TARGETS1
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp175
2 files changed, 120 insertions, 56 deletions
diff --git a/test/buildtool/build_engine/target_map/TARGETS b/test/buildtool/build_engine/target_map/TARGETS
index af1a400e..f87cc475 100644
--- a/test/buildtool/build_engine/target_map/TARGETS
+++ b/test/buildtool/build_engine/target_map/TARGETS
@@ -35,6 +35,7 @@
, ["@", "src", "src/buildtool/execution_api/local", "config"]
, ["@", "src", "src/buildtool/execution_api/local", "context"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
+ , ["@", "src", "src/buildtool/execution_api/remote", "context"]
, ["@", "src", "src/buildtool/file_system", "file_root"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
, ["@", "src", "src/buildtool/storage", "config"]
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 4524d1b0..a305a8e8 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -34,6 +34,7 @@
#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/execution_api/remote/context.hpp"
#include "src/buildtool/file_system/file_root.hpp"
#include "src/buildtool/main/analyse_context.hpp"
#include "src/buildtool/multithreading/async_map_consumer.hpp"
@@ -110,18 +111,24 @@ TEST_CASE("simple targets", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
@@ -566,19 +573,27 @@ TEST_CASE("configuration deduplication", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -667,19 +682,27 @@ TEST_CASE("generator functions in string arguments", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -780,19 +803,27 @@ TEST_CASE("built-in rules", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1005,19 +1036,27 @@ TEST_CASE("target reference", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1161,19 +1200,27 @@ TEST_CASE("trees", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1281,19 +1328,27 @@ TEST_CASE("RESULT error reporting", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1460,19 +1515,27 @@ TEST_CASE("wrong arguments", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_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};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,