diff options
author | navabi@google.com <navabi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 18:04:57 +0000 |
---|---|---|
committer | navabi@google.com <navabi@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-24 18:04:57 +0000 |
commit | ee7bf01203fabdfc35ae3c0bd6edfce7fed4cdeb (patch) | |
tree | 22d3a9bb2074535d260301d8d0f6051b8ebe4c1f /build/android | |
parent | 8e92fa3005cf340c325b30b662ad1827996d0832 (diff) | |
download | chromium_src-ee7bf01203fabdfc35ae3c0bd6edfce7fed4cdeb.zip chromium_src-ee7bf01203fabdfc35ae3c0bd6edfce7fed4cdeb.tar.gz chromium_src-ee7bf01203fabdfc35ae3c0bd6edfce7fed4cdeb.tar.bz2 |
If install of test apk fails because of storage, wipe device data.
Also, remove install of apk in device status check to track install speed. We have not been tracking install speed and have not found it to be very useful. I want to avoid doing too many installs. We can bring it back if we find out that it is useful. We originally added it because installs were timing out, but we found install speed to be too variable across the same device to be useful.
BUG=335549
TBR=craigdh@chromium.org
Review URL: https://codereview.chromium.org/204353011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android')
-rwxr-xr-x | build/android/buildbot/bb_device_status_check.py | 26 | ||||
-rwxr-xr-x | build/android/provision_devices.py | 36 | ||||
-rw-r--r-- | build/android/pylib/constants.py | 2 |
3 files changed, 42 insertions, 22 deletions
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py index f057962..e7d8c54 100755 --- a/build/android/buildbot/bb_device_status_check.py +++ b/build/android/buildbot/bb_device_status_check.py @@ -64,17 +64,6 @@ def DeviceInfo(serial, options): return lambda_function(found[0]) return 'Unknown' - if options.device_status_dashboard: - # Dashboard does not track install speed. Do not unnecessarily install. - install_speed = 'Unknown' - else: - install_output = GetCmdOutput( - ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, - '--apk', - '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT - ]) - install_speed = _GetData('(\d+) KB/s', install_output) - ac_power = _GetData('AC powered: (\w+)', battery) battery_level = _GetData('level: (\d+)', battery) battery_temp = _GetData('temperature: (\d+)', battery, @@ -89,7 +78,6 @@ def DeviceInfo(serial, options): ' Battery temp: %s' % battery_temp, ' IMEI slice: %s' % imei_slice, ' Wifi IP: %s' % device_adb.GetWifiIP(), - ' Install Speed: %s KB/s' % install_speed, ''] errors = [] @@ -101,14 +89,8 @@ def DeviceInfo(serial, options): errors += ['Setup wizard not disabled. Was it provisioned correctly?'] if device_product_name == 'mantaray' and ac_power != 'true': errors += ['Mantaray device not connected to AC power.'] - # TODO(navabi): Insert warning once we have a better handle of what install - # speeds to expect. The following lines were causing too many alerts. - # if install_speed < 500: - # errors += ['Device install speed too low. Do not use for testing.'] - - # Causing the device status check step fail for slow install speed or low - # battery currently is too disruptive to the bots (especially try bots). - # Turn off devices with low battery and the step does not fail. + + # Turn off devices with low battery. if battery_level < 15: device_adb.EnableAdbRoot() device_adb.Shutdown() @@ -365,8 +347,8 @@ def main(): if False in fail_step_lst: # TODO(navabi): Build fails on device status check step if there exists any - # devices with critically low battery or install speed. Remove those devices - # from testing, allowing build to continue with good devices. + # devices with critically low battery. Remove those devices from testing, + # allowing build to continue with good devices. return 1 if not devices: diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py index 5cf1cc5..53eb373 100755 --- a/build/android/provision_devices.py +++ b/build/android/provision_devices.py @@ -21,6 +21,7 @@ import time from pylib import android_commands from pylib import constants from pylib import device_settings +from pylib.cmd_helper import GetCmdOutput def KillHostHeartbeat(): @@ -83,6 +84,33 @@ def _ConfigureLocalProperties(adb): android_commands.LOCAL_PROPERTIES_PATH) +def WipeDeviceData(device): + """Wipes data from device, keeping only the adb_keys for authorization. + + After wiping data on a device that has been authorized, adb can still + communicate with the device, but after reboot the device will need to be + re-authorized because the adb keys file is stored in /data/misc/adb/. + Thus, before reboot the adb_keys file is rewritten so the device does not need + to be re-authorized. + + Arguments: + device: the device to wipe + """ + android_cmd = android_commands.AndroidCommands(device) + device_authorized = android_cmd.FileExistsOnDevice(constants.ADB_KEYS_FILE) + if device_authorized: + adb_keys = android_cmd.RunShellCommandWithSU( + 'cat %s' % constants.ADB_KEYS_FILE)[0] + android_cmd.RunShellCommandWithSU('wipe data') + if device_authorized: + path_list = constants.ADB_KEYS_FILE.split('/') + dir_path = '/'.join(path_list[:len(path_list)-1]) + android_cmd.RunShellCommandWithSU('mkdir -p %s' % dir_path) + adb_keys = android_cmd.RunShellCommand( + 'echo %s > %s' % (adb_keys, constants.ADB_KEYS_FILE)) + android_cmd.Reboot() + + def ProvisionDevices(options): if options.device is not None: devices = [options.device] @@ -90,6 +118,14 @@ def ProvisionDevices(options): devices = android_commands.GetAttachedDevices() for device in devices: android_cmd = android_commands.AndroidCommands(device) + install_output = GetCmdOutput( + ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, + '--apk', + '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT + ]) + failure_string = 'Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]' + if failure_string in install_output: + WipeDeviceData(device) _ConfigureLocalProperties(android_cmd) device_settings.ConfigureContentSettingsDict( android_cmd, device_settings.DETERMINISTIC_DEVICE_SETTINGS) diff --git a/build/android/pylib/constants.py b/build/android/pylib/constants.py index 3d72150..3316332 100644 --- a/build/android/pylib/constants.py +++ b/build/android/pylib/constants.py @@ -124,6 +124,8 @@ SDK_BUILD_JAVALIB_DIR = 'lib.java' SDK_BUILD_TEST_JAVALIB_DIR = 'test.lib.java' SDK_BUILD_APKS_DIR = 'apks' +ADB_KEYS_FILE = '/data/misc/adb/adb_keys' + PERF_OUTPUT_DIR = os.path.join(DIR_SOURCE_ROOT, 'out', 'step_results') # The directory on the device where perf test output gets saved to. DEVICE_PERF_OUTPUT_DIR = ( |