diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-01 17:04:30 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-01 17:34:47 +0200 |
commit | 13b6094a9a9f2da63a46e6506fc024388336136b (patch) | |
tree | 4365c046c5628b1c9acf2b5a156452854b2c0999 /test/buildtool/build_engine/target_map/target_map.test.cpp | |
parent | c6c2580c57b4af6ca300168291fdb48869b7d0a1 (diff) | |
download | justbuild-13b6094a9a9f2da63a46e6506fc024388336136b.tar.gz |
Add a test verifying that upwards outputs are rejected
This is implemented already, however as part of the tree-conflict check.
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 | 50 |
1 files changed, 50 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 ddcecdd0..ae376b14 100644 --- a/test/buildtool/build_engine/target_map/target_map.test.cpp +++ b/test/buildtool/build_engine/target_map/target_map.test.cpp @@ -546,6 +546,56 @@ TEST_CASE("simple targets", "[target_map]") { CHECK(result->Actions()[1]->ToJson()["input"]["in"]["data"]["path"] == "simple_targets/bar.txt"); } + + SECTION("ok outs") { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = + BuildMaps::Base::EntityName{ + "", "simple_targets", "ok outs"}, + .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"); + auto artifacts_desc = result->Artifacts()->ToJson(); + CHECK(artifacts_desc["foo/bar/baz.txt"]["type"] == "ACTION"); + } + + SECTION("bad outs") { + { + error_msg = "NONE"; + error = false; + result = nullptr; + + TaskSystem ts; + target_map.ConsumeAfterKeysReady( + &ts, + {BuildMaps::Target::ConfiguredTarget{ + .target = + BuildMaps::Base::EntityName{ + "", "simple_targets", "bad outs"}, + .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"); + } } TEST_CASE("configuration deduplication", "[target_map]") { |