summaryrefslogtreecommitdiff
path: root/test/buildtool/build_engine/target_map/target_map.test.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-23 14:51:51 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-23 16:32:00 +0200
commitc3e6a6f527f590dcbb6411f4e778b10bd5a9d74e (patch)
tree4f99e73c346c7a443cb8bb716546e357172248da /test/buildtool/build_engine/target_map/target_map.test.cpp
parentc5ea015b57344063000015e7f1e18bf5f14337f3 (diff)
downloadjustbuild-c3e6a6f527f590dcbb6411f4e778b10bd5a9d74e.tar.gz
Add test verifying that conflicts in the artifacts stage are recognized
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.cpp52
1 files changed, 52 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 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]") {