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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 return SingleTestRunner(device, self.test_suite, | 268 return SingleTestRunner(device, self.test_suite, |
269 test_filter, self.test_arguments, self.timeout, | 269 test_filter, self.test_arguments, self.timeout, |
270 self.rebaseline, self.performance_test, | 270 self.rebaseline, self.performance_test, |
271 self.cleanup_test_files, self.tool, index, | 271 self.cleanup_test_files, self.tool, index, |
272 not not self.log_dump_name, self.fast_and_loose, | 272 not not self.log_dump_name, self.fast_and_loose, |
273 self.build_type) | 273 self.build_type) |
274 | 274 |
275 def OnTestsCompleted(self, test_runners, test_results): | 275 def OnTestsCompleted(self, test_runners, test_results): |
276 """Notifies that we completed the tests.""" | 276 """Notifies that we completed the tests.""" |
277 test_results.LogFull('Unit test', os.path.basename(self.test_suite), | 277 test_results.LogFull('Unit test', os.path.basename(self.test_suite), |
278 self.build_type) | 278 self.build_type, self.tests) |
279 test_results.PrintAnnotation() | 279 test_results.PrintAnnotation() |
280 if test_results.failed and self.rebaseline: | 280 if test_results.failed and self.rebaseline: |
281 test_runners[0].UpdateFilter(test_results.failed) | 281 test_runners[0].UpdateFilter(test_results.failed) |
282 if self.log_dump_name: | 282 if self.log_dump_name: |
283 # Zip all debug info outputs into a file named by log_dump_name. | 283 # Zip all debug info outputs into a file named by log_dump_name. |
284 debug_info.GTestDebugInfo.ZipAndCleanResults( | 284 debug_info.GTestDebugInfo.ZipAndCleanResults( |
285 os.path.join(TestSuiteDir(self.build_type), 'debug_info_dumps'), | 285 os.path.join(TestSuiteDir(self.build_type), 'debug_info_dumps'), |
286 self.log_dump_name) | 286 self.log_dump_name) |
287 | 287 |
288 | 288 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 options.timeout, options.rebaseline, | 342 options.timeout, options.rebaseline, |
343 options.performance_test, | 343 options.performance_test, |
344 options.cleanup_test_files, options.tool, | 344 options.cleanup_test_files, options.tool, |
345 options.log_dump, options.fast_and_loose, | 345 options.log_dump, options.fast_and_loose, |
346 options.build_type) | 346 options.build_type) |
347 test_results = sharder.RunShardedTests() | 347 test_results = sharder.RunShardedTests() |
348 | 348 |
349 for buildbot_emulator in buildbot_emulators: | 349 for buildbot_emulator in buildbot_emulators: |
350 buildbot_emulator.Shutdown() | 350 buildbot_emulator.Shutdown() |
351 | 351 |
352 # Another chance if we timed out? At this point It is safe(r) to | |
353 # run fast and loose since we just uploaded all the test data and | |
354 # binary. | |
355 if test_results.timed_out and options.repeat: | |
356 logging.critical('Timed out; repeating in fast_and_loose mode.') | |
357 options.fast_and_loose = True | |
358 options.repeat -= 1 | |
359 logging.critical('Repeats left: ' + str(options.repeat)) | |
360 return _RunATestSuite(options) | |
361 return len(test_results.failed) | 352 return len(test_results.failed) |
362 | 353 |
363 | 354 |
364 def Dispatch(options): | 355 def Dispatch(options): |
365 """Dispatches the tests, sharding if possible. | 356 """Dispatches the tests, sharding if possible. |
366 | 357 |
367 If options.use_emulator is True, all tests will be run in new emulator | 358 If options.use_emulator is True, all tests will be run in new emulator |
368 instance. | 359 instance. |
369 | 360 |
370 Args: | 361 Args: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 # the batch (this happens because the exit status is a sum of all failures | 459 # the batch (this happens because the exit status is a sum of all failures |
469 # from all suites, but the buildbot associates the exit status only with the | 460 # from all suites, but the buildbot associates the exit status only with the |
470 # most recent step). | 461 # most recent step). |
471 if options.exit_code: | 462 if options.exit_code: |
472 return failed_tests_count | 463 return failed_tests_count |
473 return 0 | 464 return 0 |
474 | 465 |
475 | 466 |
476 if __name__ == '__main__': | 467 if __name__ == '__main__': |
477 sys.exit(main(sys.argv)) | 468 sys.exit(main(sys.argv)) |
OLD | NEW |