OLD | NEW |
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Raises Exception if all devices failed. | 215 Raises Exception if all devices failed. |
216 """ | 216 """ |
217 available_devices = list(self.attached_devices) | 217 available_devices = list(self.attached_devices) |
218 while available_devices: | 218 while available_devices: |
219 try: | 219 try: |
220 return self._GetTestsFromDevice(available_devices[-1]) | 220 return self._GetTestsFromDevice(available_devices[-1]) |
221 except Exception as e: | 221 except Exception as e: |
222 logging.warning('Failed obtaining tests from %s %s', | 222 logging.warning('Failed obtaining tests from %s %s', |
223 current_device, e) | 223 available_devices[-1], e) |
224 available_devices.pop() | 224 available_devices.pop() |
225 | 225 |
226 raise Exception('No device available to get the list of tests.') | 226 raise Exception('No device available to get the list of tests.') |
227 | 227 |
228 def _GetTestsFromDevice(self, device): | 228 def _GetTestsFromDevice(self, device): |
229 logging.info('Obtaining tests from %s', device) | 229 logging.info('Obtaining tests from %s', device) |
230 test_runner = SingleTestRunner( | 230 test_runner = SingleTestRunner( |
231 device, | 231 device, |
232 self.test_suite, | 232 self.test_suite, |
233 self.gtest_filter, | 233 self.gtest_filter, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 # the batch (this happens because the exit status is a sum of all failures | 483 # 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 | 484 # from all suites, but the buildbot associates the exit status only with the |
485 # most recent step). | 485 # most recent step). |
486 if options.exit_code: | 486 if options.exit_code: |
487 return failed_tests_count | 487 return failed_tests_count |
488 return 0 | 488 return 0 |
489 | 489 |
490 | 490 |
491 if __name__ == '__main__': | 491 if __name__ == '__main__': |
492 sys.exit(main(sys.argv)) | 492 sys.exit(main(sys.argv)) |
OLD | NEW |