Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: build/android/provision_devices.py

Issue 1577383002: [Android] Make the adb path configurable in three scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/buildbot/bb_device_status_check.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 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 """Provisions Android devices with settings required for bots. 7 """Provisions Android devices with settings required for bots.
8 8
9 Usage: 9 Usage:
10 ./provision_devices.py [-d <device serial number>] 10 ./provision_devices.py [-d <device serial number>]
11 """ 11 """
12 12
13 import argparse 13 import argparse
14 import datetime 14 import datetime
15 import json 15 import json
16 import logging 16 import logging
17 import os 17 import os
18 import posixpath 18 import posixpath
19 import re 19 import re
20 import subprocess 20 import subprocess
21 import sys 21 import sys
22 import time 22 import time
23 23
24 import devil_chromium 24 import devil_chromium
25 from devil import devil_env
25 from devil.android import battery_utils 26 from devil.android import battery_utils
26 from devil.android import device_blacklist 27 from devil.android import device_blacklist
27 from devil.android import device_errors 28 from devil.android import device_errors
28 from devil.android import device_temp_file 29 from devil.android import device_temp_file
29 from devil.android import device_utils 30 from devil.android import device_utils
30 from devil.android.sdk import keyevent 31 from devil.android.sdk import keyevent
31 from devil.android.sdk import version_codes 32 from devil.android.sdk import version_codes
32 from devil.utils import run_tests_helper 33 from devil.utils import run_tests_helper
33 from devil.utils import timeout_retry 34 from devil.utils import timeout_retry
34 from pylib import constants 35 from pylib import constants
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 # --min-battery-level 95 464 # --min-battery-level 95
464 # Some perf bots run benchmarks with USB charging disabled which leads 465 # Some perf bots run benchmarks with USB charging disabled which leads
465 # to gradual draining of the battery. We must wait for a full charge 466 # to gradual draining of the battery. We must wait for a full charge
466 # before starting a run in order to keep the devices online. 467 # before starting a run in order to keep the devices online.
467 468
468 parser = argparse.ArgumentParser( 469 parser = argparse.ArgumentParser(
469 description='Provision Android devices with settings required for bots.') 470 description='Provision Android devices with settings required for bots.')
470 parser.add_argument('-d', '--device', metavar='SERIAL', 471 parser.add_argument('-d', '--device', metavar='SERIAL',
471 help='the serial number of the device to be provisioned' 472 help='the serial number of the device to be provisioned'
472 ' (the default is to provision all devices attached)') 473 ' (the default is to provision all devices attached)')
474 parser.add_argument('--adb-path',
475 help='Absolute path to the adb binary to use.')
473 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 476 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
474 parser.add_argument('--phase', action='append', choices=_PHASES.ALL, 477 parser.add_argument('--phase', action='append', choices=_PHASES.ALL,
475 dest='phases', 478 dest='phases',
476 help='Phases of provisioning to run. ' 479 help='Phases of provisioning to run. '
477 '(If omitted, all phases will be run.)') 480 '(If omitted, all phases will be run.)')
478 parser.add_argument('--skip-wipe', action='store_true', default=False, 481 parser.add_argument('--skip-wipe', action='store_true', default=False,
479 help="don't wipe device data during provisioning") 482 help="don't wipe device data during provisioning")
480 parser.add_argument('--reboot-timeout', metavar='SECS', type=int, 483 parser.add_argument('--reboot-timeout', metavar='SECS', type=int,
481 help='when wiping the device, max number of seconds to' 484 help='when wiping the device, max number of seconds to'
482 ' wait after each reboot ' 485 ' wait after each reboot '
(...skipping 29 matching lines...) Expand all
512 help='Json file to output the device blacklist.') 515 help='Json file to output the device blacklist.')
513 parser.add_argument('--chrome-specific-wipe', action='store_true', 516 parser.add_argument('--chrome-specific-wipe', action='store_true',
514 help='only wipe chrome specific data during provisioning') 517 help='only wipe chrome specific data during provisioning')
515 parser.add_argument('--emulators', action='store_true', 518 parser.add_argument('--emulators', action='store_true',
516 help='provision only emulators and ignore usb devices') 519 help='provision only emulators and ignore usb devices')
517 args = parser.parse_args() 520 args = parser.parse_args()
518 constants.SetBuildType(args.target) 521 constants.SetBuildType(args.target)
519 522
520 run_tests_helper.SetLogLevel(args.verbose) 523 run_tests_helper.SetLogLevel(args.verbose)
521 524
522 devil_chromium.Initialize() 525 devil_custom_deps = None
526 if args.adb_path:
527 devil_custom_deps = {
528 'adb': {
529 devil_env.GetPlatform(): [args.adb_path],
530 },
531 }
532
533 devil_chromium.Initialize(custom_deps=devil_custom_deps)
523 534
524 return ProvisionDevices(args) 535 return ProvisionDevices(args)
525 536
526 537
527 if __name__ == '__main__': 538 if __name__ == '__main__':
528 sys.exit(main()) 539 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/buildbot/bb_device_status_check.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698