Changeset 178757 in webkit


Ignore:
Timestamp:
Jan 20, 2015 2:43:36 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Fix EWS python unit tests and address code comments as per 140476
https://bugs.webkit.org/show_bug.cgi?id=140637

Patch by Jake Nielsen <jacob_nielsen@apple.com> on 2015-01-20
Reviewed by David Kilzer.

  • Scripts/webkitpy/port/base.py:

(Port):
(Port.init):
Adds DEFAULT_ARCHITECTURE member.
(Port.architecture):
Removes architecture member and instead uses
self.get_option('architecture'). Also removes redundant architecture
method.
(Port.set_architecture):
Adds a setter for the architecture variable to be able to set a flag
upon modification.
(Port.test_configuration):
Uses self.architecture() instead of self._architecture.

  • Scripts/webkitpy/port/ios.py:

Overrides DEFAULT_ARCHITECTURE.
(IOSPort):
(IOSPort.determine_full_port_name):
Uses subprocess.check_output instead of Popen. Uses rstrip instead of
strip. Fixes regex to not match arbitrary characters after the
relevent digits are matched.
(IOSPort.init):
Removes old _architecture defaulting strategy.
(IOSPort._build_driver_flags):
Uses self.architecture() instead of self._architecture.
(IOSSimulatorPort):
Overrides DEFAULT_ARCHITECTURE.
(IOSSimulatorPort.init):
Removes old _architecture defaulting strategy.

  • Scripts/webkitpy/port/mac.py:

(MacPort):
Overrides DEFAULT_ARCHITECTURE.
(MacPort.init):
Removes old _architecture defaulting strategy.

  • Scripts/webkitpy/tool/commands/earlywarningsystem.py:

(AbstractEarlyWarningSystem.run_command):
Checks the did_override_architecture flag to determine whether to add
the --architecture option.

  • Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:

Uses ews.architecture rather than trying to discern the correct
architecture using a port object.
(EarlyWarningSystemTest._default_expected_logs):

  • Scripts/webkitpy/tool/commands/queues.py:

