Commit 9025b5ac authored by machenbach's avatar machenbach Committed by Commit bot

[test] Report more test duration data.

This will allow the infrastructure to warn about new very
slow tests which are not marked as slow. If not marked, they
might be scheduled late in the test run and prolong the
overall running time uselessly.

BUG=chromium:601468
LOG=n

Review URL: https://codereview.chromium.org/1863793005

Cr-Commit-Position: refs/heads/master@{#35356}
parent 05047108
......@@ -34,6 +34,7 @@ import time
from . import execution
from . import junit_output
from . import statusfile
ABS_PATH_PREFIX = os.getcwd() + os.sep
......@@ -329,6 +330,12 @@ class JsonTestProgressIndicator(ProgressIndicator):
# Buildbot might start out with an empty file.
complete_results = json.loads(f.read() or "[]")
duration_mean = None
if self.tests:
# Get duration mean.
duration_mean = (
sum(t.duration for t in self.tests) / float(len(self.tests)))
# Sort tests by duration.
timed_tests = [t for t in self.tests if t.duration is not None]
timed_tests.sort(lambda a, b: cmp(b.duration, a.duration))
......@@ -338,6 +345,7 @@ class JsonTestProgressIndicator(ProgressIndicator):
"flags": test.flags,
"command": self._EscapeCommand(test).replace(ABS_PATH_PREFIX, ""),
"duration": test.duration,
"marked_slow": statusfile.IsSlow(test.outcomes),
} for test in timed_tests[:20]
]
......@@ -346,6 +354,8 @@ class JsonTestProgressIndicator(ProgressIndicator):
"mode": self.mode,
"results": self.results,
"slowest_tests": slowest_tests,
"duration_mean": duration_mean,
"test_total": len(self.tests),
})
with open(self.json_test_results, "w") as f:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment