OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import collections | 6 import collections |
7 import glob | 7 import glob |
8 import hashlib | 8 import hashlib |
9 import multiprocessing | 9 import multiprocessing |
10 import os | 10 import os |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 RunCmd(['sleep', '1']) | 302 RunCmd(['sleep', '1']) |
303 | 303 |
304 if options.reboot: | 304 if options.reboot: |
305 RebootDevices() | 305 RebootDevices() |
306 provision_cmd = ['build/android/provision_devices.py', '-t', options.target] | 306 provision_cmd = ['build/android/provision_devices.py', '-t', options.target] |
307 if options.auto_reconnect: | 307 if options.auto_reconnect: |
308 provision_cmd.append('--auto-reconnect') | 308 provision_cmd.append('--auto-reconnect') |
309 RunCmd(provision_cmd) | 309 RunCmd(provision_cmd) |
310 | 310 |
311 | 311 |
312 def DeviceStatusCheck(_): | 312 def DeviceStatusCheck(options): |
313 bb_annotations.PrintNamedStep('device_status_check') | 313 bb_annotations.PrintNamedStep('device_status_check') |
314 RunCmd(['build/android/buildbot/bb_device_status_check.py'], | 314 cmd = ['build/android/buildbot/bb_device_status_check.py'] |
315 halt_on_failure=True) | 315 if options.restart_usb: |
| 316 cmd.append('--restart-usb') |
| 317 RunCmd(cmd, halt_on_failure=True) |
316 | 318 |
317 | 319 |
318 def GetDeviceSetupStepCmds(): | 320 def GetDeviceSetupStepCmds(): |
319 return [ | 321 return [ |
320 ('provision_devices', ProvisionDevices), | 322 ('provision_devices', ProvisionDevices), |
321 ('device_status_check', DeviceStatusCheck), | 323 ('device_status_check', DeviceStatusCheck), |
322 ] | 324 ] |
323 | 325 |
324 | 326 |
325 def RunUnitTests(options): | 327 def RunUnitTests(options): |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 help=('Run a test suite. Test suites: "%s"' % | 458 help=('Run a test suite. Test suites: "%s"' % |
457 '", "'.join(VALID_TESTS))) | 459 '", "'.join(VALID_TESTS))) |
458 parser.add_option('--asan', action='store_true', help='Run tests with asan.') | 460 parser.add_option('--asan', action='store_true', help='Run tests with asan.') |
459 parser.add_option('--install', metavar='<apk name>', | 461 parser.add_option('--install', metavar='<apk name>', |
460 help='Install an apk by name') | 462 help='Install an apk by name') |
461 parser.add_option('--reboot', action='store_true', | 463 parser.add_option('--reboot', action='store_true', |
462 help='Reboot devices before running tests') | 464 help='Reboot devices before running tests') |
463 parser.add_option('--coverage-bucket', | 465 parser.add_option('--coverage-bucket', |
464 help=('Bucket name to store coverage results. Coverage is ' | 466 help=('Bucket name to store coverage results. Coverage is ' |
465 'only run if this is set.')) | 467 'only run if this is set.')) |
| 468 parser.add_option('--restart-usb', action='store_true', |
| 469 help='Restart usb ports before device status check.') |
466 parser.add_option( | 470 parser.add_option( |
467 '--flakiness-server', | 471 '--flakiness-server', |
468 help='The flakiness dashboard server to which the results should be ' | 472 help='The flakiness dashboard server to which the results should be ' |
469 'uploaded.') | 473 'uploaded.') |
470 parser.add_option( | 474 parser.add_option( |
471 '--auto-reconnect', action='store_true', | 475 '--auto-reconnect', action='store_true', |
472 help='Push script to device which restarts adbd on disconnections.') | 476 help='Push script to device which restarts adbd on disconnections.') |
473 parser.add_option( | 477 parser.add_option( |
474 '--logcat-dump-output', | 478 '--logcat-dump-output', |
475 help='The logcat dump output will be "tee"-ed into this file') | 479 help='The logcat dump output will be "tee"-ed into this file') |
(...skipping 15 matching lines...) Expand all Loading... |
491 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 495 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
492 if options.coverage_bucket: | 496 if options.coverage_bucket: |
493 setattr(options, 'coverage_dir', | 497 setattr(options, 'coverage_dir', |
494 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 498 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
495 | 499 |
496 MainTestWrapper(options) | 500 MainTestWrapper(options) |
497 | 501 |
498 | 502 |
499 if __name__ == '__main__': | 503 if __name__ == '__main__': |
500 sys.exit(main(sys.argv)) | 504 sys.exit(main(sys.argv)) |
OLD | NEW |