Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[test-runner] Pass slowest test durations to buildbot.
Browse files Browse the repository at this point in the history
TBR=jkummerow@chromium.org
NOTRY=true

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

Cr-Commit-Position: refs/branch-heads/4.3@{#5}
Cr-Branched-From: f5c0a23-refs/heads/4.3.61@{#1}
Cr-Branched-From: 0a7d4f4-refs/heads/master@{#27508}
  • Loading branch information
mi-ac authored and Commit bot committed Apr 9, 2015
1 parent 102b18a commit 948c4a2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/testrunner/local/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def __init__(self, progress_indicator, json_test_results, arch, mode):
self.arch = arch
self.mode = mode
self.results = []
self.tests = []

def Starting(self):
self.progress_indicator.runner = self.runner
Expand All @@ -304,10 +305,24 @@ def Done(self):
# Buildbot might start out with an empty file.
complete_results = json.loads(f.read() or "[]")

# 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))
slowest_tests = [
{
"name": test.GetLabel(),
"flags": test.flags,
"command": EscapeCommand(self.runner.GetCommand(test)).replace(
ABS_PATH_PREFIX, ""),
"duration": test.duration,
} for test in timed_tests[:20]
]

complete_results.append({
"arch": self.arch,
"mode": self.mode,
"results": self.results,
"slowest_tests": slowest_tests,
})

with open(self.json_test_results, "w") as f:
Expand All @@ -318,6 +333,8 @@ def AboutToRun(self, test):

def HasRun(self, test, has_unexpected_output):
self.progress_indicator.HasRun(test, has_unexpected_output)
# Buffer all tests for sorting the durations in the end.
self.tests.append(test)
if not has_unexpected_output:
# Omit tests that run as expected. Passing tests of reruns after failures
# will have unexpected_output to be reported here has well.
Expand All @@ -334,6 +351,7 @@ def HasRun(self, test, has_unexpected_output):
"exit_code": test.output.exit_code,
"result": test.suite.GetOutcome(test),
"expected": list(test.outcomes or ["PASS"]),
"duration": test.duration,
})


Expand Down

0 comments on commit 948c4a2

Please sign in to comment.