⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 136158 in webkit


Ignore:
Timestamp:
Nov 29, 2012, 1:27:32 PM (14 years ago)
Author:
peter@chromium.org
Message:

run-perf-tests --chromium-android should not require adb in my path
​https://bugs.webkit.org/show_bug.cgi?id=103581

Reviewed by Eric Seidel.

Remove the need to have "adb" available in the path for Layout and Performance
tests. We'll determine the versions of the "adb" version in path (if any) and
the one provided in the Chromium Android checkout. Unless the "adb" available
in the path is newer, the provided version will be used.

Some other minor nits addressed:

  • The path_to_forwarder/path_to_md5sum should not be in the "private overrides" section, as they're not overriding anything and are used by the driver.
  • Make _restart_adb_as_root slightly more robust by waiting for the device to come back online regardless of the output.
  • Scripts/webkitpy/layout_tests/port/chromium_android.py:

(ChromiumAndroidPort.init):
(ChromiumAndroidPort.check_build):
(ChromiumAndroidPort.path_to_adb):
(ChromiumAndroidPort):
(ChromiumAndroidPort.path_to_forwarder):
(ChromiumAndroidPort.path_to_md5sum):
(ChromiumAndroidPort._path_to_helper):
(ChromiumAndroidPort._determine_adb_version):
(ChromiumAndroidPort._get_devices):
(ChromiumAndroidDriver.init):
(ChromiumAndroidDriver._setup_md5sum_and_push_data_if_needed):
(ChromiumAndroidDriver._push_executable):
(ChromiumAndroidDriver._restart_adb_as_root):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r136152 r136158  
     12012-11-29  Peter Beverloo  <peter@chromium.org>
     2
     3        run-perf-tests --chromium-android should not require adb in my path
     4        https://bugs.webkit.org/show_bug.cgi?id=103581
     5
     6        Reviewed by Eric Seidel.
     7
     8        Remove the need to have "adb" available in the path for Layout and Performance
     9        tests. We'll determine the versions of the "adb" version in path (if any) and
     10        the one provided in the Chromium Android checkout. Unless the "adb" available
     11        in the path is newer, the provided version will be used.
     12
     13        Some other minor nits addressed:
     14        - The path_to_forwarder/path_to_md5sum should not be in the "private overrides"
     15          section, as they're not overriding anything and are used by the driver.
     16        - Make _restart_adb_as_root slightly more robust by waiting for the device
     17          to come back online regardless of the output.
     18
     19        * Scripts/webkitpy/layout_tests/port/chromium_android.py:
     20        (ChromiumAndroidPort.__init__):
     21        (ChromiumAndroidPort.check_build):
     22        (ChromiumAndroidPort.path_to_adb):
     23        (ChromiumAndroidPort):
     24        (ChromiumAndroidPort.path_to_forwarder):
     25        (ChromiumAndroidPort.path_to_md5sum):
     26        (ChromiumAndroidPort._path_to_helper):
     27        (ChromiumAndroidPort._determine_adb_version):
     28        (ChromiumAndroidPort._get_devices):
     29        (ChromiumAndroidDriver.__init__):
     30        (ChromiumAndroidDriver._setup_md5sum_and_push_data_if_needed):
     31        (ChromiumAndroidDriver._push_executable):
     32        (ChromiumAndroidDriver._restart_adb_as_root):
     33
    1342012-11-29  Martin Robinson  <mrobinson@igalia.com>
    235
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py

    r135930 r136158  
    3333import re
    3434import subprocess
     35import sys
    3536import threading
    3637import time
    … …  
    4344
    4445_log = logging.getLogger(__name__)
    45 
    4646
    4747# The root directory for test resources, which has the same structure as the
    … …  
    156156    port_name = 'chromium-android'
    157157
     158    # Avoid initializing the adb path [worker count]+1 times by storing it as a static member.
     159    _adb_path = None
     160
    158161    FALLBACK_PATHS = [
    159162        'chromium-android',
    … …  
    209212    def check_build(self, needs_http):
    210213        result = super(ChromiumAndroidPort, self).check_build(needs_http)
    211         result = self._check_file_exists(self._path_to_md5sum(), 'md5sum utility') and result
    212         result = self._check_file_exists(self._path_to_forwarder(), 'forwarder utility') and result
     214        result = self._check_file_exists(self.path_to_md5sum(), 'md5sum utility') and result
     215        result = self._check_file_exists(self.path_to_forwarder(), 'forwarder utility') and result
    213216        if not result:
    214217            _log.error('For complete Android build requirements, please see:')
    … …  
    261264        return self.create_driver(0)._drt_cmd_line(self.get_option('pixel_tests'), [])
    262265
     266    def path_to_adb(self):
     267        if ChromiumAndroidPort._adb_path:
     268            return ChromiumAndroidPort._adb_path
     269
     270        provided_adb_path = self.path_from_chromium_base('third_party', 'android_tools', 'sdk', 'platform-tools', 'adb')
     271
     272        path_version = self._determine_adb_version('adb')
     273        provided_version = self._determine_adb_version(provided_adb_path)
     274        assert provided_version, 'The checked in Android SDK is missing. Are you sure you ran update-webkit --chromium-android?'
     275
     276        if not path_version:
     277            ChromiumAndroidPort._adb_path = provided_adb_path
     278        elif provided_version > path_version:
     279            # FIXME: The Printer isn't initialized when this is called, so using _log would just show an unitialized logger error.
     280            print >> sys.stderr, 'The "adb" version in your path is older than the one checked in, consider updating your local Android SDK. Using the checked in one.'
     281            ChromiumAndroidPort._adb_path = provided_adb_path
     282        else:
     283            ChromiumAndroidPort._adb_path = 'adb'
     284
     285        return ChromiumAndroidPort._adb_path
     286
     287    def path_to_forwarder(self):
     288        return self._build_path('forwarder')
     289
     290    def path_to_md5sum(self):
     291        return self._build_path(MD5SUM_DEVICE_FILE_NAME)
     292
    263293    # Overridden private functions.
    264294
    … …  
    281311        return None
    282312
    283     def _path_to_forwarder(self):
    284         return self._build_path('forwarder')
    285 
    286     def _path_to_md5sum(self):
    287         return self._build_path(MD5SUM_DEVICE_FILE_NAME)
    288 
    289313    def _path_to_image_diff(self):
    290314        return self._host_port._path_to_image_diff()
    … …  
    309333
    310334    # Local private functions.
     335
     336    def _determine_adb_version(self, adb_path):
     337        re_version = re.compile('^.*version ([\d\.]+)$')
     338        try:
     339            output = self._executive.run_command([adb_path, 'version'], error_handler=self._executive.ignore_error)
     340        except OSError:
     341            return None
     342        result = re_version.match(output)
     343        if not output or not result:
     344            return None
     345        return [int(n) for n in result.group(1).split('.')]
    311346
    312347    def _get_devices(self):
    313348        if not self._devices:
    314349            re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE)
    315             result = self._executive.run_command(['adb', 'devices'], error_handler=self._executive.ignore_error)
     350            result = self._executive.run_command([self.path_to_adb(), 'devices'], error_handler=self._executive.ignore_error)
    316351            self._devices = re_device.findall(result)
    317352            if not self._devices:
    … …  
    339374        self._original_governors = {}
    340375        self._device_serial = port._get_device_serial(worker_number)
    341         self._adb_command = ['adb', '-s', self._device_serial]
     376        self._adb_command = [port.path_to_adb(), '-s', self._device_serial]
    342377
    343378    def __del__(self):
    … …  
    346381
    347382    def _setup_md5sum_and_push_data_if_needed(self):
    348         self._md5sum_path = self._port._path_to_md5sum()
     383        self._md5sum_path = self._port.path_to_md5sum()
    349384        if not self._file_exists_on_device(MD5SUM_DEVICE_PATH):
    350385            if not self._push_to_device(self._md5sum_path, MD5SUM_DEVICE_PATH):
    … …  
    404439
    405440    def _push_executable(self):
    406         self._push_file_if_needed(self._port._path_to_forwarder(), DEVICE_FORWARDER_PATH)
     441        self._push_file_if_needed(self._port.path_to_forwarder(), DEVICE_FORWARDER_PATH)
    407442        self._push_file_if_needed(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak')
    408443        self._push_file_if_needed(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources')
    … …  
    434469        if 'adbd is already running as root' in output:
    435470            return
    436         elif 'restarting adbd as root' in output:
    437             self._run_adb_command(['wait-for-device'])
    438         else:
     471        elif not 'restarting adbd as root' in output:
    439472            self._log_error('Unrecognized output from adb root: %s' % output)
     473
     474        # Regardless the output, give the device a moment to come back online.
     475        self._run_adb_command(['wait-for-device'])
    440476
    441477    def _run_adb_command(self, cmd, ignore_error=False):
Note: See TracChangeset for help on using the changeset viewer.