summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-29 11:13:08 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commitb393090c220da61dd1c197adfac42dc47ad74f8a (patch)
tree72fb8ea9e5a9a4f9c01017c0601720b98909e3a8 /test
parent6089297787902f9a38a678e2ffdf639e779a1594 (diff)
downloadjustbuild-b393090c220da61dd1c197adfac42dc47ad74f8a.tar.gz
ApiBundle: Use a creator method instead of constructor
This will allow for ApiBundle to be used together with the TestApi implementation of IExecutionApi in tests. Also rename CreateRemote method to MakeRemote in order to remove any semantical confusion.
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp48
-rw-r--r--test/buildtool/graph_traverser/graph_traverser.test.hpp28
2 files changed, 42 insertions, 34 deletions
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 ed859e31..ddcecdd0 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -126,9 +126,9 @@ TEST_CASE("simple targets", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
AnalyseContext ctx{.repo_config = &repo_config,
@@ -589,9 +589,9 @@ TEST_CASE("configuration deduplication", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -699,9 +699,9 @@ TEST_CASE("generator functions in string arguments", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -821,9 +821,9 @@ TEST_CASE("built-in rules", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -1055,9 +1055,9 @@ TEST_CASE("target reference", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -1220,9 +1220,9 @@ TEST_CASE("trees", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -1349,9 +1349,9 @@ TEST_CASE("RESULT error reporting", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
@@ -1537,9 +1537,9 @@ TEST_CASE("wrong arguments", "[target_map]") {
.retry_config = &retry_config,
.exec_config = &remote_exec_config};
- ApiBundle const apis{&local_context,
- &remote_context,
- /*repo_config=*/nullptr};
+ auto const apis = ApiBundle::Create(&local_context,
+ &remote_context,
+ /*repo_config=*/nullptr);
auto serve =
ServeApi::Create(*serve_config, &local_context, &remote_context, &apis);
diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp
index 314d7bd6..6618e5bf 100644
--- a/test/buildtool/graph_traverser/graph_traverser.test.hpp
+++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp
@@ -186,7 +186,8 @@ class TestProject {
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -264,7 +265,8 @@ class TestProject {
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -312,7 +314,8 @@ class TestProject {
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -379,8 +382,8 @@ class TestProject {
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{
- &local_context, &remote_context, full_hello_world.GetRepoConfig()};
+ auto const apis = ApiBundle::Create(
+ &local_context, &remote_context, full_hello_world.GetRepoConfig());
GraphTraverser const gt_upload{clargs_update_cpp.gtargs,
full_hello_world.GetRepoConfig(),
@@ -453,7 +456,8 @@ static void TestBlobsUploadedAndUsed(
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -509,7 +513,8 @@ static void TestEnvironmentVariablesSetAndUsed(
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -565,7 +570,8 @@ static void TestTreesUsed(
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -621,7 +627,8 @@ static void TestNestedTreesUsed(
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
@@ -676,7 +683,8 @@ static void TestFlakyHelloWorldDetected(
.retry_config = &retry_config,
.exec_config = remote_config};
- ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+ auto const apis =
+ ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
{
auto clargs = p.CmdLineArgs("_entry_points_ctimes");