use of com.google.devtools.build.lib.exec.TestStrategy.TestOutputFormat in project bazel by bazelbuild.
the class TestCommand method editOptions.
@Override
public void editOptions(CommandEnvironment env, OptionsParser optionsParser) throws AbruptExitException {
TestOutputFormat testOutput = optionsParser.getOptions(ExecutionOptions.class).testOutput;
try {
if (testOutput == TestStrategy.TestOutputFormat.STREAMED) {
env.getReporter().handle(Event.warn("Streamed test output requested. All tests will be run locally, without sharding, " + "one at a time"));
optionsParser.parse(OptionPriority.SOFTWARE_REQUIREMENT, "streamed output requires locally run tests, without sharding", ImmutableList.of("--test_sharding_strategy=disabled", "--test_strategy=exclusive"));
}
} catch (OptionsParsingException e) {
throw new IllegalStateException("Known options failed to parse", e);
}
}
use of com.google.devtools.build.lib.exec.TestStrategy.TestOutputFormat in project bazel by bazelbuild.
the class TerminalTestResultNotifier method notify.
/**
* Prints a test summary information for all tests to the terminal.
*
* @param summaries Summary of all targets that were ran
* @param numberOfExecutedTargets the number of targets that were actually ran
*/
@Override
public void notify(Set<TestSummary> summaries, int numberOfExecutedTargets) {
TestResultStats stats = new TestResultStats();
stats.numberOfTargets = summaries.size();
stats.numberOfExecutedTargets = numberOfExecutedTargets;
TestOutputFormat testOutput = options.getOptions(ExecutionOptions.class).testOutput;
for (TestSummary summary : summaries) {
if (summary.isLocalActionCached() && TestLogHelper.shouldOutputTestLog(testOutput, TestResult.isBlazeTestStatusPassed(summary.getStatus()))) {
TestSummaryPrinter.printCachedOutput(summary, testOutput, printer);
}
}
for (TestSummary summary : summaries) {
if (TestResult.isBlazeTestStatusPassed(summary.getStatus())) {
stats.passCount++;
} else if (summary.getStatus() == BlazeTestStatus.NO_STATUS) {
stats.noStatusCount++;
} else if (summary.getStatus() == BlazeTestStatus.FAILED_TO_BUILD) {
stats.failedToBuildCount++;
} else if (summary.ranRemotely()) {
stats.failedRemotelyCount++;
} else {
stats.failedLocallyCount++;
}
if (summary.wasUnreportedWrongSize()) {
stats.wasUnreportedWrongSize = true;
}
}
stats.failedCount = summaries.size() - stats.passCount;
TestSummaryFormat testSummaryFormat = options.getOptions(ExecutionOptions.class).testSummary;
switch(testSummaryFormat) {
case DETAILED:
printDetailedTestResultSummary(summaries);
break;
case SHORT:
printShortSummary(summaries, /*printSuccess=*/
true);
break;
case TERSE:
printShortSummary(summaries, /*printSuccess=*/
false);
break;
case NONE:
break;
}
printStats(stats);
}
Aggregations