diff options
author | 2016-02-11 16:52:28 +0000 | |
---|---|---|
committer | 2016-02-11 22:23:01 +0000 | |
commit | 7b03d63b7ecc6e75ecf8a4a0ff6b0dd16a16c8b3 (patch) | |
tree | f6faba53c77f9be94769e308e32a0d8b41902fae /src/test | |
parent | 5c1a40543c38c7c900e16912efe14bcf6fb7d513 (diff) |
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
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java | 14 |
1 files 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 |