Update NinjaBlackBoxTest.testDuplicateNinjaPartsDifferentMappings so that it is resilient to different error messages.
It's not deterministic in which order the conflicting actions are listed.
RELNOTES: None.
@@ -373,7 +373,7 @@ public class NinjaBlackBoxTest extends AbstractBlackBoxTest {
}
@Test
- public void testDisjointUsualNinjaParts() throws Exception {
+ public void testDisjointNinjaParts() throws Exception {
context().write("build_dir/a.txt", "A");
context().write("build_dir/b.txt", "B");
context().write("build_dir/c.txt", "C");
@@ -424,7 +424,7 @@ public class NinjaBlackBoxTest extends AbstractBlackBoxTest {
}
@Test
- public void testDuplicateUsualNinjaParts() throws Exception {
+ public void testDuplicateNinjaParts() throws Exception {
context().write("build_dir/a.txt", "A");
context().write("build_dir/b.txt", "B");
context().write("build_dir/c.txt", "C");
@@ -447,8 +447,7 @@ public class NinjaBlackBoxTest extends AbstractBlackBoxTest {
" main = 'build_dir/build.ninja',",
" output_root_inputs = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'e.txt'])",
// 'a' is present in both ninja_build targets, built by Bazel since file 'a' is produced
- // by
- // equal-without-owner actions.
+ // by equal-without-owner actions.
"ninja_build(name = 'ninja_target1', ninja_graph = 'graph',",
" output_groups= {'main': ['a']})",
"ninja_build(name = 'ninja_target2', ninja_graph = 'graph',",
@@ -464,7 +463,7 @@ public class NinjaBlackBoxTest extends AbstractBlackBoxTest {
}
@Test
- public void testDuplicateUsualNinjaPartsDifferentMappings() throws Exception {
+ public void testDuplicateNinjaPartsDifferentMappings() throws Exception {
context().write("variant1.txt", "variant1");
context().write("variant2.txt", "variant2");
@@ -488,18 +487,17 @@ public class NinjaBlackBoxTest extends AbstractBlackBoxTest {
BuilderRunner bazel = context().bazel().withFlags("--experimental_ninja_actions");
- // Exception to do not tow additional dependencies into current test. (ActionConflictException)
Exception exception = assertThrows(Exception.class, () -> bazel.build("//..."));
assertThat(exception)
.hasMessageThat()
.contains("ERROR: file 'a.txt' is generated by these conflicting actions:");
assertThat(exception)
.hasMessageThat()
- .contains(
- "for a.txt, previous action: action "
- + "'Symlinking deps_mapping entry 'variant1.txt' to 'build_dir/a.txt'', "
+ .containsMatch(
+ "for a\\.txt, previous action: action "
+ + "'Symlinking deps_mapping entry 'variant[12]\\.txt' to 'build_dir/a\\.txt'', "
+ "attempted action: action "
- + "'Symlinking deps_mapping entry 'variant2.txt' to 'build_dir/a.txt''");
+ + "'Symlinking deps_mapping entry 'variant[12]\\.txt' to 'build_dir/a\\.txt''");
}
@Test
