Chromium Code Reviews| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 | 313 |
| 314 if options.use_emulator: | 314 if options.use_emulator: |
| 315 for n in range(options.use_emulator): | 315 for n in range(options.use_emulator): |
| 316 t = TimeProfile('Emulator launch %d' % n) | 316 t = TimeProfile('Emulator launch %d' % n) |
| 317 buildbot_emulator = emulator.Emulator(options.fast_and_loose) | 317 buildbot_emulator = emulator.Emulator(options.fast_and_loose) |
| 318 buildbot_emulator.Launch(kill_all_emulators=n == 0) | 318 buildbot_emulator.Launch(kill_all_emulators=n == 0) |
| 319 t.Stop() | 319 t.Stop() |
| 320 buildbot_emulators.append(buildbot_emulator) | 320 buildbot_emulators.append(buildbot_emulator) |
| 321 attached_devices.append(buildbot_emulator.device) | 321 attached_devices.append(buildbot_emulator.device) |
| 322 # Wait for all emulators to become available. | 322 # Wait for all emulators to become available. |
| 323 map(lambda buildbot_emulator:buildbot_emulator.ConfirmLaunch(), | 323 map(lambda buildbot_emulator:buildbot_emulator.ConfirmLaunch(True), |
| 324 buildbot_emulators) | 324 buildbot_emulators) |
| 325 # Emulator booting completely is not enough for the test to start. | |
| 326 # Wait for another 60 seconds so the emulator can settle down. | |
| 327 # Otherwise, the connection to the device may lost during the test, | |
| 328 # which will break the test. | |
| 329 time.sleep(60) | |
|
John Grabowski
2012/07/10 06:14:09
Sadness.
Offhand I don't remember what ConfirmLaun
Wei James(wistoch)
2012/07/10 14:26:48
ConfirmLaunch() is to make sure the emulator launc
| |
| 325 elif options.test_device: | 330 elif options.test_device: |
| 326 attached_devices = [options.test_device] | 331 attached_devices = [options.test_device] |
| 327 else: | 332 else: |
| 328 attached_devices = android_commands.GetAttachedDevices() | 333 attached_devices = android_commands.GetAttachedDevices() |
| 329 | 334 |
| 330 if not attached_devices: | 335 if not attached_devices: |
| 331 logging.critical('A device must be attached and online.') | 336 logging.critical('A device must be attached and online.') |
| 332 if options.annotate: | 337 if options.annotate: |
| 333 print '@@@STEP_FAILURE@@@' | 338 print '@@@STEP_FAILURE@@@' |
| 334 return 1 | 339 return 1 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 # from all suites, but the buildbot associates the exit status only with the | 477 # from all suites, but the buildbot associates the exit status only with the |
| 473 # most recent step). | 478 # most recent step). |
| 474 if options.annotate: | 479 if options.annotate: |
| 475 return 0 | 480 return 0 |
| 476 else: | 481 else: |
| 477 return failed_tests_count | 482 return failed_tests_count |
| 478 | 483 |
| 479 | 484 |
| 480 if __name__ == '__main__': | 485 if __name__ == '__main__': |
| 481 sys.exit(main(sys.argv)) | 486 sys.exit(main(sys.argv)) |
| OLD | NEW |