provision_devices.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. #!/usr/bin/env vpython3
  2. #
  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
  5. # found in the LICENSE file.
  6. """Provisions Android devices with settings required for bots.
  7. Usage:
  8. ./provision_devices.py [-d <device serial number>]
  9. """
  10. import argparse
  11. import datetime
  12. import json
  13. import logging
  14. import os
  15. import posixpath
  16. import re
  17. import subprocess
  18. import sys
  19. import time
  20. # Import _strptime before threaded code. datetime.datetime.strptime is
  21. # threadsafe except for the initial import of the _strptime module.
  22. # See crbug.com/584730 and https://bugs.python.org/issue7980.
  23. import _strptime # pylint: disable=unused-import
  24. import devil_chromium
  25. from devil.android import battery_utils
  26. from devil.android import device_denylist
  27. from devil.android import device_errors
  28. from devil.android import device_temp_file
  29. from devil.android import device_utils
  30. from devil.android.sdk import keyevent
  31. from devil.android.sdk import version_codes
  32. from devil.constants import exit_codes
  33. from devil.utils import run_tests_helper
  34. from devil.utils import timeout_retry
  35. from pylib import constants
  36. from pylib import device_settings
  37. from pylib.constants import host_paths
  38. _SYSTEM_WEBVIEW_PATHS = ['/system/app/webview', '/system/app/WebViewGoogle']
  39. _CHROME_PACKAGE_REGEX = re.compile('.*chrom.*')
  40. _TOMBSTONE_REGEX = re.compile('tombstone.*')
  41. class _DEFAULT_TIMEOUTS:
  42. # L can take a while to reboot after a wipe.
  43. LOLLIPOP = 600
  44. PRE_LOLLIPOP = 180
  45. HELP_TEXT = '{}s on L, {}s on pre-L'.format(LOLLIPOP, PRE_LOLLIPOP)
  46. class _PHASES:
  47. WIPE = 'wipe'
  48. PROPERTIES = 'properties'
  49. FINISH = 'finish'
  50. ALL = [WIPE, PROPERTIES, FINISH]
  51. def ProvisionDevices(args):
  52. denylist = (device_denylist.Denylist(args.denylist_file)
  53. if args.denylist_file else None)
  54. devices = [
  55. d for d in device_utils.DeviceUtils.HealthyDevices(denylist)
  56. if not args.emulators or d.is_emulator
  57. ]
  58. if args.device:
  59. devices = [d for d in devices if d == args.device]
  60. if not devices:
  61. raise device_errors.DeviceUnreachableError(args.device)
  62. parallel_devices = device_utils.DeviceUtils.parallel(devices)
  63. if args.emulators:
  64. parallel_devices.pMap(SetProperties, args)
  65. else:
  66. parallel_devices.pMap(ProvisionDevice, denylist, args)
  67. if args.auto_reconnect:
  68. _LaunchHostHeartbeat()
  69. denylisted_devices = denylist.Read() if denylist else []
  70. if args.output_device_denylist:
  71. with open(args.output_device_denylist, 'w') as f:
  72. json.dump(denylisted_devices, f)
  73. if all(d in denylisted_devices for d in devices):
  74. raise device_errors.NoDevicesError
  75. return 0
  76. def ProvisionDevice(device, denylist, options):
  77. def should_run_phase(phase_name):
  78. return not options.phases or phase_name in options.phases
  79. def run_phase(phase_func, reboot_timeout, reboot=True):
  80. try:
  81. device.WaitUntilFullyBooted(timeout=reboot_timeout, retries=0)
  82. except device_errors.CommandTimeoutError:
  83. logging.error('Device did not finish booting. Will try to reboot.')
  84. device.Reboot(timeout=reboot_timeout)
  85. phase_func(device, options)
  86. if reboot:
  87. device.Reboot(False, retries=0)
  88. device.adb.WaitForDevice()
  89. try:
  90. if options.reboot_timeout:
  91. reboot_timeout = options.reboot_timeout
  92. elif device.build_version_sdk >= version_codes.LOLLIPOP:
  93. reboot_timeout = _DEFAULT_TIMEOUTS.LOLLIPOP
  94. else:
  95. reboot_timeout = _DEFAULT_TIMEOUTS.PRE_LOLLIPOP
  96. if should_run_phase(_PHASES.WIPE):
  97. if (options.chrome_specific_wipe or device.IsUserBuild() or
  98. device.build_version_sdk >= version_codes.MARSHMALLOW):
  99. run_phase(WipeChromeData, reboot_timeout)
  100. else:
  101. run_phase(WipeDevice, reboot_timeout)
  102. if should_run_phase(_PHASES.PROPERTIES):
  103. run_phase(SetProperties, reboot_timeout)
  104. if should_run_phase(_PHASES.FINISH):
  105. run_phase(FinishProvisioning, reboot_timeout, reboot=False)
  106. if options.chrome_specific_wipe:
  107. package = "com.google.android.gms"
  108. version_name = device.GetApplicationVersion(package)
  109. logging.info("Version name for %s is %s", package, version_name)
  110. CheckExternalStorage(device)
  111. except device_errors.CommandTimeoutError:
  112. logging.exception('Timed out waiting for device %s. Adding to denylist.',
  113. str(device))
  114. if denylist:
  115. denylist.Extend([str(device)], reason='provision_timeout')
  116. except (device_errors.CommandFailedError,
  117. device_errors.DeviceUnreachableError):
  118. logging.exception('Failed to provision device %s. Adding to denylist.',
  119. str(device))
  120. if denylist:
  121. denylist.Extend([str(device)], reason='provision_failure')
  122. def CheckExternalStorage(device):
  123. """Checks that storage is writable and if not makes it writable.
  124. Arguments:
  125. device: The device to check.
  126. """
  127. try:
  128. with device_temp_file.DeviceTempFile(
  129. device.adb, suffix='.sh', dir=device.GetExternalStoragePath()) as f:
  130. device.WriteFile(f.name, 'test')
  131. except device_errors.CommandFailedError:
  132. logging.info('External storage not writable. Remounting / as RW')
  133. device.RunShellCommand(['mount', '-o', 'remount,rw', '/'],
  134. check_return=True, as_root=True)
  135. device.EnableRoot()
  136. with device_temp_file.DeviceTempFile(
  137. device.adb, suffix='.sh', dir=device.GetExternalStoragePath()) as f:
  138. device.WriteFile(f.name, 'test')
  139. def WipeChromeData(device, options):
  140. """Wipes chrome specific data from device
  141. (1) uninstall any app whose name matches *chrom*, except
  142. com.android.chrome, which is the chrome stable package. Doing so also
  143. removes the corresponding dirs under /data/data/ and /data/app/
  144. (2) remove any dir under /data/app-lib/ whose name matches *chrom*
  145. (3) remove any files under /data/tombstones/ whose name matches "tombstone*"
  146. (4) remove /data/local.prop if there is any
  147. (5) remove /data/local/chrome-command-line if there is any
  148. (6) remove anything under /data/local/.config/ if the dir exists
  149. (this is telemetry related)
  150. (7) remove anything under /data/local/tmp/
  151. Arguments:
  152. device: the device to wipe
  153. """
  154. if options.skip_wipe:
  155. return
  156. try:
  157. if device.IsUserBuild():
  158. _UninstallIfMatch(device, _CHROME_PACKAGE_REGEX,
  159. constants.PACKAGE_INFO['chrome_stable'].package)
  160. device.RunShellCommand('rm -rf %s/*' % device.GetExternalStoragePath(),
  161. check_return=True)
  162. device.RunShellCommand('rm -rf /data/local/tmp/*', check_return=True)
  163. else:
  164. device.EnableRoot()
  165. _UninstallIfMatch(device, _CHROME_PACKAGE_REGEX,
  166. constants.PACKAGE_INFO['chrome_stable'].package)
  167. _WipeUnderDirIfMatch(device, '/data/app-lib/', _CHROME_PACKAGE_REGEX)
  168. _WipeUnderDirIfMatch(device, '/data/tombstones/', _TOMBSTONE_REGEX)
  169. _WipeFileOrDir(device, '/data/local.prop')
  170. _WipeFileOrDir(device, '/data/local/chrome-command-line')
  171. _WipeFileOrDir(device, '/data/local/.config/')
  172. _WipeFileOrDir(device, '/data/local/tmp/')
  173. device.RunShellCommand('rm -rf %s/*' % device.GetExternalStoragePath(),
  174. check_return=True)
  175. except device_errors.CommandFailedError:
  176. logging.exception('Possible failure while wiping the device. '
  177. 'Attempting to continue.')
  178. def WipeDevice(device, options):
  179. """Wipes data from device, keeping only the adb_keys for authorization.
  180. After wiping data on a device that has been authorized, adb can still
  181. communicate with the device, but after reboot the device will need to be
  182. re-authorized because the adb keys file is stored in /data/misc/adb/.
  183. Thus, adb_keys file is rewritten so the device does not need to be
  184. re-authorized.
  185. Arguments:
  186. device: the device to wipe
  187. """
  188. if options.skip_wipe:
  189. return
  190. try:
  191. device.EnableRoot()
  192. device_authorized = device.FileExists(constants.ADB_KEYS_FILE)
  193. if device_authorized:
  194. adb_keys = device.ReadFile(constants.ADB_KEYS_FILE,
  195. as_root=True).splitlines()
  196. device.RunShellCommand(['wipe', 'data'],
  197. as_root=True, check_return=True)
  198. device.adb.WaitForDevice()
  199. if device_authorized:
  200. adb_keys_set = set(adb_keys)
  201. for adb_key_file in options.adb_key_files or []:
  202. try:
  203. with open(adb_key_file, 'r') as f:
  204. adb_public_keys = f.readlines()
  205. adb_keys_set.update(adb_public_keys)
  206. except IOError:
  207. logging.warning('Unable to find adb keys file %s.', adb_key_file)
  208. _WriteAdbKeysFile(device, '\n'.join(adb_keys_set))
  209. except device_errors.CommandFailedError:
  210. logging.exception('Possible failure while wiping the device. '
  211. 'Attempting to continue.')
  212. def _WriteAdbKeysFile(device, adb_keys_string):
  213. dir_path = posixpath.dirname(constants.ADB_KEYS_FILE)
  214. device.RunShellCommand(['mkdir', '-p', dir_path],
  215. as_root=True, check_return=True)
  216. device.RunShellCommand(['restorecon', dir_path],
  217. as_root=True, check_return=True)
  218. device.WriteFile(constants.ADB_KEYS_FILE, adb_keys_string, as_root=True)
  219. device.RunShellCommand(['restorecon', constants.ADB_KEYS_FILE],
  220. as_root=True, check_return=True)
  221. def SetProperties(device, options):
  222. try:
  223. device.EnableRoot()
  224. except device_errors.CommandFailedError as e:
  225. logging.warning(str(e))
  226. if not device.IsUserBuild():
  227. _ConfigureLocalProperties(device, options.enable_java_debug)
  228. else:
  229. logging.warning('Cannot configure properties in user builds.')
  230. device_settings.ConfigureContentSettings(
  231. device, device_settings.DETERMINISTIC_DEVICE_SETTINGS)
  232. if options.disable_location:
  233. device_settings.ConfigureContentSettings(
  234. device, device_settings.DISABLE_LOCATION_SETTINGS)
  235. else:
  236. device_settings.ConfigureContentSettings(
  237. device, device_settings.ENABLE_LOCATION_SETTINGS)
  238. if options.disable_mock_location:
  239. device_settings.ConfigureContentSettings(
  240. device, device_settings.DISABLE_MOCK_LOCATION_SETTINGS)
  241. else:
  242. device_settings.ConfigureContentSettings(
  243. device, device_settings.ENABLE_MOCK_LOCATION_SETTINGS)
  244. device_settings.SetLockScreenSettings(device)
  245. if options.disable_network:
  246. device_settings.ConfigureContentSettings(
  247. device, device_settings.NETWORK_DISABLED_SETTINGS)
  248. if device.build_version_sdk >= version_codes.MARSHMALLOW:
  249. # Ensure that NFC is also switched off.
  250. device.RunShellCommand(['svc', 'nfc', 'disable'],
  251. as_root=True, check_return=True)
  252. if options.disable_system_chrome:
  253. # The system chrome version on the device interferes with some tests.
  254. device.RunShellCommand(['pm', 'disable', 'com.android.chrome'],
  255. check_return=True)
  256. if options.remove_system_webview:
  257. if any(device.PathExists(p) for p in _SYSTEM_WEBVIEW_PATHS):
  258. logging.info('System WebView exists and needs to be removed')
  259. if device.HasRoot():
  260. # Disabled Marshmallow's Verity security feature
  261. if device.build_version_sdk >= version_codes.MARSHMALLOW:
  262. device.adb.DisableVerity()
  263. device.Reboot()
  264. device.WaitUntilFullyBooted()
  265. device.EnableRoot()
  266. # This is required, e.g., to replace the system webview on a device.
  267. device.adb.Remount()
  268. device.RunShellCommand(['stop'], check_return=True)
  269. device.RunShellCommand(['rm', '-rf'] + _SYSTEM_WEBVIEW_PATHS,
  270. check_return=True)
  271. device.RunShellCommand(['start'], check_return=True)
  272. else:
  273. logging.warning('Cannot remove system webview from a non-rooted device')
  274. else:
  275. logging.info('System WebView already removed')
  276. # Some device types can momentarily disappear after setting properties.
  277. device.adb.WaitForDevice()
  278. def _ConfigureLocalProperties(device, java_debug=True):
  279. """Set standard readonly testing device properties prior to reboot."""
  280. local_props = [
  281. 'persist.sys.usb.config=adb',
  282. 'ro.monkey=1',
  283. 'ro.test_harness=1',
  284. 'ro.audio.silent=1',
  285. 'ro.setupwizard.mode=DISABLED',
  286. ]
  287. if java_debug:
  288. local_props.append(
  289. '%s=all' % device_utils.DeviceUtils.JAVA_ASSERT_PROPERTY)
  290. local_props.append('debug.checkjni=1')
  291. try:
  292. device.WriteFile(
  293. device.LOCAL_PROPERTIES_PATH,
  294. '\n'.join(local_props), as_root=True)
  295. # Android will not respect the local props file if it is world writable.
  296. device.RunShellCommand(
  297. ['chmod', '644', device.LOCAL_PROPERTIES_PATH],
  298. as_root=True, check_return=True)
  299. except device_errors.CommandFailedError:
  300. logging.exception('Failed to configure local properties.')
  301. def FinishProvisioning(device, options):
  302. # The lockscreen can't be disabled on user builds, so send a keyevent
  303. # to unlock it.
  304. if device.IsUserBuild():
  305. device.SendKeyEvent(keyevent.KEYCODE_MENU)
  306. if options.min_battery_level is not None:
  307. battery = battery_utils.BatteryUtils(device)
  308. try:
  309. battery.ChargeDeviceToLevel(options.min_battery_level)
  310. except device_errors.DeviceChargingError:
  311. device.Reboot()
  312. battery.ChargeDeviceToLevel(options.min_battery_level)
  313. if options.max_battery_temp is not None:
  314. try:
  315. battery = battery_utils.BatteryUtils(device)
  316. battery.LetBatteryCoolToTemperature(options.max_battery_temp)
  317. except device_errors.CommandFailedError:
  318. logging.exception('Unable to let battery cool to specified temperature.')
  319. def _set_and_verify_date():
  320. if device.build_version_sdk >= version_codes.MARSHMALLOW:
  321. date_format = '%m%d%H%M%Y.%S'
  322. set_date_command = ['date', '-u']
  323. get_date_command = ['date', '-u']
  324. else:
  325. date_format = '%Y%m%d.%H%M%S'
  326. set_date_command = ['date', '-s']
  327. get_date_command = ['date']
  328. # TODO(jbudorick): This is wrong on pre-M devices -- get/set are
  329. # dealing in local time, but we're setting based on GMT.
  330. strgmtime = time.strftime(date_format, time.gmtime())
  331. set_date_command.append(strgmtime)
  332. device.RunShellCommand(set_date_command, as_root=True, check_return=True)
  333. get_date_command.append('+"%Y%m%d.%H%M%S"')
  334. device_time = device.RunShellCommand(
  335. get_date_command, as_root=True, single_line=True).replace('"', '')
  336. device_time = datetime.datetime.strptime(device_time, "%Y%m%d.%H%M%S")
  337. correct_time = datetime.datetime.strptime(strgmtime, date_format)
  338. tdelta = (correct_time - device_time).seconds
  339. if tdelta <= 1:
  340. logging.info('Date/time successfully set on %s', device)
  341. return True
  342. logging.error('Date mismatch. Device: %s Correct: %s',
  343. device_time.isoformat(), correct_time.isoformat())
  344. return False
  345. # Sometimes the date is not set correctly on the devices. Retry on failure.
  346. if device.IsUserBuild():
  347. # TODO(bpastene): Figure out how to set the date & time on user builds.
  348. pass
  349. else:
  350. if not timeout_retry.WaitFor(
  351. _set_and_verify_date, wait_period=1, max_tries=2):
  352. raise device_errors.CommandFailedError(
  353. 'Failed to set date & time.', device_serial=str(device))
  354. props = device.RunShellCommand('getprop', check_return=True)
  355. for prop in props:
  356. logging.info(' %s', prop)
  357. if options.auto_reconnect:
  358. _PushAndLaunchAdbReboot(device, options.target)
  359. def _UninstallIfMatch(device, pattern, app_to_keep):
  360. installed_packages = device.RunShellCommand(['pm', 'list', 'packages'])
  361. installed_system_packages = [
  362. pkg.split(':')[1] for pkg in device.RunShellCommand(['pm', 'list',
  363. 'packages', '-s'])]
  364. for package_output in installed_packages:
  365. package = package_output.split(":")[1]
  366. if pattern.match(package) and not package == app_to_keep:
  367. if not device.IsUserBuild() or package not in installed_system_packages:
  368. device.Uninstall(package)
  369. def _WipeUnderDirIfMatch(device, path, pattern):
  370. for filename in device.ListDirectory(path):
  371. if pattern.match(filename):
  372. _WipeFileOrDir(device, posixpath.join(path, filename))
  373. def _WipeFileOrDir(device, path):
  374. if device.PathExists(path):
  375. device.RunShellCommand(['rm', '-rf', path], check_return=True)
  376. def _PushAndLaunchAdbReboot(device, target):
  377. """Pushes and launches the adb_reboot binary on the device.
  378. Arguments:
  379. device: The DeviceUtils instance for the device to which the adb_reboot
  380. binary should be pushed.
  381. target: The build target (example, Debug or Release) which helps in
  382. locating the adb_reboot binary.
  383. """
  384. logging.info('Will push and launch adb_reboot on %s', str(device))
  385. # Kill if adb_reboot is already running.
  386. device.KillAll('adb_reboot', blocking=True, timeout=2, quiet=True)
  387. # Push adb_reboot
  388. logging.info(' Pushing adb_reboot ...')
  389. adb_reboot = os.path.join(host_paths.DIR_SOURCE_ROOT,
  390. 'out/%s/adb_reboot' % target)
  391. device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')])
  392. # Launch adb_reboot
  393. logging.info(' Launching adb_reboot ...')
  394. device.RunShellCommand(
  395. ['/data/local/tmp/adb_reboot'],
  396. check_return=True)
  397. def _LaunchHostHeartbeat():
  398. # Kill if existing host_heartbeat
  399. KillHostHeartbeat()
  400. # Launch a new host_heartbeat
  401. logging.info('Spawning host heartbeat...')
  402. subprocess.Popen([os.path.join(host_paths.DIR_SOURCE_ROOT,
  403. 'build/android/host_heartbeat.py')])
  404. def KillHostHeartbeat():
  405. ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  406. stdout, _ = ps.communicate()
  407. matches = re.findall('\\n.*host_heartbeat.*', stdout)
  408. for match in matches:
  409. logging.info('An instance of host heart beart running... will kill')
  410. pid = re.findall(r'(\S+)', match)[1]
  411. subprocess.call(['kill', str(pid)])
  412. def main():
  413. # Recommended options on perf bots:
  414. # --disable-network
  415. # TODO(tonyg): We eventually want network on. However, currently radios
  416. # can cause perfbots to drain faster than they charge.
  417. # --min-battery-level 95
  418. # Some perf bots run benchmarks with USB charging disabled which leads
  419. # to gradual draining of the battery. We must wait for a full charge
  420. # before starting a run in order to keep the devices online.
  421. parser = argparse.ArgumentParser(
  422. description='Provision Android devices with settings required for bots.')
  423. parser.add_argument('-d', '--device', metavar='SERIAL',
  424. help='the serial number of the device to be provisioned'
  425. ' (the default is to provision all devices attached)')
  426. parser.add_argument('--adb-path',
  427. help='Absolute path to the adb binary to use.')
  428. parser.add_argument('--denylist-file', help='Device denylist JSON file.')
  429. parser.add_argument('--phase', action='append', choices=_PHASES.ALL,
  430. dest='phases',
  431. help='Phases of provisioning to run. '
  432. '(If omitted, all phases will be run.)')
  433. parser.add_argument('--skip-wipe', action='store_true', default=False,
  434. help="don't wipe device data during provisioning")
  435. parser.add_argument('--reboot-timeout', metavar='SECS', type=int,
  436. help='when wiping the device, max number of seconds to'
  437. ' wait after each reboot '
  438. '(default: %s)' % _DEFAULT_TIMEOUTS.HELP_TEXT)
  439. parser.add_argument('--min-battery-level', type=int, metavar='NUM',
  440. help='wait for the device to reach this minimum battery'
  441. ' level before trying to continue')
  442. parser.add_argument('--disable-location', action='store_true',
  443. help='disable Google location services on devices')
  444. parser.add_argument('--disable-mock-location', action='store_true',
  445. default=False, help='Set ALLOW_MOCK_LOCATION to false')
  446. parser.add_argument('--disable-network', action='store_true',
  447. help='disable network access on devices')
  448. parser.add_argument('--disable-java-debug', action='store_false',
  449. dest='enable_java_debug', default=True,
  450. help='disable Java property asserts and JNI checking')
  451. parser.add_argument('--disable-system-chrome', action='store_true',
  452. help='Disable the system chrome from devices.')
  453. parser.add_argument('--remove-system-webview', action='store_true',
  454. help='Remove the system webview from devices.')
  455. parser.add_argument('-t', '--target', default='Debug',
  456. help='the build target (default: %(default)s)')
  457. parser.add_argument('-r', '--auto-reconnect', action='store_true',
  458. help='push binary which will reboot the device on adb'
  459. ' disconnections')
  460. parser.add_argument('--adb-key-files', type=str, nargs='+',
  461. help='list of adb keys to push to device')
  462. parser.add_argument('-v', '--verbose', action='count', default=1,
  463. help='Log more information.')
  464. parser.add_argument('--max-battery-temp', type=int, metavar='NUM',
  465. help='Wait for the battery to have this temp or lower.')
  466. parser.add_argument('--output-device-denylist',
  467. help='Json file to output the device denylist.')
  468. parser.add_argument('--chrome-specific-wipe', action='store_true',
  469. help='only wipe chrome specific data during provisioning')
  470. parser.add_argument('--emulators', action='store_true',
  471. help='provision only emulators and ignore usb devices')
  472. args = parser.parse_args()
  473. constants.SetBuildType(args.target)
  474. run_tests_helper.SetLogLevel(args.verbose)
  475. devil_chromium.Initialize(adb_path=args.adb_path)
  476. try:
  477. return ProvisionDevices(args)
  478. except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError):
  479. logging.exception('Unable to provision local devices.')
  480. return exit_codes.INFRA
  481. if __name__ == '__main__':
  482. sys.exit(main())