diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-22 15:22:22 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-23 11:44:04 +0200 |
commit | 2fb942fbc8ece593a312718476c638df69ef0149 (patch) | |
tree | 92a2142138dc92024cf49a61f4a5fec239842b8b /test/buildtool/build_engine/target_map/target_map.test.cpp | |
parent | 74a5fbc9644eda7f105d2d2c672a41fa5c34c6a8 (diff) | |
download | justbuild-2fb942fbc8ece593a312718476c638df69ef0149.tar.gz |
Add a test verifying that out_dirs are normalized
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 | 62 |
1 files changed, 62 insertions, 0 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 061ce387..15964a7f 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -596,6 +596,68 @@ TEST_CASE("simple targets", "[target_map]") { CHECK(error); CHECK(error_msg != "NONE"); } + + SECTION("non-normal outs and out_dirs") { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = BuildMaps::Base::EntityName{"", + "simple_targets", + "non-normal outs and " + "out_dirs"}, + .config = empty_config}}, + [&result](auto values) { result = *values[0]; }, + [&error, &error_msg](std::string const& msg, bool /*unused*/) { + error = true; + error_msg = msg; + }); + } + CHECK(not error); + CHECK(error_msg == "NONE"); + REQUIRE(result->Actions().size() == 1); + auto action = result->Actions()[0]->ToJson(); + CHECK(action["output_dirs"] == R"(["install"])"_json); + CHECK(action["output"] == R"(["log"])"_json); + } + + SECTION("generic non-normal outs and out_dirs") { + { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = + BuildMaps::Base::EntityName{"", + "simple_targets", + "generic non-normal " + "outs and out_dirs"}, + .config = empty_config}}, + [&result](auto values) { result = *values[0]; }, + [&error, &error_msg](std::string const& msg, + bool /*unused*/) { + error = true; + error_msg = msg; + }); + } + CHECK(not error); + CHECK(error_msg == "NONE"); + REQUIRE(result->Actions().size() == 1); + auto action = result->Actions()[0]->ToJson(); + CHECK(action["output_dirs"] == R"(["install"])"_json); + CHECK(action["output"] == R"(["log"])"_json); + } + } } TEST_CASE("configuration deduplication", "[target_map]") { |