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

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

Issue 19537004: [Android] Converts host driven tests to common test_dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharding_refactoring
Patch Set: Converts --official-build into a boolean flag Created 7 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 6
7 import collections 7 import collections
8 import logging 8 import logging
9 import os 9 import os
10 import pickle 10 import pickle
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 def GetTestMethods(self): 162 def GetTestMethods(self):
163 """Returns a list of all test methods in this apk as Class#testMethod.""" 163 """Returns a list of all test methods in this apk as Class#testMethod."""
164 return self._test_methods 164 return self._test_methods
165 165
166 def _GetTestsMissingAnnotation(self): 166 def _GetTestsMissingAnnotation(self):
167 """Get a list of test methods with no known annotations.""" 167 """Get a list of test methods with no known annotations."""
168 tests_missing_annotations = [] 168 tests_missing_annotations = []
169 for test_method in self.GetTestMethods(): 169 for test_method in self.GetTestMethods():
170 annotations_ = frozenset(self.GetTestAnnotations(test_method)) 170 annotations_ = frozenset(self.GetTestAnnotations(test_method))
171 if (annotations_.isdisjoint(self._ANNOTATIONS) and 171 if (annotations_.isdisjoint(self._ANNOTATIONS) and
172 not self.IsPythonDrivenTest(test_method)): 172 not self.IsHostDrivenTest(test_method)):
173 tests_missing_annotations.append(test_method) 173 tests_missing_annotations.append(test_method)
174 return sorted(tests_missing_annotations) 174 return sorted(tests_missing_annotations)
175 175
176 def _GetAllMatchingTests(self, annotation_filter_list, 176 def _GetAllMatchingTests(self, annotation_filter_list,
177 exclude_annotation_list, test_filter): 177 exclude_annotation_list, test_filter):
178 """Get a list of tests matching any of the annotations and the filter. 178 """Get a list of tests matching any of the annotations and the filter.
179 179
180 Args: 180 Args:
181 annotation_filter_list: List of test annotations. A test must have at 181 annotation_filter_list: List of test annotations. A test must have at
182 least one of these annotations. A test without any annotations is 182 least one of these annotations. A test without any annotations is
(...skipping 12 matching lines...) Expand all
195 for test in self._GetTestsMissingAnnotation(): 195 for test in self._GetTestsMissingAnnotation():
196 logging.warning( 196 logging.warning(
197 '%s has no annotations. Assuming "%s".', test, 197 '%s has no annotations. Assuming "%s".', test,
198 self._DEFAULT_ANNOTATION) 198 self._DEFAULT_ANNOTATION)
199 available_tests.append(test) 199 available_tests.append(test)
200 if exclude_annotation_list: 200 if exclude_annotation_list:
201 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list) 201 excluded_tests = self.GetAnnotatedTests(exclude_annotation_list)
202 available_tests = list(set(available_tests) - set(excluded_tests)) 202 available_tests = list(set(available_tests) - set(excluded_tests))
203 else: 203 else:
204 available_tests = [m for m in self.GetTestMethods() 204 available_tests = [m for m in self.GetTestMethods()
205 if not self.IsPythonDrivenTest(m)] 205 if not self.IsHostDrivenTest(m)]
206 206
207 tests = [] 207 tests = []
208 if test_filter: 208 if test_filter:
209 # |available_tests| are in adb instrument format: package.path.class#test. 209 # |available_tests| are in adb instrument format: package.path.class#test.
210 filter_without_hash = test_filter.replace('#', '.') 210 filter_without_hash = test_filter.replace('#', '.')
211 tests = [t for t in available_tests 211 tests = [t for t in available_tests
212 if filter_without_hash in t.replace('#', '.')] 212 if filter_without_hash in t.replace('#', '.')]
213 else: 213 else:
214 tests = available_tests 214 tests = available_tests
215 215
216 return tests 216 return tests
217 217
218 @staticmethod 218 @staticmethod
219 def IsPythonDrivenTest(test): 219 def IsHostDrivenTest(test):
220 return 'pythonDrivenTests' in test 220 return 'pythonDrivenTests' in test
OLDNEW
« no previous file with comments | « build/android/pylib/host_driven/tests_annotations.py ('k') | build/android/pylib/utils/run_tests_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698