Removes use of optparse, and removes the import statement.
(AbstractQueue.init):
(PatchProcessingQueue.begin_work_queue):

Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r178720 r178757  
     12015-01-20  Jake Nielsen  <jacob_nielsen@apple.com>
     2
     3        Fix EWS python unit tests and address code comments as per 140476
     4        https://bugs.webkit.org/show_bug.cgi?id=140637
     5
     6        Reviewed by David Kilzer.
     7
     8        * Scripts/webkitpy/port/base.py:
     9        (Port):
     10        (Port.__init__):
     11        Adds DEFAULT_ARCHITECTURE member.
     12        (Port.architecture):
     13        Removes architecture member and instead uses
     14        self.get_option('architecture'). Also removes redundant architecture
     15        method.
     16        (Port.set_architecture):
     17        Adds a setter for the architecture variable to be able to set a flag
     18        upon modification.
     19        (Port.test_configuration):
     20        Uses self.architecture() instead of self._architecture.
     21        * Scripts/webkitpy/port/ios.py:
     22        Overrides DEFAULT_ARCHITECTURE.
     23        (IOSPort):
     24        (IOSPort.determine_full_port_name):
     25        Uses subprocess.check_output instead of Popen. Uses rstrip instead of
     26        strip. Fixes regex to not match arbitrary characters after the
     27        relevent digits are matched.
     28        (IOSPort.__init__):
     29        Removes old _architecture defaulting strategy.
     30        (IOSPort._build_driver_flags):
     31        Uses self.architecture() instead of self._architecture.
     32        (IOSSimulatorPort):
     33        Overrides DEFAULT_ARCHITECTURE.
     34        (IOSSimulatorPort.__init__):
     35        Removes old _architecture defaulting strategy.
     36        * Scripts/webkitpy/port/mac.py:
     37        (MacPort):
     38        Overrides DEFAULT_ARCHITECTURE.
     39        (MacPort.__init__):
     40        Removes old _architecture defaulting strategy.
     41        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
     42        (AbstractEarlyWarningSystem.run_command):
     43        Checks the did_override_architecture flag to determine whether to add
     44        the --architecture option.
     45        * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
     46        Uses ews.architecture rather than trying to discern the correct
     47        architecture using a port object.
     48        (EarlyWarningSystemTest._default_expected_logs):
     49        * Scripts/webkitpy/tool/commands/queues.py:
     50        Removes use of optparse, and removes the import statement.
     51        (AbstractQueue.__init__):
     52        (PatchProcessingQueue.begin_work_queue):
     53
    1542015-01-20  Sam Weinig  <sam@webkit.org>
    255
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r178622 r178757  
    7979    ALL_BUILD_TYPES = ('debug', 'release')
    8080
     81    DEFAULT_ARCHITECTURE = 'x86'
     82
    8183    @classmethod
    8284    def determine_full_port_name(cls, host, options, port_name):
     
    9799        # These are default values that should be overridden in a subclasses.
    98100        self._version = ''
    99         self._architecture = 'x86'
     101
     102        # FIXME: This can be removed once default architectures for GTK and EFL EWS bots are set.
     103        self.did_override_architecture = False
    100104
    101105        # FIXME: Ideally we'd have a package-wide way to get a
     
    103107        # options defined on it.
    104108        self._options = options or optparse.Values()
     109
     110        if self.get_option('architecture'):
     111            self.did_override_architecture = True
     112        else:
     113            self.set_option('architecture', self.DEFAULT_ARCHITECTURE)
    105114
    106115        if self._name and '-wk2' in self._name:
     
    129138
    130139    def architecture(self):
    131         return self._architecture
     140        return self.get_option('architecture')
     141
     142    def set_architecture(self, arch):
     143        self.did_override_architecture = True
     144        self.set_option('architecture', arch)
    132145
    133146    def additional_drt_flag(self):
     
    714727        return self._version
    715728
    716     def architecture(self):
    717         return self._architecture
    718 
    719729    def get_option(self, name, default_value=None):
    720730        return getattr(self._options, name, default_value)
     
    924934        """Returns the current TestConfiguration for the port."""
    925935        if not self._test_configuration:
    926             self._test_configuration = TestConfiguration(self._version, self._architecture, self._options.configuration.lower())
     936            self._test_configuration = TestConfiguration(self._version, self.architecture(), self._options.configuration.lower())
    927937        return self._test_configuration
    928938
  • trunk/Tools/Scripts/webkitpy/port/ios.py

    r178641 r178757  
    4747
    4848    ARCHITECTURES = ['armv7', 'armv7s', 'arm64']
    49     VERSION_FALLBACK_ORDER = ['ios-7', 'ios-8']
     49    DEFAULT_ARCHITECTURE = 'armv7'
     50    VERSION_FALLBACK_ORDER = ['ios-7', 'ios-8', 'ios-9']
    5051
    5152    @classmethod
     
    5455            sdk_version = '8.0'
    5556            if host.platform.is_mac():
    56                 sdk_command_process = subprocess.Popen('xcrun --sdk iphoneos --show-sdk-version', stdout=subprocess.PIPE, stderr=None, shell=True)
    57                 sdk_command_output = sdk_command_process.communicate()[0].strip()
     57                sdk_command_output = subprocess.check_output(['/usr/bin/xcrun', '--sdk', 'iphoneos', '--show-sdk-version'], stderr=None).rstrip()
    5858                if sdk_command_output:
    5959                    sdk_version = sdk_command_output
    6060
    61             port_name = port_name + '-' + re.match('^([0-9]+).*', sdk_version).group(1)
     61            port_name = port_name + '-' + re.match('^([0-9]+)', sdk_version).group(1)
    6262
    6363        return port_name
     
    6666        super(IOSPort, self).__init__(*args, **kwargs)
    6767
    68         self._architecture = self.get_option('architecture')
    69 
    70         if not self._architecture:
    71             self._architecture = 'armv7'
    72 
    7368        self._testing_device = None
    7469
    7570    # Despite their names, these flags do not actually get passed all the way down to webkit-build.
    7671    def _build_driver_flags(self):
    77         return ['--sdk', 'iphoneos'] + (['ARCHS=%s' % self._architecture] if self._architecture else [])
     72        return ['--sdk', 'iphoneos'] + (['ARCHS=%s' % self.architecture()] if self.architecture() else [])
    7873
    7974    def operating_system(self):
     
    8883    ARCHITECTURES = ['x86_64', 'x86']
    8984
     85    DEFAULT_ARCHITECTURE = 'x86_64'
     86
    9087    relay_name = 'LayoutTestRelay'
    9188
    9289    def __init__(self, *args, **kwargs):
    9390        super(IOSSimulatorPort, self).__init__(*args, **kwargs)
    94 
    95         self._architecture = self.get_option('architecture')
    96 
    97         if not self._architecture:
    98             self._architecture = 'x86_64'
    9991
    10092        self._leak_detector = LeakDetector(self)
  • trunk/Tools/Scripts/webkitpy/port/mac.py

    r177028 r178757  
    4949    ARCHITECTURES = ['x86_64', 'x86']
    5050
     51    DEFAULT_ARCHITECTURE = 'x86_64'
     52
    5153    def __init__(self, host, port_name, **kwargs):
    5254        ApplePort.__init__(self, host, port_name, **kwargs)
    53         self._architecture = self.get_option('architecture')
    54 
    55         if not self._architecture:
    56             self._architecture = 'x86_64'
    5755
    5856        self._leak_detector = LeakDetector(self)
  • trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py

    r178622 r178757  
    109109
    110110    def run_command(self, command):
    111         self.run_webkit_patch(command + [self._deprecated_port.flag()] + (['--architecture=%s' % self._port.architecture()] if self._port.architecture() else []))
     111        self.run_webkit_patch(command + [self._deprecated_port.flag()] + (['--architecture=%s' % self._port.architecture()] if self._port.architecture() and self._port.did_override_architecture else []))
    112112
    113113    def command_passed(self, message, patch):
  • trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py

    r178622 r178757  
    6161class EarlyWarningSystemTest(QueuesTest):
    6262    def _default_expected_logs(self, ews):
    63         host = Host()
    64         real_port_name = PatchProcessingQueue()._new_port_name_from_old(ews.port_name, host.platform)
    65         real_port = Host().port_factory.get(real_port_name)
    6663        string_replacements = {
    6764            "name": ews.name,
    6865            "port": ews.port_name,
    69             "architecture": real_port.architecture(),
     66            "architecture": " --architecture=%s" % ews.architecture if ews.architecture else "",
    7067        }
    7168        if ews.run_tests:
    72             run_tests_line = "Running: webkit-patch --status-host=example.com build-and-test --no-clean --no-update --test --non-interactive --port=%(port)s --architecture=%(architecture)s\n" % string_replacements
     69            run_tests_line = "Running: webkit-patch --status-host=example.com build-and-test --no-clean --no-update --test --non-interactive --port=%(port)s%(architecture)s\n" % string_replacements
    7370        else:
    7471            run_tests_line = ""
     
    7774        expected_logs = {
    7875            "begin_work_queue": self._default_begin_work_queue_logs(ews.name),
    79             "process_work_item": """Running: webkit-patch --status-host=example.com clean --port=%(port)s --architecture=%(architecture)s
    80 Running: webkit-patch --status-host=example.com update --port=%(port)s --architecture=%(architecture)s
    81 Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 --port=%(port)s --architecture=%(architecture)s
    82 Running: webkit-patch --status-host=example.com build --no-clean --no-update --build-style=release --port=%(port)s --architecture=%(architecture)s
     76            "process_work_item": """Running: webkit-patch --status-host=example.com clean --port=%(port)s%(architecture)s
     77Running: webkit-patch --status-host=example.com update --port=%(port)s%(architecture)s
     78Running: webkit-patch --status-host=example.com apply-attachment --no-update --non-interactive 10000 --port=%(port)s%(architecture)s
     79Running: webkit-patch --status-host=example.com build --no-clean --no-update --build-style=release --port=%(port)s%(architecture)s
    8380%(run_tests_line)sMOCK: update_status: %(name)s Pass
    8481MOCK: release_work_item: %(name)s 10000
  • trunk/Tools/Scripts/webkitpy/tool/commands/queues.py

    r178622 r178757  
    3030import codecs
    3131import logging
    32 import optparse
    3332import os
    3433import re
     
    7675        Command.__init__(self, options=options_list)
    7776        self._iteration_count = 0
    78         self.architecture = None
     77        if not hasattr(self, 'architecture'):
     78            self.architecture = None
    7979
    8080    def _cc_watchers(self, bug_id):
     
    278278        # FIXME: This violates abstraction
    279279        self._tool._deprecated_port = self._deprecated_port
    280         port_options = optparse.Values()
     280
     281        self._port = self._tool.port_factory.get(self._new_port_name_from_old(self.port_name, self._tool.platform))
    281282        if self.architecture:
    282             setattr(port_options, 'architecture', self.architecture)
    283         self._port = self._tool.port_factory.get(self._new_port_name_from_old(self.port_name, self._tool.platform), port_options)
     283            self._port.set_architecture(self.architecture)
    284284
    285285    def _upload_results_archive_for_patch(self, patch, results_archive_zip):
Note: See TracChangeset for help on using the changeset viewer.