use of com.google.devtools.build.lib.cmdline.TargetParsingException in project bazel by bazelbuild.
the class TestTargetUtilsTest method testExpandTestSuitesInterrupted.
@Test
public void testExpandTestSuitesInterrupted() throws Exception {
reporter.removeHandler(failFastHandler);
scratch.file("broken/BUILD", "test_suite(name = 'broken', tests = ['//missing:missing_test'])");
try {
TestTargetUtils.expandTestSuites(new TargetProvider() {
@Override
public Target getTarget(ExtendedEventHandler eventHandler, Label label) throws InterruptedException {
throw new InterruptedException();
}
}, reporter, Sets.newHashSet(getTarget("//broken")), /*strict=*/
false, /*keep_going=*/
true);
} catch (TargetParsingException e) {
assertNotNull(e.getMessage());
}
assertTrue(Thread.currentThread().isInterrupted());
}
use of com.google.devtools.build.lib.cmdline.TargetParsingException in project bazel by bazelbuild.
the class TargetPatternEvaluatorTest method testAddedFilesAndDotDotDot.
@Test
public void testAddedFilesAndDotDotDot() throws Exception {
invalidate(ModifiedFileSet.EVERYTHING_MODIFIED);
reporter.removeHandler(failFastHandler);
scratch.dir("h");
try {
parseList("//h/...");
fail("TargetParsingException expected");
} catch (TargetParsingException e) {
// expected
}
scratch.file("h/i/j/k/BUILD", "sh_library(name='l')");
ModifiedFileSet modifiedFileSet = ModifiedFileSet.builder().modify(new PathFragment("h")).modify(new PathFragment("h/i")).modify(new PathFragment("h/i/j")).modify(new PathFragment("h/i/j/k")).modify(new PathFragment("h/i/j/k/BUILD")).build();
invalidate(modifiedFileSet);
reporter.addHandler(failFastHandler);
Set<Label> nonEmptyResult = parseList("//h/...");
assertThat(nonEmptyResult).containsExactly(Label.parseAbsolute("//h/i/j/k:l"));
}
Aggregations