diff options
author | Googler <noreply@google.com> | 2017-10-30 22:07:39 -0400 |
---|---|---|
committer | John Cater <jcater@google.com> | 2017-10-31 10:40:06 -0400 |
commit | ae49b6520a64188587d233c8f21bcb81edbf1294 (patch) | |
tree | fbdb4f1e826d2b0b64120f0909c86834e2c4a93f /src/test/java/com/google/devtools/build/lib/pkgcache | |
parent | 92da09069aa1490c627315424b539e44621949a2 (diff) |
Add test asserting test_suite exclusion behavior
test_suite expansion occurs after the target patterns are all processed. Otherwise, excluding a package can exclude tests from entirely different packages, which is counter-intuitive.
This behavior was intentionally removed in unknown commit in 2012 and then inadvertently reintroduced in unknown commit in 2015. But I think the current behavior is more intuitive (and as of https://github.com/bazelbuild/bazel/commit/0dffc49f528c4c6e641221060e41aa6896310bdf is documented).
RELNOTES: None.
PiperOrigin-RevId: 173984189
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/pkgcache')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorTest.java index 7f7376c5f3..bf8a2cb23f 100644 --- a/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/lib/pkgcache/TargetPatternEvaluatorTest.java @@ -805,6 +805,19 @@ public class TargetPatternEvaluatorTest extends AbstractTargetPatternEvaluatorTe .containsExactlyElementsIn(allTestRules); } + @Test + public void testTestSuiteExclusion() throws Exception { + // This step doesn't do test_suite expansion of the individual target patterns. Doing so + // would cause an exclusion of the targets in a package to exclude all tests referred to in test + // suites in that package. + scratch.file( + "parent/excluded/BUILD", + "test_suite(name = 'test_suite', tests = ['//parent/other:specific_test'])"); + scratch.file("parent/other/BUILD", "cc_test(name = 'specific_test')"); + assertThat(parseList("parent/...", "-parent/excluded/...")).containsExactlyElementsIn( + labels("//parent/other:specific_test")); + } + /** Regression test for bug: "blaze test "no targets found" warning now fatal" */ @Test public void testNoTestsInRecursivePattern() throws Exception { |