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

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

Issue 668793002: Make test_runner allow exclude_annotations along with test filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added myself to AUTHORS list Created 6 years, 2 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 """ 261 """
262 if annotation_filter_list: 262 if annotation_filter_list:
263 available_tests = self.GetAnnotatedTests(annotation_filter_list) 263 available_tests = self.GetAnnotatedTests(annotation_filter_list)
264 # Include un-annotated tests in SmallTest. 264 # Include un-annotated tests in SmallTest.
265 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0: 265 if annotation_filter_list.count(self._DEFAULT_ANNOTATION) > 0:
266 for test in self._GetTestsMissingAnnotation(): 266 for test in self._GetTestsMissingAnnotation():
267 logging.warning( 267 logging.warning(
268 '%s has no annotations. Assuming "%s".', test, 268 '%s has no annotations. Assuming "%s".', test,
269 self._DEFAULT_ANNOTATION) 269 self._DEFAULT_ANNOTATION)
270 available_tests.append(test) 270 available_tests.append(test)
271 if exclude_annotation_list:
272 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list)
273 available_tests = list(set(available_tests) - set(excluded_tests))
274 else: 271 else:
275 available_tests = [m for m in self.GetTestMethods() 272 available_tests = [m for m in self.GetTestMethods()
276 if not self.IsHostDrivenTest(m)] 273 if not self.IsHostDrivenTest(m)]
277 274
275 if exclude_annotation_list:
276 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list)
277 available_tests = list(set(available_tests) - set(excluded_tests))
278
278 tests = [] 279 tests = []
279 if test_filter: 280 if test_filter:
280 # |available_tests| are in adb instrument format: package.path.class#test. 281 # |available_tests| are in adb instrument format: package.path.class#test.
281 282
282 # Maps a 'class.test' name to each 'package.path.class#test' name. 283 # Maps a 'class.test' name to each 'package.path.class#test' name.
283 sanitized_test_names = dict([ 284 sanitized_test_names = dict([
284 (t.split('.')[-1].replace('#', '.'), t) for t in available_tests]) 285 (t.split('.')[-1].replace('#', '.'), t) for t in available_tests])
285 # Filters 'class.test' names and populates |tests| with the corresponding 286 # Filters 'class.test' names and populates |tests| with the corresponding
286 # 'package.path.class#test' names. 287 # 'package.path.class#test' names.
287 tests = [ 288 tests = [
(...skipping 10 matching lines...) Expand all
298 'ro.build.version.sdk').pGet(None)] 299 'ro.build.version.sdk').pGet(None)]
299 tests = filter( 300 tests = filter(
300 lambda t: self._IsTestValidForSdkRange(t, min(sdk_versions)), 301 lambda t: self._IsTestValidForSdkRange(t, min(sdk_versions)),
301 tests) 302 tests)
302 303
303 return tests 304 return tests
304 305
305 @staticmethod 306 @staticmethod
306 def IsHostDrivenTest(test): 307 def IsHostDrivenTest(test):
307 return 'pythonDrivenTests' in test 308 return 'pythonDrivenTests' in test
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698