diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-11 13:19:38 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-06-18 12:05:10 +0200 |
commit | 60a056f0b01515ad70ff99d08dd3d2b7475c6c37 (patch) | |
tree | 4fd4de8710e29582f6843e32c703f5451717d572 /test/buildtool/build_engine/target_map/target_map.test.cpp | |
parent | 26fdbae5f7269c06f95d3d087e657bb192b909d1 (diff) | |
download | justbuild-60a056f0b01515ad70ff99d08dd3d2b7475c6c37.tar.gz |
Pass ServeApi as a field of context to the analysis
...instead of using singleton calls.
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.cpp | 42 |
1 files changed, 34 insertions, 8 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 2893e9d7..ee5aa5fe 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,8 @@ #include "src/buildtool/multithreading/async_map_consumer.hpp" #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/progress_reporting/progress.hpp" +#include "src/buildtool/serve_api/remote/config.hpp" +#include "src/buildtool/serve_api/remote/serve_api.hpp" #include "src/buildtool/storage/storage.hpp" #include "test/utils/hermeticity/local.hpp" @@ -96,9 +98,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "simple targets", "[target_map]") { .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -533,9 +538,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -615,9 +623,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -707,9 +718,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "built-in rules", "[target_map]") { .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -909,9 +923,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "target reference", "[target_map]") { .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -1044,9 +1061,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "trees", "[target_map]") { .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -1145,9 +1165,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); @@ -1303,9 +1326,12 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, "wrong arguments", "[target_map]") { .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, .progress = &exports_progress}; + if (RemoteServeConfig::Instance().RemoteAddress()) { + ctx.serve = &ServeApi::Instance(); + } auto absent_target_variables_map = - BuildMaps::Target::CreateAbsentTargetVariablesMap(0); + BuildMaps::Target::CreateAbsentTargetVariablesMap(&ctx, 0); auto absent_target_map = BuildMaps::Target::CreateAbsentTargetMap( &ctx, &result_map, &absent_target_variables_map, 0); |