diff options
author | 2016-03-30 17:53:16 +0000 | |
---|---|---|
committer | 2016-03-31 07:09:52 +0000 | |
commit | b08f485b0b46fb8451a3a3e22faf7295725bd6be (patch) | |
tree | d7e205b2c3a7112a47663808fac85996f349f1ef /src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java | |
parent | 2224b3e4b7e29489c766487afdbdfa96e8c1c0ef (diff) |
Simplify CompileOneDependencyTransformer. This is the first step of improving
it more with respect to the new parse_headers feature, ideas I have about
configurable attributes etc.
I am trying to keep functional changes to a minimum. Functional changes
that couldn't really be easily avoided:
- Find correct rule for headers through filegroups
- Find correct target to build even if sources are missing. A proper error is
reported in the subsequent loading phase
Also remove SrcTargetUtil as it is no longer used.
--
MOS_MIGRATED_REVID=118589517
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/pkgcache/LoadingPhaseRunnerTest.java | 28 |
1 files changed, 8 insertions, 20 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 952561ee85..2626e6a8ac 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 @@ -559,9 +559,12 @@ public class LoadingPhaseRunnerTest { "cc_library(name = 'hello', srcs = ['hello.cc', '//bad:bad.cc'])"); tester.useLoadingOptions("--compile_one_dependency"); try { - tester.load("base/hello.cc"); - fail(); - } catch (TargetParsingException expected) { + LoadingResult loadingResult = tester.load("base/hello.cc"); + if (runsLoadingPhase()) { + fail(); + } + assertThat(loadingResult.hasLoadingError()).isFalse(); + } catch (LoadingFailedException expected) { tester.assertContainsError("no such package 'bad'"); } } @@ -571,23 +574,8 @@ public class LoadingPhaseRunnerTest { tester.addFile("base/BUILD", "cc_library(name = 'hello', srcs = ['hello.cc', '//bad:bad.cc'])"); tester.useLoadingOptions("--compile_one_dependency"); - if (runsLoadingPhase()) { - // The LegacyLoadingPhaseRunner throws an exception if it can't load any of the sources in the - // same rule as the source we're looking for even with --keep_going. - // In general, we probably want --compile_one_dependency to be compatible with --keep_going - // for consistency, but it's unclear if this is actually a problem for anyone. The most common - // use case for compile_one_dependency is to iterate quickly on a single file, without - // --keep_going. - try { - tester.load("base/hello.cc"); - fail(); - } catch (TargetParsingException expected) { - tester.assertContainsError("no such package 'bad'"); - } - } else { - LoadingResult loadingResult = tester.loadKeepGoing("base/hello.cc"); - assertThat(loadingResult.hasTargetPatternError()).isTrue(); - } + LoadingResult loadingResult = tester.loadKeepGoing("base/hello.cc"); + assertEquals(loadingResult.hasLoadingError(), runsLoadingPhase()); } private void assertCircularSymlinksDuringTargetParsing(String targetPattern) throws Exception { |