Source:
<code>private StandaloneFailedAttemptResult processTestAttempt( int attemptId, boolean isLastAttempt, ActionExecutionContext actionExecutionContext, TestRunnerAction action, StandaloneTestResult result) throws IOException { ImmutableList<Pair<String, Path>> testOutputs = action.getTestOutputsMapping( actionExecutionContext.getPathResolver(), actionExecutionContext.getExecRoot()); if (!isLastAttempt) { testOutputs = renameOutputs(actionExecutionContext, action, testOutputs, attemptId); } TestResultData.Builder dataBuilder = result.testResultDataBuilder(); BlazeTestStatus status = BlazeTestStatus.INCOMPLETE; Path renamedTestLog = null; for (Pair<String, Path> pair : testOutputs) { if (TestFileNameConstants.TEST_LOG.equals(pair.getFirst())) { Preconditions.checkState(renamedTestLog == null, "multiple test_log matches"); renamedTestLog = pair.getSecond(); status = dataBuilder.getStatus(); } } <START> if (status == BlazeTestStatus.PASSED) { <END> dataBuilder.setPassedLog(renamedTestLog.toString()); } else if (status == BlazeTestStatus.INCOMPLETE) { Preconditions.checkState(renamedTestLog == null); dataBuilder.setStatus(status); } else { dataBuilder.addFailedLogs(renamedTestLog.toString()); } TestResultData data = dataBuilder.build(); actionExecutionContext .getEventHandler() .post( TestAttempt.forExecutedTestResult( action, data, attemptId, testOutputs, result.executionInfo(), isLastAttempt)); processTestOutput(actionExecutionContext, data, action.getTestName(), renamedTestLog); return new StandaloneFailedAttemptResult(data); }</code><technical_language>I do this slightly differently. I nicer check explicitly for renamedTestLog == null case, override status in dataBuilder. However, this happen in place - code realize action cancelled</technical_language>

Target:
private StandaloneFailedAttemptResult processTestAttempt( int attemptId, boolean isLastAttempt, ActionExecutionContext actionExecutionContext, TestRunnerAction action, StandaloneTestResult result) throws IOException { ImmutableList<Pair<String, Path>> testOutputs = action.getTestOutputsMapping( actionExecutionContext.getPathResolver(), actionExecutionContext.getExecRoot()); if (!isLastAttempt) { testOutputs = renameOutputs(actionExecutionContext, action, testOutputs, attemptId); } Path renamedTestLog = null; for (Pair<String, Path> pair : testOutputs) { if (TestFileNameConstants.TEST_LOG.equals(pair.getFirst())) { Preconditions.checkState(renamedTestLog == null, "multiple test_log matches"); renamedTestLog = pair.getSecond(); } } TestResultData.Builder dataBuilder = result.testResultDataBuilder(); if (renamedTestLog == null) { dataBuilder.setStatus(BlazeTestStatus.INCOMPLETE); } if (dataBuilder.getStatus() == BlazeTestStatus.PASSED) { dataBuilder.setPassedLog(renamedTestLog.toString()); } else if (dataBuilder.getStatus() == BlazeTestStatus.INCOMPLETE) { Preconditions.checkState(renamedTestLog == null); } else { dataBuilder.addFailedLogs(renamedTestLog.toString()); } TestResultData data = dataBuilder.build(); actionExecutionContext .getEventHandler() .post( TestAttempt.forExecutedTestResult( action, data, attemptId, testOutputs, result.executionInfo(), isLastAttempt)); processTestOutput(actionExecutionContext, data, action.getTestName(), renamedTestLog); return new StandaloneFailedAttemptResult(data); }