Revert 203587 "Move CheckInstall to device status and fail on lo..."

Broke android tests.

> Move CheckInstall to device status and fail on low install speed and battery.
> 
> Removes the recently added CheckInstall step and moves the checking to the
> device status check step. Recently, devices will install very slowly causing
> tests to fail with device problems. We have also seen battery issues. The new
> device status check step will fail if any devices install unreasonably slow
> (i.e. < 800 KB/s) or have critically low battery level (i.e. < 5%).
> 
> BUG=230970, 224004, 242237
> 
> Review URL: https://chromiumcodereview.appspot.com/16110005

TBR=navabi@google.com
Review URL: https://codereview.chromium.org/16299003

git-svn-id: http://src.chromium.org/svn/trunk/src/build@203594 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
justinlin@chromium.org 2013-06-01 06:42:15 +00:00
Родитель b5ff01f371
Коммит 81dba6dddf
2 изменённых файлов: 16 добавлений и 24 удалений

Просмотреть файл

@ -162,6 +162,15 @@ def RunChromeDriverTests():
RunCmd(['chrome/test/chromedriver/run_buildbot_steps.py',
'--android-package=%s' % constants.CHROMIUM_TEST_SHELL_PACKAGE])
def CheckInstall():
"""Build bot step to see if adb install works on attached devices. """
buildbot_report.PrintNamedStep('Check device install')
# This step checks if apks can be installed on the devices.
args = ['--apk', 'build/android/CheckInstallApk-debug.apk']
RunCmd(['build/android/adb_install_apk.py'] + args, halt_on_failure=True)
def InstallApk(options, test, print_step=False):
"""Install an apk to all phones.
@ -277,6 +286,9 @@ def MainTestWrapper(options):
target = options.factory_properties.get('target', 'Debug')
RunCmd(['build/android/provision_devices.py', '-t', target])
# Check to see if devices can install apks.
CheckInstall()
if options.install:
test_obj = INSTRUMENTATION_TESTS[options.install]
InstallApk(options, test_obj, print_step=True)

Просмотреть файл

@ -24,8 +24,7 @@ def DeviceInfo(serial):
serial: The serial of the attached device to construct info about.
Returns:
Tuple of device type, build id, report as a string, error messages, and
boolean indicating whether or not device can be used for testing.
Tuple of device type, build id and report as a string.
"""
def AdbShellCmd(cmd):
@ -39,13 +38,6 @@ def DeviceInfo(serial):
setup_wizard_disabled = AdbShellCmd(
'getprop ro.setupwizard.mode') == 'DISABLED'
battery = AdbShellCmd('dumpsys battery')
install_output = GetCmdOutput(['build/android/adb_install_apk.py', '--apk',
'build/android/CheckInstallApk-debug.apk'])
install_speed_found = re.findall('(\d+) KB/s', install_output)
if install_speed_found:
install_speed = int(install_speed_found[0])
else:
install_speed = 'Unknown'
if 'Error' in battery:
ac_power = 'Unknown'
battery_level = 'Unknown'
@ -63,22 +55,17 @@ def DeviceInfo(serial):
'| grep Device'
"| awk '{print $4}'")[-6:],
' Wifi IP: %s' % AdbShellCmd('getprop dhcp.wlan0.ipaddress'),
' Install Speed: %s KB/s' % install_speed,
'']
errors = []
if battery_level < 5:
errors += ['Device critically low in battery. Do not use for testing.']
errors += ['Device critically low in battery.']
if not setup_wizard_disabled:
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.']
if install_speed < 800:
errors += ['Device install speed too low. Do not use for testing.']
use_device = (battery_level != 'Unknown' and battery_level >= 5 and
install_speed != 'Unknown' and install_speed >= 800)
return device_type, device_build, '\n'.join(report), errors, use_device
return device_type, device_build, '\n'.join(report), errors
def CheckForMissingDevices(options, adb_online_devs):
@ -180,8 +167,7 @@ def main():
devices = android_commands.GetAttachedDevices()
types, builds, reports, errors = [], [], [], []
if devices:
types, builds, reports, errors, use_device_lst = zip(*[DeviceInfo(dev)
for dev in devices])
types, builds, reports, errors = zip(*[DeviceInfo(dev) for dev in devices])
err_msg = CheckForMissingDevices(options, devices) or []
@ -203,12 +189,6 @@ def main():
print msg
SendDeviceStatusAlert(msg)
if False in use_device_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.
return 1
if not devices:
return 1