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

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

Issue 839893004: Refactor test scripts for android to improve performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip checking package on JBMR2 or above Created 5 years, 11 months 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 | « build/android/pylib/gtest/test_package_apk.py ('k') | 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 fa38c4f811cd458e08891a6df1434c6245611810..4bb97379e042fa2527435f6b0b26d8e89862a99f 100644
--- a/build/android/pylib/gtest/test_runner.py
+++ b/build/android/pylib/gtest/test_runner.py
@@ -14,6 +14,18 @@ from pylib.device import device_errors
from pylib.local import local_test_server_spawner
from pylib.perf import perf_control
+# Test case statuses.
+RE_RUN = re.compile('\\[ RUN \\] ?(.*)\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')
+RE_RUNNER_FAIL = re.compile('\\[ RUNNER_FAILED \\] ?(.*)\r\n')
+# Signal handlers are installed before starting tests
+# to output the CRASHED marker when a crash happens.
+RE_CRASH = re.compile('\\[ CRASHED \\](.*)\r\n')
+
def _TestSuiteRequiresMockTestServer(suite_name):
"""Returns True if the test suite requires mock test server."""
@@ -77,45 +89,33 @@ class TestRunner(base_test_runner.BaseTestRunner):
"""
results = base_test_result.TestRunResults()
- # Test case statuses.
- re_run = re.compile('\\[ RUN \\] ?(.*)\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')
- re_runner_fail = re.compile('\\[ RUNNER_FAILED \\] ?(.*)\r\n')
- # Signal handlers are installed before starting tests
- # to output the CRASHED marker when a crash happens.
- re_crash = re.compile('\\[ CRASHED \\](.*)\r\n')
-
log = ''
try:
while True:
full_test_name = None
- found = p.expect([re_run, re_passed, re_runner_fail],
+ found = p.expect([RE_RUN, RE_PASSED, RE_RUNNER_FAIL],
timeout=self._timeout)
- if found == 1: # re_passed
+ if found == 1: # RE_PASSED
break
- elif found == 2: # re_runner_fail
+ elif found == 2: # RE_RUNNER_FAIL
break
- else: # re_run
+ else: # RE_RUN
full_test_name = p.match.group(1).replace('\r', '')
- found = p.expect([re_ok, re_fail, re_crash], timeout=self._timeout)
+ found = p.expect([RE_OK, RE_FAIL, RE_CRASH], timeout=self._timeout)
log = p.before.replace('\r', '')
- if found == 0: # re_ok
+ 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,
duration=duration_ms, log=log))
- elif found == 2: # re_crash
+ 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
+ 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,
« no previous file with comments | « build/android/pylib/gtest/test_package_apk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698