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

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 still match if test duration not present. 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 75892ee6e9c32bbb235a9dc0b1ab671aa43b2abd..7a133b4ba6a1f2b9f97f3ca7cf41080f26c0f13e 100644
--- a/build/android/pylib/gtest/test_runner.py
+++ b/build/android/pylib/gtest/test_runner.py
@@ -70,8 +70,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 \] ?(.*?)( \((.*) ms\))?\r\r\n')
jbudorick 2014/11/14 01:50:24 Narrow the second capture a little. What do you ex
+ re_ok = re.compile('\[ OK \] ?(.*?)( \((.*) ms\))?\r\r\n')
# Test run statuses.
re_passed = re.compile('\[ PASSED \] ?(.*)\r\n')
@@ -84,6 +84,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
@@ -96,17 +97,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