From 7b03d63b7ecc6e75ecf8a4a0ff6b0dd16a16c8b3 Mon Sep 17 00:00:00 2001 From: Ulf Adams Date: Thu, 11 Feb 2016 16:52:28 +0000 Subject: Rewrite the test to work with Bazel - avoid bash_version. Instead, we simply introduce an error after the rule - that means the package is in error, but the target still exists. I checked that this covers the same code path that I wanted to cover in the original change. Fixed #879. -- MOS_MIGRATED_REVID=114443076 --- .../build/lib/pkgcache/LoadingPhaseRunnerTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java index 65c10cb007..1c1c2ad8a5 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java @@ -527,20 +527,22 @@ public class LoadingPhaseRunnerTest { @Test public void testTopLevelTargetErrorsPrintedExactlyOnce_NoKeepGoing() throws Exception { - // 42 is not a valid bash_version, and this is detected during package loading. - tester.addFile("bad/BUILD", "sh_binary(name = 'bad', srcs = ['bad.sh'], bash_version = '42')"); + tester.addFile("bad/BUILD", + "sh_binary(name = 'bad', srcs = ['bad.sh'])", + "undefined_symbol"); try { tester.load("//bad"); fail(); } catch (TargetParsingException expected) { } - tester.assertContainsEventWithFrequency("invalid value in 'bash_version' attribute", 1); + tester.assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); } @Test public void testTopLevelTargetErrorsPrintedExactlyOnce_KeepGoing() throws Exception { - // 42 is not a valid bash_version, and this is detected during package loading. - tester.addFile("bad/BUILD", "sh_binary(name = 'bad', srcs = ['bad.sh'], bash_version = '42')"); + tester.addFile("bad/BUILD", + "sh_binary(name = 'bad', srcs = ['bad.sh'])", + "undefined_symbol"); LoadingResult loadingResult = tester.loadKeepGoing("//bad"); if (runsLoadingPhase()) { // The legacy loading phase runner reports a loading error, but no target pattern error in @@ -553,7 +555,7 @@ public class LoadingPhaseRunnerTest { } else { assertThat(loadingResult.hasTargetPatternError()).isTrue(); } - tester.assertContainsEventWithFrequency("invalid value in 'bash_version' attribute", 1); + tester.assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); } @Test -- cgit v1.2.3