Chromium Code Reviews| Index: build/android/pylib/gtest/gtest_test_instance.py |
| diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py |
| index 173628b46134d6c7fe4b5eab246fea610c8836a6..7411044d69aeb2b551ae163851067a8c00af6bfb 100644 |
| --- a/build/android/pylib/gtest/gtest_test_instance.py |
| +++ b/build/android/pylib/gtest/gtest_test_instance.py |
| @@ -86,10 +86,15 @@ _EXTRA_SHARD_SIZE_LIMIT = ( |
| # TODO(jbudorick): Remove these once we're no longer parsing stdout to generate |
| # results. |
| _RE_TEST_STATUS = re.compile( |
| - r'\[ +((?:RUN)|(?:FAILED)|(?:OK)) +\] ?([^ ]+)(?: \((\d+) ms\))?$') |
| + r'\[ +((?:RUN)|(?:FAILED)|(?:OK)|(?:CRASHED)) +\]' |
| + r' ?([^ ]+)?(?: \((\d+) ms\))?$') |
| _RE_TEST_RUN_STATUS = re.compile( |
| r'\[ +(PASSED|RUNNER_FAILED|CRASHED) \] ?[^ ]+') |
| - |
| +# Crash detection constants. |
| +_RE_TEST_ERROR = re.compile(r'FAILURES!!! Tests run: \d+,' |
| + r' Failures: \d+, Errors: 1') |
| +_RE_TEST_CURRENTLY_RUNNING = re.compile(r'\[ERROR:.*?\]' |
| + r' Currently running: (.*)') |
| # TODO(jbudorick): Make this a class method of GtestTestInstance once |
| # test_package_apk and test_package_exe are gone. |
| @@ -206,6 +211,8 @@ class GtestTestInstance(test_instance.TestInstance): |
| self._test_arguments = args.test_arguments |
| + |
|
jbudorick
2016/03/01 23:19:15
nit: remove these two blank lines
|
| + |
| @property |
| def activity(self): |
| return self._apk_helper and self._apk_helper.GetActivityName() |
| @@ -355,23 +362,34 @@ class GtestTestInstance(test_instance.TestInstance): |
| log = [] |
| result_type = None |
| results = [] |
| + test_name = None |
| for l in output: |
| logging.info(l) |
| matcher = _RE_TEST_STATUS.match(l) |
| if matcher: |
| + # Be aware that test name and status might not appear on same line. |
| + test_name = matcher.group(2) if matcher.group(2) else test_name |
| + duration = int(matcher.group(3)) if matcher.group(3) else 0 |
| if matcher.group(1) == 'RUN': |
| log = [] |
| elif matcher.group(1) == 'OK': |
| result_type = base_test_result.ResultType.PASS |
| elif matcher.group(1) == 'FAILED': |
| result_type = base_test_result.ResultType.FAIL |
| + elif matcher.group(1) == 'CRASHED': |
| + result_type = base_test_result.ResultType.CRASH |
| + |
| + # Needs another matcher here to match crashess, like those of DCHECK. |
|
jbudorick
2016/03/01 23:19:15
nit: s/crashess/crashes/
|
| + matcher = _RE_TEST_CURRENTLY_RUNNING.match(l) |
| + if matcher: |
| + test_name = matcher.group(1) |
| + result_type = base_test_result.ResultType.CRASH |
| + duration = 0 # Don't know. |
| if log is not None: |
| log.append(l) |
| if result_type: |
| - test_name = matcher.group(2) |
| - duration = int(matcher.group(3)) if matcher.group(3) else 0 |
| results.append(base_test_result.BaseTestResult( |
| test_name, result_type, duration, |
| log=('\n'.join(log) if log else ''))) |