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

Side by Side Diff: build/android/pylib/instrumentation/test_jar.py

Issue 1292053006: Revert of [Android] Add --blacklist-file as a command-line option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 """Helper class for instrumenation test jar.""" 5 """Helper class for instrumenation test jar."""
6 # pylint: disable=W0702 6 # pylint: disable=W0702
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import pickle 10 import pickle
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 tests_missing_annotations.append(test_method) 163 tests_missing_annotations.append(test_method)
164 return sorted(tests_missing_annotations) 164 return sorted(tests_missing_annotations)
165 165
166 def _IsTestValidForSdkRange(self, test_name, attached_min_sdk_level): 166 def _IsTestValidForSdkRange(self, test_name, attached_min_sdk_level):
167 required_min_sdk_level = int( 167 required_min_sdk_level = int(
168 self.GetTestAnnotations(test_name).get('MinAndroidSdkLevel', 0)) 168 self.GetTestAnnotations(test_name).get('MinAndroidSdkLevel', 0))
169 return (required_min_sdk_level is None or 169 return (required_min_sdk_level is None or
170 attached_min_sdk_level >= required_min_sdk_level) 170 attached_min_sdk_level >= required_min_sdk_level)
171 171
172 def GetAllMatchingTests(self, annotation_filter_list, 172 def GetAllMatchingTests(self, annotation_filter_list,
173 exclude_annotation_list, test_filter, devices): 173 exclude_annotation_list, test_filter):
174 """Get a list of tests matching any of the annotations and the filter. 174 """Get a list of tests matching any of the annotations and the filter.
175 175
176 Args: 176 Args:
177 annotation_filter_list: List of test annotations. A test must have at 177 annotation_filter_list: List of test annotations. A test must have at
178 least one of these annotations. A test without any annotations is 178 least one of these annotations. A test without any annotations is
179 considered to be SmallTest. 179 considered to be SmallTest.
180 exclude_annotation_list: List of test annotations. A test must not have 180 exclude_annotation_list: List of test annotations. A test must not have
181 any of these annotations. 181 any of these annotations.
182 test_filter: Filter used for partial matching on the test method names. 182 test_filter: Filter used for partial matching on the test method names.
183 devices: The set of devices against which tests will be run.
184 183
185 Returns: 184 Returns:
186 List of all matching tests. 185 List of all matching tests.
187 """ 186 """
188 if annotation_filter_list: 187 if annotation_filter_list:
189 available_tests = self.GetAnnotatedTests(annotation_filter_list) 188 available_tests = self.GetAnnotatedTests(annotation_filter_list)
190 # Include un-annotated tests in SmallTest. 189 # Include un-annotated tests in SmallTest.
191 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0: 190 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0:
192 for test in self._GetTestsMissingAnnotation(): 191 for test in self._GetTestsMissingAnnotation():
193 logging.warning( 192 logging.warning(
(...skipping 18 matching lines...) Expand all
212 # Filters 'class.test' names and populates |tests| with the corresponding 211 # Filters 'class.test' names and populates |tests| with the corresponding
213 # 'package.path.class#test' names. 212 # 'package.path.class#test' names.
214 tests = [ 213 tests = [
215 sanitized_test_names[t] for t in unittest_util.FilterTestNames( 214 sanitized_test_names[t] for t in unittest_util.FilterTestNames(
216 sanitized_test_names.keys(), test_filter.replace('#', '.'))] 215 sanitized_test_names.keys(), test_filter.replace('#', '.'))]
217 else: 216 else:
218 tests = available_tests 217 tests = available_tests
219 218
220 # Filter out any tests with SDK level requirements that don't match the set 219 # Filter out any tests with SDK level requirements that don't match the set
221 # of attached devices. 220 # of attached devices.
222 devices = device_utils.DeviceUtils.parallel(devices) 221 devices = device_utils.DeviceUtils.parallel()
223 min_sdk_version = min(devices.build_version_sdk.pGet(None)) 222 min_sdk_version = min(devices.build_version_sdk.pGet(None))
224 tests = [t for t in tests 223 tests = [t for t in tests
225 if self._IsTestValidForSdkRange(t, min_sdk_version)] 224 if self._IsTestValidForSdkRange(t, min_sdk_version)]
226 225
227 return tests 226 return tests
228 227
229 @staticmethod 228 @staticmethod
230 def IsHostDrivenTest(test): 229 def IsHostDrivenTest(test):
231 return 'pythonDrivenTests' in test 230 return 'pythonDrivenTests' in test
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/setup.py ('k') | build/android/pylib/local/device/local_device_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698