diff options
author | Greg Estren <gregce@google.com> | 2016-06-17 00:02:06 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2016-06-17 09:27:09 +0000 |
commit | 2f5ca7706f3d9a8a7e32e8bb2f689cf763374836 (patch) | |
tree | 438f202cb51d5ee2f6f080c9a2794a8704ce6aea /src/test/java/com/google | |
parent | 9f7a9d7c7cb51202055b1b85b95793880185a6ff (diff) |
Adds cycle detection errors when top-level dynamic
configuration creation fails because transitive fragment
visitation hits these cycles.
This makes CircularDependencyTest pass with dynamic
configurations.
It's a little bit unfortunate that BuildViewTestCase
follows a different code path to create configured targets
than production (BuildView.getConfiguredTargetForTesting
vs. BuildView.update). As a result, doing an actual build over
the rules defined in CircularDependencyTest#testTwoCycles
correctly reports the cycle, while the test itself doesn't.
That means the test isn't 100% faithfully testing production
logic.
But I'm not interested in fixing the gap between
BuildView.update and BuildView.getConfiguredTargetForTesting
in this change. That's part of a larger refactoring effort
on the various forked ways of acccessing configured targets
and dependencies in BuildView.
--
MOS_MIGRATED_REVID=125118553
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java | 10 |
1 files changed, 9 insertions, 1 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 51ba85f8e8..525c55b5fe 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 @@ -478,7 +478,15 @@ public class BuildViewTest extends BuildViewTestBase { assertContainsEvent("and referenced by '//foo:bad'"); assertContainsEvent("in sh_library rule //foo"); assertContainsEvent("cycle in dependency graph"); - assertEventCount(3, eventCollector); + // Dynamic configurations trigger this error both in configuration trimming (which visits + // the transitive target closure) and in the normal configured target cycle detection path. + // So we get an additional instance of this check (which varies depending on whether Skyframe + // loading phase is enabled). + // TODO(gregce): refactor away this variation. Note that the duplicate doesn't make it into + // real user output (it only affects tests). + if (!getTargetConfiguration().useDynamicConfigurations()) { + assertEventCount(3, eventCollector); + } } @Test |