summaryrefslogtreecommitdiff
path: root/test/buildtool/build_engine/target_map/target_map.test.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-06-13 10:16:29 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-06-18 12:05:10 +0200
commitdc9a7b8499da9ce7a90546afecd048d0bfb31f38 (patch)
treeefc036d485bb8418ffbf77957be2d5f2252a9306 /test/buildtool/build_engine/target_map/target_map.test.cpp
parentd08e6f1af5a96818c9e7c2c9e0a6288470489822 (diff)
downloadjustbuild-dc9a7b8499da9ce7a90546afecd048d0bfb31f38.tar.gz
Make ServeApi a general class, not a singleton
...and adjust interfaces.
Diffstat (limited to 'test/buildtool/build_engine/target_map/target_map.test.cpp')
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp56
1 files changed, 24 insertions, 32 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 ee5aa5fe..b7b1e1e3 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -94,13 +94,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "simple targets", "[target_map]") {
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -534,13 +533,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -619,13 +617,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -714,13 +711,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "built-in rules", "[target_map]") {
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -919,13 +915,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "target reference", "[target_map]") {
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -1057,13 +1052,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "trees", "[target_map]") {
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -1161,13 +1155,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture,
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);
@@ -1322,13 +1315,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "wrong arguments", "[target_map]") {
Statistics stats{};
Progress exports_progress{};
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
AnalyseContext ctx{.repo_config = &repo_config,
.target_cache = Storage::Instance().TargetCache(),
.statistics = &stats,
- .progress = &exports_progress};
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- ctx.serve = &ServeApi::Instance();
- }
+ .progress = &exports_progress,
+ .serve = serve};
auto absent_target_variables_map =
BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0);