Skip to content

Commit

Permalink
Also add the duration as the test process time.
Browse files Browse the repository at this point in the history
Technically, this code is incorrect, because we're calling into spawn strategy,
which might do any amount of additional waiting (e.g., to acquire local
resources). We should change spawn strategy to return structured information
about the subprocess execution, including the wall time, and use that to set
the test information. But for now, this seems good enough.

Fixes bazelbuild#1748.

Effectively a rollback of the rollback, but with a manual fix.

The problem was that the code was assuming exactly one process time,
which is incorrect in at least the case where the proto comes from a previous
Bazel version, because that didn't set the process time at all. We're now
copying over all the values, which should work in all cases.

--
PiperOrigin-RevId: 144425125
MOS_MIGRATED_REVID=144425125
  • Loading branch information
ulfjack authored and hlopko committed Jan 13, 2017
1 parent 55f69dc commit bb17993
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ private void processFailedTestAttempt(
// Add the test log to the output
dataBuilder.addFailedLogs(testLog.toString());
dataBuilder.addTestTimes(data.getTestTimes(0));
dataBuilder.addAllTestProcessTimes(data.getTestProcessTimesList());
processTestOutput(executor, outErr, new TestResult(action, data, false), testLog);
}

Expand All @@ -195,6 +196,7 @@ private void processLastTestAttempt(int attempt, Builder dataBuilder, TestResult
dataBuilder.setPassedLog(data.getPassedLog());
}
dataBuilder.addTestTimes(data.getTestTimes(0));
dataBuilder.addAllTestProcessTimes(data.getTestProcessTimesList());
dataBuilder.setRunDurationMillis(data.getRunDurationMillis());
if (data.hasTestCase()) {
dataBuilder.setTestCase(data.getTestCase());
Expand Down Expand Up @@ -308,6 +310,7 @@ protected TestResultData executeTest(
} finally {
long duration = executor.getClock().currentTimeMillis() - startTime;
builder.addTestTimes(duration);
builder.addTestProcessTimes(duration);
builder.setRunDurationMillis(duration);
if (streamed != null) {
streamed.close();
Expand Down

0 comments on commit bb17993

Please sign in to comment.