From c3e6a6f527f590dcbb6411f4e778b10bd5a9d74e Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 23 Aug 2024 14:51:51 +0200 Subject: Add test verifying that conflicts in the artifacts stage are recognized --- .../build_engine/target_map/target_map.test.cpp | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'test/buildtool/build_engine/target_map/target_map.test.cpp') 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 15964a7f..85d3b104 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -658,6 +658,58 @@ TEST_CASE("simple targets", "[target_map]") { CHECK(action["output"] == R"(["log"])"_json); } } + + SECTION("staging conflict: rule") { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = + BuildMaps::Base::EntityName{ + "", "simple_targets", "stage conflict: rule"}, + .config = empty_config}}, + [&result](auto values) { result = *values[0]; }, + [&error, &error_msg](std::string const& msg, bool /*unused*/) { + error = true; + error_msg = msg; + }); + } + CHECK(error); + CHECK(error_msg != "NONE"); + CHECK(error_msg.find("artifacts") != std::string::npos); + CHECK(error_msg.find("install") != std::string::npos); + } + + SECTION("staging conflict: generic") { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = + BuildMaps::Base::EntityName{ + "", "simple_targets", "stage conflict: generic"}, + .config = empty_config}}, + [&result](auto values) { result = *values[0]; }, + [&error, &error_msg](std::string const& msg, bool /*unused*/) { + error = true; + error_msg = msg; + }); + } + CHECK(error); + CHECK(error_msg != "NONE"); + CHECK(error_msg.find("artifacts") != std::string::npos); + CHECK(error_msg.find("install") != std::string::npos); + } } TEST_CASE("configuration deduplication", "[target_map]") { -- cgit v1.2.3