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

Side by Side Diff: build/android/run_tests.py

Issue 11573038: Partial revert of crrev.com/172937. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all the native unit tests. 7 """Runs all the native unit tests.
8 8
9 1. Copy over test binary to /data/local on device. 9 1. Copy over test binary to /data/local on device.
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 self.timeout = timeout 196 self.timeout = timeout
197 self.performance_test = performance_test 197 self.performance_test = performance_test
198 self.cleanup_test_files = cleanup_test_files 198 self.cleanup_test_files = cleanup_test_files
199 self.tool = tool 199 self.tool = tool
200 self.log_dump_name = log_dump_name 200 self.log_dump_name = log_dump_name
201 self.fast_and_loose = fast_and_loose 201 self.fast_and_loose = fast_and_loose
202 self.in_webkit_checkout = in_webkit_checkout 202 self.in_webkit_checkout = in_webkit_checkout
203 self.all_tests = [] 203 self.all_tests = []
204 if not self.gtest_filter: 204 if not self.gtest_filter:
205 # No filter has been specified, let's add all tests then. 205 # No filter has been specified, let's add all tests then.
206 self.all_tests = self._GetAllEnabledTests() 206 self.all_tests, self.attached_devices = self._GetAllEnabledTests()
207 self.tests = self.all_tests 207 self.tests = self.all_tests
208 208
209 def _GetAllEnabledTests(self): 209 def _GetAllEnabledTests(self):
210 """Returns a list of all enabled tests. 210 """Get all enabled tests and available devices.
211 211
212 Obtains a list of enabled tests from the test package on the device, 212 Obtains a list of enabled tests from the test package on the device,
213 then filters it again using the diabled list on the host. 213 then filters it again using the diabled list on the host.
214 214
215 Returns:
216 Tuple of (all enabled tests, available devices).
217
215 Raises Exception if all devices failed. 218 Raises Exception if all devices failed.
216 """ 219 """
220 # TODO(frankf): This method is doing too much in a non-systematic way.
221 # If the intention is to drop flaky devices, why not go through all devices
222 # instead of breaking on the first succesfull run?
217 available_devices = list(self.attached_devices) 223 available_devices = list(self.attached_devices)
218 while available_devices: 224 while available_devices:
219 try: 225 try:
220 return self._GetTestsFromDevice(available_devices[-1]) 226 return (self._GetTestsFromDevice(available_devices[-1]),
227 available_devices)
221 except Exception as e: 228 except Exception as e:
222 logging.warning('Failed obtaining tests from %s %s', 229 logging.warning('Failed obtaining tests from %s %s',
223 available_devices[-1], e) 230 available_devices[-1], e)
224 available_devices.pop() 231 available_devices.pop()
225 232
226 raise Exception('No device available to get the list of tests.') 233 raise Exception('No device available to get the list of tests.')
227 234
228 def _GetTestsFromDevice(self, device): 235 def _GetTestsFromDevice(self, device):
229 logging.info('Obtaining tests from %s', device) 236 logging.info('Obtaining tests from %s', device)
230 test_runner = SingleTestRunner( 237 test_runner = SingleTestRunner(
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 # the batch (this happens because the exit status is a sum of all failures 490 # the batch (this happens because the exit status is a sum of all failures
484 # from all suites, but the buildbot associates the exit status only with the 491 # from all suites, but the buildbot associates the exit status only with the
485 # most recent step). 492 # most recent step).
486 if options.exit_code: 493 if options.exit_code:
487 return failed_tests_count 494 return failed_tests_count
488 return 0 495 return 0
489 496
490 497
491 if __name__ == '__main__': 498 if __name__ == '__main__':
492 sys.exit(main(sys.argv)) 499 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698