diff options
author | 2016-05-25 12:25:53 +0000 | |
---|---|---|
committer | 2016-05-25 13:38:21 +0000 | |
commit | 76f0ec687b0f53755ff21551cab6490e72f487bd (patch) | |
tree | 223913e3c1ec31db4eaa6dc88f1177c0fdcbee82 /src/test/java/com/google/devtools/build/lib | |
parent | 36a265772e6e901d4c689634141850814179479c (diff) |
Enable interleaved loading & analysis by default.
Fix a bunch of tests to assume interleaving instead of disrete phases.
In our testing, this improves loading+analysis times by ~30%.
--
MOS_MIGRATED_REVID=123203752
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java index ba4ba4e678..6bb032534f 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java @@ -1136,6 +1136,84 @@ public class BuildViewTest extends BuildViewTestBase { } } + @Test + public void testNonTopLevelErrorsPrintedExactlyOnce() throws Exception { + scratch.file("parent/BUILD", + "sh_library(name = 'a', deps = ['//child:b'])"); + scratch.file("child/BUILD", + "sh_library(name = 'b')", + "undefined_symbol"); + reporter.removeHandler(failFastHandler); + try { + update("//parent:a"); + fail(); + } catch (LoadingFailedException | ViewCreationFailedException expected) { + } + assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); + assertContainsEventWithFrequency( + "Target '//child:b' contains an error and its package is in error and referenced " + + "by '//parent:a'", 1); + } + + @Test + public void testNonTopLevelErrorsPrintedExactlyOnce_KeepGoing() throws Exception { + scratch.file("parent/BUILD", + "sh_library(name = 'a', deps = ['//child:b'])"); + scratch.file("child/BUILD", + "sh_library(name = 'b')", + "undefined_symbol"); + reporter.removeHandler(failFastHandler); + update(defaultFlags().with(Flag.KEEP_GOING), "//parent:a"); + assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); + assertContainsEventWithFrequency( + "Target '//child:b' contains an error and its package is in error and referenced " + + "by '//parent:a'", 1); + } + + @Test + public void testNonTopLevelErrorsPrintedExactlyOnce_ActionListener() throws Exception { + scratch.file("parent/BUILD", + "sh_library(name = 'a', deps = ['//child:b'])"); + scratch.file("child/BUILD", + "sh_library(name = 'b')", + "undefined_symbol"); + scratch.file("okay/BUILD", + "sh_binary(name = 'okay', srcs = ['okay.sh'])"); + useConfiguration("--experimental_action_listener=//parent:a"); + reporter.removeHandler(failFastHandler); + try { + update("//okay"); + fail(); + } catch (LoadingFailedException | ViewCreationFailedException e) { + } + assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); + assertContainsEventWithFrequency( + "Target '//child:b' contains an error and its package is in error and referenced " + + "by '//parent:a'", 1); + } + + @Test + public void testNonTopLevelErrorsPrintedExactlyOnce_ActionListener_KeepGoing() throws Exception { + scratch.file("parent/BUILD", + "sh_library(name = 'a', deps = ['//child:b'])"); + scratch.file("child/BUILD", + "sh_library(name = 'b')", + "undefined_symbol"); + scratch.file("okay/BUILD", + "sh_binary(name = 'okay', srcs = ['okay.sh'])"); + useConfiguration("--experimental_action_listener=//parent:a"); + reporter.removeHandler(failFastHandler); + try { + update(defaultFlags().with(Flag.KEEP_GOING), "//okay"); + } catch (LoadingFailedException ignored) { + // In the legacy case, we get a loading exception even with keep going. Why? + } + assertContainsEventWithFrequency("name 'undefined_symbol' is not defined", 1); + assertContainsEventWithFrequency( + "Target '//child:b' contains an error and its package is in error and referenced " + + "by '//parent:a'", 1); + } + /** Runs the same test with the reduced loading phase. */ @TestSpec(size = Suite.SMALL_TESTS) @RunWith(JUnit4.class) |