Title: [133299] trunk/Tools
Revision
133299
Author
pe...@chromium.org
Date
2012-11-02 08:16:04 -0700 (Fri, 02 Nov 2012)

Log Message

Output Android's device status before running tests on the bots
https://bugs.webkit.org/show_bug.cgi?id=100944

Reviewed by Dirk Pranke.

This adds a new step to the build master which will be run prior to the
actual tests-suites on the Chromium Android tester, and soon the Chromium
Android Perf bot. For each attached device, it outputs the build
information, battery level, battery temperature and username.

The Android tester currently is very flaky, and this will help tremendously
in being able to figure out what's wrong with the bot.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(OutputAndroidDeviceStatus):
(TestFactory.__init__):
* BuildSlaveSupport/chromium/output-android-device-status: Added.
(GetAttachedDevices):
(AndroidDeviceStatus):
(AndroidDeviceStatus.__init__):
(AndroidDeviceStatus._run_adb_command):
(AndroidDeviceStatus.device_type):
(AndroidDeviceStatus.device_build):
(AndroidDeviceStatus.device_fingerprint):
(AndroidDeviceStatus.battery_level):
(AndroidDeviceStatus.battery_temperature):
(AndroidDeviceStatus.username):
(main):

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg (133298 => 133299)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg	2012-11-02 15:10:32 UTC (rev 133298)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/master.cfg	2012-11-02 15:16:04 UTC (rev 133299)
@@ -174,6 +174,12 @@
     command = ["python", "./Tools/BuildSlaveSupport/chromium/remove-crash-logs"]
     haltOnFailure = False
 
+class OutputAndroidDeviceStatus(shell.ShellCommand):
+    name = "android device status"
+    description = ["outputting android device status"]
+    descriptionDone = ["outputted android device status"]
+    command = ["python", "./Tools/BuildSlaveSupport/chromium/output-android-device-status"]
+    haltOnFailure = False
 
 def appendCustomBuildFlags(step, platform, fullPlatform=""):
     if fullPlatform == "chromium-android":
@@ -753,6 +759,8 @@
         Factory.__init__(self, platform, configuration, architectures, False, SVNMirror)
         if platform.startswith("chromium"):
             self.addStep(CleanupChromiumCrashLogs())
+        if platform == "chromium-android":
+            self.addStep(OutputAndroidDeviceStatus())
         self.addStep(DownloadBuiltProduct())
         self.addStep(ExtractBuiltProduct())
         if not platform.startswith("chromium"):

Added: trunk/Tools/BuildSlaveSupport/chromium/output-android-device-status (0 => 133299)


--- trunk/Tools/BuildSlaveSupport/chromium/output-android-device-status	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/chromium/output-android-device-status	2012-11-02 15:16:04 UTC (rev 133299)
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# Copyright (C) 2012 Google Inc. All Rights Reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import re
+import subprocess
+import sys
+
+def GetAttachedDevices():
+    re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE)
+    process = subprocess.Popen(['adb', 'devices'], stdout=subprocess.PIPE)
+    return re_device.findall(process.communicate()[0])
+
+
+class AndroidDeviceStatus(object):
+    def __init__(self, device_serial):
+        self._device_serial = device_serial
+
+    def _run_adb_command(self, command):
+        full_command = ['adb', '-s', self._device_serial] + command
+        stdout, _ = subprocess.Popen(full_command, stdout=subprocess.PIPE).communicate()
+        return stdout.strip()
+
+    def device_type(self):
+        return self._run_adb_command(['shell', 'getprop', 'ro.build.product'])
+
+    def device_build(self):
+        return self._run_adb_command(['shell', 'getprop', 'ro.build.id'])
+
+    def device_fingerprint(self):
+        return self._run_adb_command(['shell', 'getprop', 'ro.build.fingerprint'])
+
+    def battery_level(self):
+        return self._run_adb_command(['shell', 'cat', '/sys/class/power_supply/battery/capacity'])
+
+    def battery_temperature(self):
+        temperature = self._run_adb_command(['shell', 'dumpsys', 'battery'])
+        re_temperature = re.compile('temperature:\s+(\d+)')
+        return re_temperature.findall(temperature)[0]
+
+    def username(self):
+        username = self._run_adb_command(['shell', 'id'])
+        re_username = re.compile('uid=\d+\((.+?)\)')
+        return re_username.findall(username)[0]
+
+
+def main():
+    devices = GetAttachedDevices()
+    for device_serial in devices:
+        device_status = AndroidDeviceStatus(device_serial)
+
+        print 'Device %s (%s)' % (device_serial, device_status.device_type())
+        print '  Build: %s (%s)' % (device_status.device_build(), device_status.device_fingerprint())
+        print '  Battery: %s%%' % device_status.battery_level()
+        print '  Battery temp: %s' % device_status.battery_temperature()
+        print '  Username: %s' % device_status.username()
+        print ''
+
+
+if __name__ == '__main__':
+    sys.exit(main())
Property changes on: trunk/Tools/BuildSlaveSupport/chromium/output-android-device-status
___________________________________________________________________

Added: svn:executable

Modified: trunk/Tools/ChangeLog (133298 => 133299)


--- trunk/Tools/ChangeLog	2012-11-02 15:10:32 UTC (rev 133298)
+++ trunk/Tools/ChangeLog	2012-11-02 15:16:04 UTC (rev 133299)
@@ -1,3 +1,34 @@
+2012-11-02  Peter Beverloo  <pe...@chromium.org>
+
+        Output Android's device status before running tests on the bots
+        https://bugs.webkit.org/show_bug.cgi?id=100944
+
+        Reviewed by Dirk Pranke.
+
+        This adds a new step to the build master which will be run prior to the
+        actual tests-suites on the Chromium Android tester, and soon the Chromium
+        Android Perf bot. For each attached device, it outputs the build
+        information, battery level, battery temperature and username.
+
+        The Android tester currently is very flaky, and this will help tremendously
+        in being able to figure out what's wrong with the bot.
+
+        * BuildSlaveSupport/build.webkit.org-config/master.cfg:
+        (OutputAndroidDeviceStatus):
+        (TestFactory.__init__):
+        * BuildSlaveSupport/chromium/output-android-device-status: Added.
+        (GetAttachedDevices):
+        (AndroidDeviceStatus):
+        (AndroidDeviceStatus.__init__):
+        (AndroidDeviceStatus._run_adb_command):
+        (AndroidDeviceStatus.device_type):
+        (AndroidDeviceStatus.device_build):
+        (AndroidDeviceStatus.device_fingerprint):
+        (AndroidDeviceStatus.battery_level):
+        (AndroidDeviceStatus.battery_temperature):
+        (AndroidDeviceStatus.username):
+        (main):
+
 2012-11-02  Jocelyn Turcotte  <jocelyn.turco...@digia.com>
 
         [Qt] WTR: Make sure that eventSender.mouseDown sends a press event for the second press
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to