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

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: Rename a parameter 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
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..db69aea60d2689a75983ec8f773711142e90a379 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.
+g_re_run = re.compile('\\[ RUN \\] ?(.*)\r\n')
jbudorick 2015/01/16 14:21:41 Constants should be ALL_CAPS, not g_with_underscor
Jaekyun Seok (inactive) 2015/01/18 23:01:18 Done.
+g_re_fail = re.compile('\\[ FAILED \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n')
+g_re_ok = re.compile('\\[ OK \\] ?(.*?)( \\((\\d+) ms\\))?\r\r\n')
+
+# Test run statuses.
+g_re_passed = re.compile('\\[ PASSED \\] ?(.*)\r\n')
+g_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.
+g_re_crash = re.compile('\\[ CRASHED \\](.*)\r\n')
+
def _TestSuiteRequiresMockTestServer(suite_name):
"""Returns True if the test suite requires mock test server."""
@@ -77,45 +89,34 @@ 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([g_re_run, g_re_passed, g_re_runner_fail],
timeout=self._timeout)
- if found == 1: # re_passed
+ if found == 1: # g_re_passed
break
- elif found == 2: # re_runner_fail
+ elif found == 2: # g_re_runner_fail
break
- else: # re_run
+ else: # g_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([g_re_ok, g_re_fail, g_re_crash],
+ timeout=self._timeout)
log = p.before.replace('\r', '')
- if found == 0: # re_ok
+ if found == 0: # g_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: # g_re_crash
results.AddResult(base_test_result.BaseTestResult(
full_test_name, base_test_result.ResultType.CRASH,
log=log))
break
- else: # re_fail
+ else: # g_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,

Powered by Google App Engine
This is Rietveld 408576698