Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: build/android/pylib/gtest/test_runner.py

Issue 719753005: Add duration to gtest test results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made regex more specific. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/gtest/test_runner.py
diff --git a/build/android/pylib/gtest/test_runner.py b/build/android/pylib/gtest/test_runner.py
index 56e7449c55fd07dd69a9a72ad3835f06292d06fd..66feea64bcea8d20f82f4fe9354e5e63cf2eee97 100644
--- a/build/android/pylib/gtest/test_runner.py
+++ b/build/android/pylib/gtest/test_runner.py
@@ -79,8 +79,8 @@ class TestRunner(base_test_runner.BaseTestRunner):
# Test case statuses.
re_run = re.compile('\[ RUN \] ?(.*)\r\n')
- re_fail = re.compile('\[ FAILED \] ?(.*)\r\n')
- re_ok = re.compile('\[ OK \] ?(.*?) .*\r\n')
+ re_fail = re.compile('\[ FAILED \] ?(.*?)( \((\d+) ms\))?\r\r\n')
+ re_ok = re.compile('\[ OK \] ?(.*?)( \((\d+) ms\))?\r\r\n')
# Test run statuses.
re_passed = re.compile('\[ PASSED \] ?(.*)\r\n')
@@ -93,6 +93,7 @@ class TestRunner(base_test_runner.BaseTestRunner):
try:
while True:
full_test_name = None
+
found = p.expect([re_run, re_passed, re_runner_fail],
timeout=self._timeout)
if found == 1: # re_passed
@@ -105,17 +106,20 @@ class TestRunner(base_test_runner.BaseTestRunner):
log = p.before.replace('\r', '')
if found == 0: # re_ok
if full_test_name == p.match.group(1).replace('\r', ''):
+ duration_ms = int(p.match.group(3)) if p.match.group(3) else 0
results.AddResult(base_test_result.BaseTestResult(
full_test_name, base_test_result.ResultType.PASS,
- log=log))
+ duration=duration_ms, log=log))
elif found == 2: # re_crash
results.AddResult(base_test_result.BaseTestResult(
full_test_name, base_test_result.ResultType.CRASH,
log=log))
break
else: # re_fail
+ duration_ms = int(p.match.group(3)) if p.match.group(3) else 0
results.AddResult(base_test_result.BaseTestResult(
- full_test_name, base_test_result.ResultType.FAIL, log=log))
+ full_test_name, base_test_result.ResultType.FAIL,
+ duration=duration_ms, log=log))
except pexpect.EOF:
logging.error('Test terminated - EOF')
# We're here because either the device went offline, or the test harness
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698