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 json | 8 import json |
9 import multiprocessing | 9 import multiprocessing |
10 import optparse | 10 import optparse |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 # Wait for logcat_monitor to pull existing logcat | 264 # Wait for logcat_monitor to pull existing logcat |
265 RunCmd(['sleep', '5']) | 265 RunCmd(['sleep', '5']) |
266 | 266 |
267 if options.reboot: | 267 if options.reboot: |
268 RebootDevices() | 268 RebootDevices() |
269 | 269 |
270 # Device check and alert emails | 270 # Device check and alert emails |
271 buildbot_report.PrintNamedStep('device_status_check') | 271 buildbot_report.PrintNamedStep('device_status_check') |
272 RunCmd(['build/android/device_status_check.py']) | 272 RunCmd(['build/android/device_status_check.py']) |
273 | 273 |
| 274 # Provision devices |
| 275 if options.auto_reconnect: |
| 276 buildbot_report.PrintNamedStep('provision_devices') |
| 277 target = options.factory_properties.get('target', 'Debug') |
| 278 RunCmd(['build/android/provision_devices.py', '-t', target]) |
| 279 |
274 if options.install: | 280 if options.install: |
275 test_obj = INSTRUMENTATION_TESTS[options.install] | 281 test_obj = INSTRUMENTATION_TESTS[options.install] |
276 InstallApk(options, test_obj, print_step=True) | 282 InstallApk(options, test_obj, print_step=True) |
277 | 283 |
278 if 'chromedriver' in options.test_filter: | 284 if 'chromedriver' in options.test_filter: |
279 RunChromeDriverTests() | 285 RunChromeDriverTests() |
280 if 'unit' in options.test_filter: | 286 if 'unit' in options.test_filter: |
281 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES) | 287 RunTestSuites(options, gtest_config.STABLE_TEST_SUITES) |
282 if 'ui' in options.test_filter: | 288 if 'ui' in options.test_filter: |
283 for test in INSTRUMENTATION_TESTS.itervalues(): | 289 for test in INSTRUMENTATION_TESTS.itervalues(): |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 action='append', | 333 action='append', |
328 help=('Run a test suite. Test suites: "%s"' % | 334 help=('Run a test suite. Test suites: "%s"' % |
329 '", "'.join(VALID_TESTS))) | 335 '", "'.join(VALID_TESTS))) |
330 parser.add_option('--asan', action='store_true', help='Run tests with asan.') | 336 parser.add_option('--asan', action='store_true', help='Run tests with asan.') |
331 parser.add_option('--install', metavar='<apk name>', | 337 parser.add_option('--install', metavar='<apk name>', |
332 help='Install an apk by name') | 338 help='Install an apk by name') |
333 parser.add_option('--reboot', action='store_true', | 339 parser.add_option('--reboot', action='store_true', |
334 help='Reboot devices before running tests') | 340 help='Reboot devices before running tests') |
335 parser.add_option('--upload-to-flakiness-server', action='store_true', | 341 parser.add_option('--upload-to-flakiness-server', action='store_true', |
336 help='Upload the results to the flakiness dashboard.') | 342 help='Upload the results to the flakiness dashboard.') |
| 343 parser.add_option( |
| 344 '--auto-reconnect', action='store_true', |
| 345 help='Push script to device which restarts adbd on disconnections.') |
337 options, args = parser.parse_args(argv[1:]) | 346 options, args = parser.parse_args(argv[1:]) |
338 | 347 |
339 def ParserError(msg): | 348 def ParserError(msg): |
340 """We avoid parser.error because it calls sys.exit.""" | 349 """We avoid parser.error because it calls sys.exit.""" |
341 parser.print_help() | 350 parser.print_help() |
342 print >> sys.stderr, '\nERROR:', msg | 351 print >> sys.stderr, '\nERROR:', msg |
343 return 1 | 352 return 1 |
344 | 353 |
345 if args: | 354 if args: |
346 return ParserError('Unused args %s' % args) | 355 return ParserError('Unused args %s' % args) |
(...skipping 13 matching lines...) Expand all Loading... |
360 'slave', 'android')) | 369 'slave', 'android')) |
361 if os.path.exists(build_internal_android): | 370 if os.path.exists(build_internal_android): |
362 android_paths.insert(0, build_internal_android) | 371 android_paths.insert(0, build_internal_android) |
363 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) | 372 os.environ['PATH'] = os.pathsep.join(android_paths + [os.environ['PATH']]) |
364 | 373 |
365 MainTestWrapper(options) | 374 MainTestWrapper(options) |
366 | 375 |
367 | 376 |
368 if __name__ == '__main__': | 377 if __name__ == '__main__': |
369 sys.exit(main(sys.argv)) | 378 sys.exit(main(sys.argv)) |
OLD | NEW |