Chromium Code Reviews| Index: build/android/pylib/instrumentation/instrumentation_test_instance.py |
| diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py |
| index a87f81aeefbc75e9a0f99d6d049178de0758f52c..c5d21714c2d484a861685b0ad6fe1355357f558d 100644 |
| --- a/build/android/pylib/instrumentation/instrumentation_test_instance.py |
| +++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py |
| @@ -5,6 +5,7 @@ |
| import logging |
| import os |
| import pickle |
| +import re |
| import sys |
| from pylib import cmd_helper |
| @@ -25,6 +26,7 @@ _DEFAULT_ANNOTATIONS = [ |
| 'Smoke', 'SmallTest', 'MediumTest', 'LargeTest', |
| 'EnormousTest', 'IntegrationTest'] |
| _PICKLE_FORMAT_VERSION = 10 |
| +_NATIVE_CRASH_RE = re.compile('native crash', re.IGNORECASE) |
|
jbudorick
2015/01/21 16:18:14
nit: put this before _PICKLE_FORMAT_VERSION
rnephew (Wrong account)
2015/01/21 16:22:33
Done.
|
| # TODO(jbudorick): Make these private class methods of |
| @@ -270,6 +272,10 @@ class InstrumentationTestInstance(test_instance.TestInstance): |
| self._flags.extend([flag for flag in stripped_lines if flag]) |
| @property |
| + def suite(self): |
| + return 'instrumentation' |
| + |
| + @property |
| def apk_under_test(self): |
| return self._apk_under_test |
| @@ -459,6 +465,33 @@ class InstrumentationTestInstance(test_instance.TestInstance): |
| return inflated_tests |
| @staticmethod |
| + def GenerateMultiTestResult(errors, statuses): |
| + INSTR_STATUS_CODE_START = 1 |
| + results = [] |
| + skip_counter = 1 |
| + for status_code, bundle in statuses: |
| + if status_code != INSTR_STATUS_CODE_START: |
| + # TODO(rnephew): Make skipped tests still output test name. This is only |
| + # there to give skipped tests a unique name so they are counted |
| + if 'test_skipped' in bundle: |
| + test_name = str(skip_counter) |
| + skip_counter += 1 |
| + else: |
| + test_name = '%s#%s' % ( |
| + ''.join(bundle.get('class', [''])), |
| + ''.join(bundle.get('test', ['']))) |
| + |
| + results.append( |
| + GenerateTestResult(test_name, [(status_code, bundle)], 0, 0)) |
| + for error in errors: |
| + if _NATIVE_CRASH_RE.search(error): |
| + results.append( |
| + base_test_result.BaseTestResult( |
| + 'Crash detected', base_test_result.ResultType.CRASH)) |
| + |
| + return results |
| + |
| + @staticmethod |
| def ParseAmInstrumentRawOutput(raw_output): |
| return ParseAmInstrumentRawOutput(raw_output) |