WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-166660-20170103141937.patch (text/plain), 16.48 KB, created by
Jonathan Bedard
on 2017-01-03 14:21:02 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jonathan Bedard
Created:
2017-01-03 14:21:02 PST
Size:
16.48 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 210247) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,35 @@ >+2017-01-03 Jonathan Bedard <jbedard@apple.com> >+ >+ Add IOSDevice, share functionality with IOSSimulator in IOSBase >+ https://bugs.webkit.org/show_bug.cgi?id=166660 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkitpy/port/darwin.py: >+ (DarwinPort.extractBundleID): Search an app bundle for a plist and bundle ID. >+ * Scripts/webkitpy/port/factory.py: >+ (PortFactory): Change IOSPort to IOSDevice. >+ * Scripts/webkitpy/port/ios.py: >+ (IOSBase): Base class for IOSDevice and IOSSimulator port. >+ (IOSBase.driver_name): Moved from IOSSimulatorPort. >+ (IOSBase._get_crash_log): Moved from IOSSimulatorPort. >+ (IOSBase._testing_device): Access devices by index. >+ (IOSBase.device_id_for_worker_number): Moved from IOSSimulatorPort. >+ (IOSDevice): Class representing physical iOS devices. >+ (IOSSimulatorPort): >+ (IOSSimulatorPort.__init__): Clean up unused variable. >+ (IOSSimulatorPort.driver_name): Moved to IOSBase. >+ (IOSSimulatorPort._get_crash_log): Moved to IOSBase. >+ (IOSSimulatorPort.device_id_for_worker_number): Moved to IOSBase. >+ * Scripts/webkitpy/port/ios_unittest.py: >+ (IOSTest): Added IOSDevice port testing. >+ (IOSSimulatorTest): Adopted old functions from iosTest. >+ (IOSSimulatorTest.make_port): Adjusted to inherit from IOSBaseTest. >+ (IOSSimulatorTest.test_get_crash_log(self): Moved to IOSBaseTest. >+ * Scripts/webkitpy/port/iosbase_testcase.py: Added. >+ (IOSBaseTest): Shared testing for IOSSimulator and IOSTest. >+ (IOSBaseTest.test_get_crash_log): Moved from IOSSimulatorTest. >+ > 2017-01-03 Michael Catanzaro <mcatanzaro@igalia.com> > > [GTK] Expose WebKitSecurityOrigin API >Index: Tools/Scripts/webkitpy/port/darwin.py >=================================================================== >--- Tools/Scripts/webkitpy/port/darwin.py (revision 210239) >+++ Tools/Scripts/webkitpy/port/darwin.py (working copy) >@@ -174,3 +174,6 @@ class DarwinPort(ApplePort): > except ScriptError: > _log.warn("xcrun failed; falling back to '%s'." % fallback) > return fallback >+ >+ def extractBundleID(self, app): >+ return self._executive.run_command(['/usr/libexec/PlistBuddy', '-c', '"Print CFBundleIdentifier"', 'Info.plist'], return_stderr=False) >Index: Tools/Scripts/webkitpy/port/factory.py >=================================================================== >--- Tools/Scripts/webkitpy/port/factory.py (revision 210239) >+++ Tools/Scripts/webkitpy/port/factory.py (working copy) >@@ -81,16 +81,16 @@ class PortFactory(object): > # Order matters. For port classes that have a port_name with a > # common prefix, the more specific port class should be listed > # first. For example, 'ios.IOSSimulatorPort' (port_name='ios-simulator') >- # should be listed before 'ios.IOSPort' (port_name='ios'). If this >+ # should be listed before 'ios.IOSDevice' (port_name='ios'). If this > # rule is not followed, then `webkit-patch --ios-simulator` will try >- # to use IOSPort instead of IOSSimulatorPort because 'ios' >- # (IOSPort.port_name) is a prefix of 'ios-simulator' (port_name >+ # to use IOSDevice instead of IOSSimulatorPort because 'ios' >+ # (IOSDevice.port_name) is a prefix of 'ios-simulator' (port_name > # derived from '--ios-simulator' command-line switch), for example. > PORT_CLASSES = ( > 'efl.EflPort', > 'gtk.GtkPort', > 'ios.IOSSimulatorPort', >- 'ios.IOSPort', >+ 'ios.IOSDevice', > 'mac.MacPort', > 'mock_drt.MockDRTPort', > 'test.TestPort', >Index: Tools/Scripts/webkitpy/port/ios.py >=================================================================== >--- Tools/Scripts/webkitpy/port/ios.py (revision 210239) >+++ Tools/Scripts/webkitpy/port/ios.py (working copy) >@@ -41,7 +41,75 @@ from webkitpy.common.system.crashlogs im > _log = logging.getLogger(__name__) > > >-class IOSPort(DarwinPort): >+class IOSBase(DarwinPort): >+ >+ SUBPROCESS_CRASH_REGEX = re.compile('#CRASHED - (?P<subprocess_name>\S+) \(pid (?P<subprocess_pid>\d+)\)') >+ >+ def __init__(self, host, port_name, **kwargs): >+ DarwinPort.__init__(self, host, port_name, **kwargs) >+ self._printing_cmd_line = False >+ self._current_device = None >+ >+ def driver_name(self): >+ if self.get_option('driver_name'): >+ return self.get_option('driver_name') >+ if self.get_option('webkit_test_runner'): >+ return 'WebKitTestRunnerApp.app' >+ return 'DumpRenderTree.app' >+ >+ def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=time.time, sleep_fn=time.sleep, wait_for_log=True): >+ time_fn = time_fn or time.time >+ sleep_fn = sleep_fn or time.sleep >+ >+ # FIXME: We should collect the actual crash log for DumpRenderTree.app because it includes more >+ # information (e.g. exception codes) than is available in the stack trace written to standard error. >+ stderr_lines = [] >+ crashed_subprocess_name_and_pid = None # e.g. ('DumpRenderTree.app', 1234) >+ for line in (stderr or '').splitlines(): >+ if not crashed_subprocess_name_and_pid: >+ match = self.SUBPROCESS_CRASH_REGEX.match(line) >+ if match: >+ crashed_subprocess_name_and_pid = (match.group('subprocess_name'), int(match.group('subprocess_pid'))) >+ continue >+ stderr_lines.append(line) >+ >+ if crashed_subprocess_name_and_pid: >+ return self._get_crash_log(crashed_subprocess_name_and_pid[0], crashed_subprocess_name_and_pid[1], stdout, >+ '\n'.join(stderr_lines), newer_than, time_fn, sleep_fn, wait_for_log) >+ >+ _log.debug('looking for crash log for %s:%s' % (name, str(pid))) >+ crash_log = '' >+ crash_logs = CrashLogs(self.host) >+ now = time_fn() >+ deadline = now + 5 * int(self.get_option('child_processes', 1)) >+ while not crash_log and now <= deadline: >+ crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than) >+ if not wait_for_log: >+ break >+ if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]: >+ sleep_fn(0.1) >+ now = time_fn() >+ >+ if not crash_log: >+ return stderr, None >+ return stderr, crash_log >+ >+ def _using_dedicated_simulators(self): >+ return self.get_option('dedicated_simulators') >+ >+ def _testing_device(self, number): >+ return None >+ >+ # This is only exposed so that IOSSimulatorDriver can use it. >+ def device_id_for_worker_number(self, number): >+ if self._printing_cmd_line: >+ return '<dummy id>' >+ if self._using_dedicated_simulators(): >+ return self._testing_device(number).udid >+ return self._current_device.udid >+ >+ >+class IOSDevice(IOSBase): > port_name = "ios" > > ARCHITECTURES = ['armv7', 'armv7s', 'arm64'] >@@ -66,7 +134,7 @@ class IOSPort(DarwinPort): > return 'ios' > > >-class IOSSimulatorPort(DarwinPort): >+class IOSSimulatorPort(IOSBase): > port_name = "ios-simulator" > > FUTURE_VERSION = 'future' >@@ -96,10 +164,9 @@ class IOSSimulatorPort(DarwinPort): > } > > def __init__(self, host, port_name, **kwargs): >- DarwinPort.__init__(self, host, port_name, **kwargs) >+ IOSBase.__init__(self, host, port_name, **kwargs) > > optional_device_class = self.get_option('device_class') >- self._printing_cmd_line = False > self._device_class = optional_device_class if optional_device_class else self.DEFAULT_DEVICE_CLASS > _log.debug('IOSSimulatorPort _device_class is %s', self._device_class) > >@@ -111,13 +178,6 @@ class IOSSimulatorPort(DarwinPort): > _log.warn('Cannot have more than one child process when using a running simulator. Setting child_processes to 1.') > self.set_option('child_processes', 1) > >- def driver_name(self): >- if self.get_option('driver_name'): >- return self.get_option('driver_name') >- if self.get_option('webkit_test_runner'): >- return 'WebKitTestRunnerApp.app' >- return 'DumpRenderTree.app' >- > def driver_cmd_line_for_logging(self): > # Avoid spinning up devices just for logging the commandline. > self._printing_cmd_line = True >@@ -195,44 +255,6 @@ class IOSSimulatorPort(DarwinPort): > return False > return True > >- def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=time.time, sleep_fn=time.sleep, wait_for_log=True): >- time_fn = time_fn or time.time >- sleep_fn = sleep_fn or time.sleep >- >- # FIXME: We should collect the actual crash log for DumpRenderTree.app because it includes more >- # information (e.g. exception codes) than is available in the stack trace written to standard error. >- stderr_lines = [] >- crashed_subprocess_name_and_pid = None # e.g. ('DumpRenderTree.app', 1234) >- for line in (stderr or '').splitlines(): >- if not crashed_subprocess_name_and_pid: >- match = self.SUBPROCESS_CRASH_REGEX.match(line) >- if match: >- crashed_subprocess_name_and_pid = (match.group('subprocess_name'), int(match.group('subprocess_pid'))) >- continue >- stderr_lines.append(line) >- >- if crashed_subprocess_name_and_pid: >- return self._get_crash_log(crashed_subprocess_name_and_pid[0], crashed_subprocess_name_and_pid[1], stdout, >- '\n'.join(stderr_lines), newer_than, time_fn, sleep_fn, wait_for_log) >- >- # LayoutTestRelay crashed >- _log.debug('looking for crash log for %s:%s' % (name, str(pid))) >- crash_log = '' >- crash_logs = CrashLogs(self.host) >- now = time_fn() >- deadline = now + 5 * int(self.get_option('child_processes', 1)) >- while not crash_log and now <= deadline: >- crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than) >- if not wait_for_log: >- break >- if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]: >- sleep_fn(0.1) >- now = time_fn() >- >- if not crash_log: >- return stderr, None >- return stderr, crash_log >- > def _build_relay(self): > environment = self.host.copy_current_environment() > environment.disable_gcc_smartquotes() >@@ -399,11 +421,6 @@ class IOSSimulatorPort(DarwinPort): > return False > return super(IOSSimulatorPort, self).check_sys_deps(needs_http) > >- SUBPROCESS_CRASH_REGEX = re.compile('#CRASHED - (?P<subprocess_name>\S+) \(pid (?P<subprocess_pid>\d+)\)') >- >- def _using_dedicated_simulators(self): >- return self.get_option('dedicated_simulators') >- > def _create_device(self, number): > return Simulator.create_device(number, self.simulator_device_type(), self.simulator_runtime) > >@@ -413,14 +430,6 @@ class IOSSimulatorPort(DarwinPort): > def _testing_device(self, number): > return Simulator.device_number(number) > >- # This is only exposed so that IOSSimulatorDriver can use it. >- def device_id_for_worker_number(self, number): >- if self._printing_cmd_line: >- return '<dummy id>' >- if self._using_dedicated_simulators(): >- return self._testing_device(number).udid >- return self._current_device.udid >- > def get_simulator_path(self, suffix=""): > return os.path.join(self.SIMULATOR_DIRECTORY, "Simulator" + str(suffix) + ".app") > >Index: Tools/Scripts/webkitpy/port/ios_unittest.py >=================================================================== >--- Tools/Scripts/webkitpy/port/ios_unittest.py (revision 210239) >+++ Tools/Scripts/webkitpy/port/ios_unittest.py (working copy) >@@ -22,8 +22,9 @@ > > import time > >+from webkitpy.port.ios import IOSDevice > from webkitpy.port.ios import IOSSimulatorPort >-from webkitpy.port import darwin_testcase >+from webkitpy.port import iosbase_testcase > from webkitpy.common.system.filesystem_mock import MockFileSystem > from webkitpy.common.system.outputcapture import OutputCapture > from webkitpy.tool.mocktool import MockOptions >@@ -31,7 +32,20 @@ from webkitpy.common.system.executive_mo > from webkitpy.common.system.systemhost_mock import MockSystemHost > > >-class iosTest(darwin_testcase.DarwinTest): >+class IOSTest(iosbase_testcase.IOSBaseTest): >+ os_name = 'ios' >+ os_version = '' >+ port_name = 'ios' >+ port_maker = IOSDevice >+ is_simulator = False >+ >+ def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs): >+ port = super(IOSTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs) >+ port.set_option('child_processes', 1) >+ return port >+ >+ >+class IOSSimulatorTest(iosbase_testcase.IOSBaseTest): > os_name = 'ios-simulator' > os_version = '' > port_name = 'ios-simulator' >@@ -39,7 +53,7 @@ class iosTest(darwin_testcase.DarwinTest > is_simulator = True > > def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs): >- port = super(iosTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs) >+ port = super(IOSSimulatorTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs) > port.set_option('child_processes', 1) > return port > >@@ -53,14 +67,6 @@ class iosTest(darwin_testcase.DarwinTest > def test_operating_system(self): > self.assertEqual('ios-simulator', self.make_port().operating_system()) > >- def test_get_crash_log(self): >- # Mac crash logs are tested elsewhere, so here we just make sure we don't crash. >- def fake_time_cb(): >- times = [0, 20, 40] >- return lambda: times.pop(0) >- port = self.make_port(port_name='ios-simulator') >- port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False) >- > def test_32bit(self): > port = self.make_port(options=MockOptions(architecture='x86')) > >Index: Tools/Scripts/webkitpy/port/iosbase_testcase.py >=================================================================== >--- Tools/Scripts/webkitpy/port/iosbase_testcase.py (nonexistent) >+++ Tools/Scripts/webkitpy/port/iosbase_testcase.py (working copy) >@@ -0,0 +1,36 @@ >+# Copyright (C) 2014-2016 Apple 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. AND ITS CONTRIBUTORS ``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 ITS 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 time >+ >+from webkitpy.port import darwin_testcase >+ >+ >+class IOSBaseTest(darwin_testcase.DarwinTest): >+ >+ def test_get_crash_log(self): >+ # Mac crash logs are tested elsewhere, so here we just make sure we don't crash. >+ def fake_time_cb(): >+ times = [0, 20, 40] >+ return lambda: times.pop(0) >+ port = self.make_port(port_name='ios-simulator') >+ port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 166660
:
297952
|
298014