Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import pickle | 9 import pickle |
| 10 import re | 10 import re |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TestListFile') | 41 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TestListFile') |
| 42 _EXTRA_DRIVER_TARGET_PACKAGE = ( | 42 _EXTRA_DRIVER_TARGET_PACKAGE = ( |
| 43 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetPackage') | 43 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetPackage') |
| 44 _EXTRA_DRIVER_TARGET_CLASS = ( | 44 _EXTRA_DRIVER_TARGET_CLASS = ( |
| 45 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetClass') | 45 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TargetClass') |
| 46 _EXTRA_TIMEOUT_SCALE = ( | 46 _EXTRA_TIMEOUT_SCALE = ( |
| 47 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TimeoutScale') | 47 'org.chromium.test.driver.OnDeviceInstrumentationDriver.TimeoutScale') |
| 48 | 48 |
| 49 _PARAMETERIZED_TEST_ANNOTATION = 'ParameterizedTest' | 49 _PARAMETERIZED_TEST_ANNOTATION = 'ParameterizedTest' |
| 50 _PARAMETERIZED_TEST_SET_ANNOTATION = 'ParameterizedTest$Set' | 50 _PARAMETERIZED_TEST_SET_ANNOTATION = 'ParameterizedTest$Set' |
| 51 _NATIVE_CRASH_RE = re.compile('native crash', re.IGNORECASE) | 51 _CRASH_RE = re.compile('(process|native) crash', re.IGNORECASE) |
|
jbudorick
2016/08/04 01:23:53
er, nit: this should still be _NATIVE_CRASH_RE, as
BigBossZhiling
2016/08/04 22:30:34
Done.
| |
| 52 _PICKLE_FORMAT_VERSION = 10 | 52 _PICKLE_FORMAT_VERSION = 10 |
| 53 | 53 |
| 54 | 54 |
| 55 class MissingSizeAnnotationError(Exception): | 55 class MissingSizeAnnotationError(Exception): |
| 56 def __init__(self, class_name): | 56 def __init__(self, class_name): |
| 57 super(MissingSizeAnnotationError, self).__init__(class_name + | 57 super(MissingSizeAnnotationError, self).__init__(class_name + |
| 58 ': Test method is missing required size annotation. Add one of: ' + | 58 ': Test method is missing required size annotation. Add one of: ' + |
| 59 ', '.join('@' + a for a in _VALID_ANNOTATIONS)) | 59 ', '.join('@' + a for a in _VALID_ANNOTATIONS)) |
| 60 | 60 |
| 61 | 61 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 instrumentation_parser.STATUS_CODE_FAILURE): | 135 instrumentation_parser.STATUS_CODE_FAILURE): |
| 136 logging.error('Unrecognized status code %d. Handling as an error.', | 136 logging.error('Unrecognized status code %d. Handling as an error.', |
| 137 status_code) | 137 status_code) |
| 138 current_result.SetType(base_test_result.ResultType.FAIL) | 138 current_result.SetType(base_test_result.ResultType.FAIL) |
| 139 if 'stack' in bundle: | 139 if 'stack' in bundle: |
| 140 current_result.SetLog(bundle['stack']) | 140 current_result.SetLog(bundle['stack']) |
| 141 | 141 |
| 142 if current_result: | 142 if current_result: |
| 143 if current_result.GetType() == base_test_result.ResultType.UNKNOWN: | 143 if current_result.GetType() == base_test_result.ResultType.UNKNOWN: |
| 144 crashed = (result_code == _ACTIVITY_RESULT_CANCELED | 144 crashed = (result_code == _ACTIVITY_RESULT_CANCELED |
| 145 and any(_NATIVE_CRASH_RE.search(l) | 145 and any(_CRASH_RE.search(l) |
| 146 for l in result_bundle.itervalues())) | 146 for l in result_bundle.itervalues())) |
| 147 if crashed: | 147 if crashed: |
| 148 current_result.SetType(base_test_result.ResultType.CRASH) | 148 current_result.SetType(base_test_result.ResultType.CRASH) |
| 149 | 149 |
| 150 results.append(current_result) | 150 results.append(current_result) |
| 151 | 151 |
| 152 return results | 152 return results |
| 153 | 153 |
| 154 | 154 |
| 155 def ParseCommandLineFlagParameters(annotations): | 155 def ParseCommandLineFlagParameters(annotations): |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 @staticmethod | 678 @staticmethod |
| 679 def GenerateTestResults( | 679 def GenerateTestResults( |
| 680 result_code, result_bundle, statuses, start_ms, duration_ms): | 680 result_code, result_bundle, statuses, start_ms, duration_ms): |
| 681 return GenerateTestResults(result_code, result_bundle, statuses, | 681 return GenerateTestResults(result_code, result_bundle, statuses, |
| 682 start_ms, duration_ms) | 682 start_ms, duration_ms) |
| 683 | 683 |
| 684 #override | 684 #override |
| 685 def TearDown(self): | 685 def TearDown(self): |
| 686 if self._isolate_delegate: | 686 if self._isolate_delegate: |
| 687 self._isolate_delegate.Clear() | 687 self._isolate_delegate.Clear() |
| OLD | NEW |