use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestCommand method exec.
@Override
public ExitCode exec(CommandEnvironment env, OptionsProvider options) {
TestResultAnalyzer resultAnalyzer = new TestResultAnalyzer(env.getDirectories().getExecRoot(), options.getOptions(TestSummaryOptions.class), options.getOptions(ExecutionOptions.class), env.getEventBus());
printer = new AnsiTerminalPrinter(env.getReporter().getOutErr().getOutputStream(), options.getOptions(BlazeCommandEventHandler.Options.class).useColor());
// Initialize test handler.
AggregatingTestListener testListener = new AggregatingTestListener(resultAnalyzer, env.getEventBus(), env.getReporter());
env.getEventBus().register(testListener);
return doTest(env, options, testListener);
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testIncompleteCached.
@Test
public void testIncompleteCached() throws Exception {
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summary = createTestSummary(stubTarget, BlazeTestStatus.INCOMPLETE, CACHED - 1);
TestSummaryPrinter.print(summary, terminalPrinter, true, false);
verify(terminalPrinter).print(not(contains("cached")));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testShouldPrintPassedStatus.
@Test
public void testShouldPrintPassedStatus() throws Exception {
String expectedString = ANY_STRING + "INFO" + ANY_STRING + BlazeTestStatus.PASSED + ANY_STRING;
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summary = createTestSummary(stubTarget, BlazeTestStatus.PASSED, NOT_CACHED);
TestSummaryPrinter.print(summary, terminalPrinter, true, false);
terminalPrinter.print(find(expectedString));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testShouldProperlyTestLabels.
@Test
public void testShouldProperlyTestLabels() throws Exception {
ConfiguredTarget target = target("somepath", "MyTarget");
String expectedString = ANY_STRING + "//somepath:MyTarget" + ANY_STRING;
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summaryStatus = createTestSummary(target, BlazeTestStatus.PASSED, CACHED);
TestSummaryPrinter.print(summaryStatus, terminalPrinter, true, false);
terminalPrinter.print(find(expectedString));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testFileNamesNotShown.
@Test
public void testFileNamesNotShown() throws Exception {
List<TestCase> emptyDetails = ImmutableList.of();
TestSummary summary = basicBuilder.setStatus(BlazeTestStatus.FAILED).addPassedLogs(getPathList("/apple")).addFailedLogs(getPathList("/pear")).addCoverageFiles(getPathList("/maracuja")).addFailedTestCases(emptyDetails, FailedTestCasesStatus.FULL).build();
// Check that only //package:name is printed.
AnsiTerminalPrinter printer = Mockito.mock(AnsiTerminalPrinter.class);
TestSummaryPrinter.print(summary, printer, true, true);
verify(printer).print(contains("//package:name"));
}
Aggregations