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 json | 9 import json |
10 import multiprocessing | 10 import multiprocessing |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 RunCmd(['sleep', '1']) | 380 RunCmd(['sleep', '1']) |
381 | 381 |
382 if options.reboot: | 382 if options.reboot: |
383 RebootDevices() | 383 RebootDevices() |
384 provision_cmd = ['build/android/provision_devices.py', '-t', options.target] | 384 provision_cmd = ['build/android/provision_devices.py', '-t', options.target] |
385 if options.auto_reconnect: | 385 if options.auto_reconnect: |
386 provision_cmd.append('--auto-reconnect') | 386 provision_cmd.append('--auto-reconnect') |
387 RunCmd(provision_cmd) | 387 RunCmd(provision_cmd) |
388 | 388 |
389 | 389 |
390 def DeviceStatusCheck(_): | 390 def DeviceStatusCheck(options): |
391 bb_annotations.PrintNamedStep('device_status_check') | 391 bb_annotations.PrintNamedStep('device_status_check') |
392 RunCmd(['build/android/buildbot/bb_device_status_check.py'], | 392 cmd = ['build/android/buildbot/bb_device_status_check.py'] |
393 halt_on_failure=True) | 393 if options.restart_usb: |
| 394 cmd.append('--restart-usb') |
| 395 RunCmd(cmd, halt_on_failure=True) |
394 | 396 |
395 | 397 |
396 def GetDeviceSetupStepCmds(): | 398 def GetDeviceSetupStepCmds(): |
397 return [ | 399 return [ |
398 ('provision_devices', ProvisionDevices), | 400 ('provision_devices', ProvisionDevices), |
399 ('device_status_check', DeviceStatusCheck), | 401 ('device_status_check', DeviceStatusCheck), |
400 ] | 402 ] |
401 | 403 |
402 | 404 |
403 def RunUnitTests(options): | 405 def RunUnitTests(options): |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 help=('Run a test suite. Test suites: "%s"' % | 536 help=('Run a test suite. Test suites: "%s"' % |
535 '", "'.join(VALID_TESTS))) | 537 '", "'.join(VALID_TESTS))) |
536 parser.add_option('--asan', action='store_true', help='Run tests with asan.') | 538 parser.add_option('--asan', action='store_true', help='Run tests with asan.') |
537 parser.add_option('--install', metavar='<apk name>', | 539 parser.add_option('--install', metavar='<apk name>', |
538 help='Install an apk by name') | 540 help='Install an apk by name') |
539 parser.add_option('--reboot', action='store_true', | 541 parser.add_option('--reboot', action='store_true', |
540 help='Reboot devices before running tests') | 542 help='Reboot devices before running tests') |
541 parser.add_option('--coverage-bucket', | 543 parser.add_option('--coverage-bucket', |
542 help=('Bucket name to store coverage results. Coverage is ' | 544 help=('Bucket name to store coverage results. Coverage is ' |
543 'only run if this is set.')) | 545 'only run if this is set.')) |
| 546 parser.add_option('--restart-usb', action='store_true', |
| 547 help='Restart usb ports before device status check.') |
544 parser.add_option( | 548 parser.add_option( |
545 '--flakiness-server', | 549 '--flakiness-server', |
546 help=('The flakiness dashboard server to which the results should be ' | 550 help=('The flakiness dashboard server to which the results should be ' |
547 'uploaded.')) | 551 'uploaded.')) |
548 parser.add_option( | 552 parser.add_option( |
549 '--auto-reconnect', action='store_true', | 553 '--auto-reconnect', action='store_true', |
550 help='Push script to device which restarts adbd on disconnections.') | 554 help='Push script to device which restarts adbd on disconnections.') |
551 parser.add_option( | 555 parser.add_option( |
552 '--logcat-dump-output', | 556 '--logcat-dump-output', |
553 help='The logcat dump output will be "tee"-ed into this file') | 557 help='The logcat dump output will be "tee"-ed into this file') |
(...skipping 15 matching lines...) Expand all Loading... |
569 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 573 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
570 if options.coverage_bucket: | 574 if options.coverage_bucket: |
571 setattr(options, 'coverage_dir', | 575 setattr(options, 'coverage_dir', |
572 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) | 576 os.path.join(CHROME_OUT_DIR, options.target, 'coverage')) |
573 | 577 |
574 MainTestWrapper(options) | 578 MainTestWrapper(options) |
575 | 579 |
576 | 580 |
577 if __name__ == '__main__': | 581 if __name__ == '__main__': |
578 sys.exit(main(sys.argv)) | 582 sys.exit(main(sys.argv)) |
OLD | NEW |