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-165927-20170119164911.patch (text/plain), 28.36 KB, created by
Jonathan Bedard
on 2017-01-19 16:51:03 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jonathan Bedard
Created:
2017-01-19 16:51:03 PST
Size:
28.36 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 210936) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,60 @@ >+2017-01-19 Jonathan Bedard <jbedard@apple.com> >+ >+ Removing LayoutTestRelay >+ https://bugs.webkit.org/show_bug.cgi?id=165927 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * LayoutTestRelay: Removed LayoutTestRelay. >+ * Makefile: Removed LayoutTestRelay references. >+ * Scripts/build-webkit: Removed LayoutTestRelay references. >+ * Scripts/webkitpy/port/base.py: >+ (Port.__init__): Added _test_runner_process_constructor. >+ * Scripts/webkitpy/port/darwin.py: >+ (DarwinPort.app_identifier_from_bundle): Added function to extract bundle ID from plist. >+ * Scripts/webkitpy/port/driver.py: >+ (Driver._start): Pass worker_number server_process. >+ (IOSSimulatorDriver): Deleted. >+ * Scripts/webkitpy/port/driver_unittest.py: >+ (DriverTest.test_stop_cleans_up_properly): Set _test_runner_process_constructor for testing. >+ (DriverTest.test_two_starts_cleans_up_properly): Ditto. >+ (DriverTest.test_start_actually_starts): Ditto. >+ * Scripts/webkitpy/port/ios.py: >+ (IOSSimulatorPort): Remove relay_name. >+ (IOSSimulatorPort.__init__): Set _test_runner_process_constructor for IOSSimulators. >+ (IOSSimulatorPort._create_simulators): Formatting change. >+ (IOSSimulatorPort.relay_path): Deleted. >+ (IOSSimulatorPort._check_relay): Use base class. >+ (IOSSimulatorPort._check_port_build): Deleted. >+ (IOSSimulatorPort._build_relay): Deleted. >+ (IOSSimulatorPort._build_driver): Deleted. >+ (IOSSimulatorPort._driver_class): Use base class. >+ * Scripts/webkitpy/port/ios_unittest.py: >+ (iosTest.test_32bit): Update test. >+ (iosTest.test_64bit): Update test. >+ * Scripts/webkitpy/port/server_process.py: >+ (ServerProcess.__init__): Accept worker_number. >+ (ServerProcess._set_file_nonblocking): Added to share common code. >+ (ServerProcess.write): Flush after writing. >+ * Scripts/webkitpy/port/server_process_mock.py: >+ (MockServerProcess.__init__): Accept worker_number. >+ * Scripts/webkitpy/port/simulator_process.py: Added. >+ (SimulatorProcess): >+ (SimulatorProcess.SimulatorProcessPopen): >+ (SimulatorProcess.SimulatorProcessPopen.__init__): Set-up open structure with empty arguments. >+ (SimulatorProcess.SimulatorProcessPopen.poll): Check if the process is running. >+ (SimulatorProcess.SimulatorProcessPopen.wait): Wait for target process to close. >+ (SimulatorProcess.__init__): Install app to device. >+ (SimulatorProcess.__unlink_check_exists): Unlink file, throw error if this fails. >+ (SimulatorProcess._reset): Unlink fifos. >+ (SimulatorProcess._start): Launch app on simulator, link fifos. >+ (SimulatorProcess._kill): Shutdown app on simulator >+ * Scripts/webkitpy/xcode/simulator.py: >+ (Device.__init__): Accept host to run install/launch/terminate. >+ (Device.install_app): Install app to target device. >+ (Device.launch_app): Launch app on target device. >+ (Device.terminate_app): Shutdown app on target device. >+ > 2017-01-19 Myles C. Maxfield <mmaxfield@apple.com> > > [Cocoa] Variation fonts are erroneously disabled on iOS >Index: Tools/Makefile >=================================================================== >--- Tools/Makefile (revision 210936) >+++ Tools/Makefile (working copy) >@@ -7,9 +7,6 @@ ifneq (,$(SDKROOT)) > ifneq (,$(findstring iphone,$(SDKROOT))) > MODULES += MobileMiniBrowser > endif >- ifeq (,$(DO_NOT_BUILD_LAYOUT_TEST_RELAY)) >- MODULES += LayoutTestRelay >- endif > endif > > all: >Index: Tools/Scripts/build-webkit >=================================================================== >--- Tools/Scripts/build-webkit (revision 210936) >+++ Tools/Scripts/build-webkit (working copy) >@@ -200,10 +200,6 @@ if (isAppleMacWebKit()) { > push @copyLibrariesArgs, productDir(); > print(join(" ", @copyLibrariesArgs) . "\n"); > (system(@copyLibrariesArgs) == 0) or die; >- >- if (willUseIOSSimulatorSDK()) { >- (system("perl", "Tools/Scripts/build-layouttestrelay", argumentsForConfiguration()) == 0) or die; >- } > } > > # Build Tools needed for Apple ports >Index: Tools/Scripts/webkitpy/port/base.py >=================================================================== >--- Tools/Scripts/webkitpy/port/base.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/base.py (working copy) >@@ -131,6 +131,7 @@ class Port(object): > self._web_platform_test_server = None > self._image_differ = None > self._server_process_constructor = server_process.ServerProcess # overridable for testing >+ self._test_runner_process_constructor = server_process.ServerProcess > > if not hasattr(options, 'configuration') or not options.configuration: > self.set_option_default('configuration', self.default_configuration()) >Index: Tools/Scripts/webkitpy/port/darwin.py >=================================================================== >--- Tools/Scripts/webkitpy/port/darwin.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/darwin.py (working copy) >@@ -174,3 +174,11 @@ class DarwinPort(ApplePort): > except ScriptError: > _log.warn("xcrun failed; falling back to '%s'." % fallback) > return fallback >+ >+ def app_identifier_from_bundle(self, app_bundle): >+ plist_path = self._filesystem.join(app_bundle, 'Info.plist') >+ if not self._filesystem.exists(plist_path): >+ plist_path = self._filesystem.join(app_bundle, 'Contents/Info.plist') >+ if not self._filesystem.exists(plist_path): >+ return None >+ return self._executive.run_command(['/usr/libexec/PlistBuddy', '-c', 'Print CFBundleIdentifier', plist_path]).rstrip() >Index: Tools/Scripts/webkitpy/port/driver.py >=================================================================== >--- Tools/Scripts/webkitpy/port/driver.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/driver.py (working copy) >@@ -138,7 +138,7 @@ class Driver(object): > self._driver_user_directory_suffix = None > self._driver_user_cache_directory = None > >- # WebKitTestRunner/LayoutTestRelay can report back subprocess crashes by printing >+ # WebKitTestRunner can report back subprocess crashes by printing > # "#CRASHED - PROCESSNAME". Since those can happen at any time and ServerProcess > # won't be aware of them (since the actual tool didn't crash, just a subprocess) > # we record the crashed subprocess name here. >@@ -327,7 +327,6 @@ class Driver(object): > > def _setup_environ_for_driver(self, environment): > build_root_path = str(self._port._build_path()) >- # FIXME: DYLD_* variables should be Mac-only. Even iOS Simulator doesn't need them, as LayoutTestRelay is a host binary. > self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path) > self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path) > self._append_environment_variable_path(environment, 'DYLD_FRAMEWORK_PATH', build_root_path) >@@ -369,7 +368,7 @@ class Driver(object): > environment = self._setup_environ_for_test() > self._crashed_process_name = None > self._crashed_pid = None >- self._server_process = self._port._server_process_constructor(self._port, self._server_name, self.cmd_line(pixel_tests, per_test_args), environment) >+ self._server_process = self._port._test_runner_process_constructor(self._port, self._server_name, self.cmd_line(pixel_tests, per_test_args), environment, worker_number=self._worker_number) > self._server_process.start() > > def _run_post_start_tasks(self): >@@ -611,27 +610,6 @@ class Driver(object): > return True > > >-# FIXME: this should be abstracted out via the Port subclass somehow. >-class IOSSimulatorDriver(Driver): >- def cmd_line(self, pixel_tests, per_test_args): >- cmd = super(IOSSimulatorDriver, self).cmd_line(pixel_tests, per_test_args) >- relay_tool = self._port.relay_path >- dump_tool = cmd[0] >- dump_tool_args = cmd[1:] >- product_dir = self._port._build_path() >- relay_args = [ >- '-developerDir', self._port.developer_dir, >- '-udid', self._port.device_id_for_worker_number(self._worker_number), >- '-productDir', product_dir, >- '-app', dump_tool, >- ] >- return [relay_tool] + relay_args + ['--'] + dump_tool_args >- >- def _setup_environ_for_driver(self, environment): >- environment['DEVELOPER_DIR'] = self._port.developer_dir >- return super(IOSSimulatorDriver, self)._setup_environ_for_driver(environment) >- >- > class ContentBlock(object): > def __init__(self): > self.content_type = None >Index: Tools/Scripts/webkitpy/port/driver_unittest.py >=================================================================== >--- Tools/Scripts/webkitpy/port/driver_unittest.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/driver_unittest.py (working copy) >@@ -264,7 +264,7 @@ class DriverTest(unittest.TestCase): > > def test_stop_cleans_up_properly(self): > port = TestWebKitPort() >- port._server_process_constructor = MockServerProcess >+ port._test_runner_process_constructor = MockServerProcess > driver = Driver(port, 0, pixel_tests=True) > driver.start(True, []) > last_tmpdir = port._filesystem.last_tmpdir >@@ -274,7 +274,7 @@ class DriverTest(unittest.TestCase): > > def test_two_starts_cleans_up_properly(self): > port = TestWebKitPort() >- port._server_process_constructor = MockServerProcess >+ port._test_runner_process_constructor = MockServerProcess > driver = Driver(port, 0, pixel_tests=True) > driver.start(True, []) > last_tmpdir = port._filesystem.last_tmpdir >@@ -283,7 +283,7 @@ class DriverTest(unittest.TestCase): > > def test_start_actually_starts(self): > port = TestWebKitPort() >- port._server_process_constructor = MockServerProcess >+ port._test_runner_process_constructor = MockServerProcess > driver = Driver(port, 0, pixel_tests=True) > driver.start(True, []) > self.assertTrue(driver._server_process.started) >Index: Tools/Scripts/webkitpy/port/ios.py >=================================================================== >--- Tools/Scripts/webkitpy/port/ios.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/ios.py (working copy) >@@ -34,6 +34,7 @@ from webkitpy.layout_tests.models.test_c > from webkitpy.port import config as port_config > from webkitpy.port import driver, image_diff > from webkitpy.port.darwin import DarwinPort >+from webkitpy.port.simulator_process import SimulatorProcess > from webkitpy.xcode.simulator import Simulator, Runtime, DeviceType > from webkitpy.common.system.crashlogs import CrashLogs > >@@ -78,7 +79,6 @@ class IOSSimulatorPort(DarwinPort): > SDK = 'iphonesimulator' > > SIMULATOR_BUNDLE_ID = 'com.apple.iphonesimulator' >- relay_name = 'LayoutTestRelay' > SIMULATOR_DIRECTORY = "/tmp/WebKitTestingSimulators/" > LSREGISTER_PATH = "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/Current/Support/lsregister" > PROCESS_COUNT_ESTIMATE_PER_SIMULATOR_INSTANCE = 100 >@@ -97,6 +97,7 @@ class IOSSimulatorPort(DarwinPort): > > def __init__(self, host, port_name, **kwargs): > DarwinPort.__init__(self, host, port_name, **kwargs) >+ self._test_runner_process_constructor = SimulatorProcess > > optional_device_class = self.get_option('device_class') > self._printing_cmd_line = False >@@ -148,16 +149,6 @@ class IOSSimulatorPort(DarwinPort): > device_type = DeviceType.from_name(device_name) > return device_type > >- @property >- @memoized >- def relay_path(self): >- if self._root_was_set: >- path = self._filesystem.abspath(self.get_option('root')) >- else: >- mac_config = port_config.Config(self._executive, self._filesystem, 'mac') >- path = mac_config.build_directory(self.get_option('configuration')) >- return self._filesystem.join(path, self.relay_name) >- > @memoized > def child_processes(self): > return int(self.get_option('child_processes')) >@@ -182,19 +173,6 @@ class IOSSimulatorPort(DarwinPort): > > return min(maximum_simulator_count_on_this_system, best_child_process_count_for_cpu) > >- def _check_relay(self): >- if not self._filesystem.exists(self.relay_path): >- _log.error("%s was not found at %s" % (self.relay_name, self.relay_path)) >- return False >- return True >- >- def _check_port_build(self): >- if not self._root_was_set and self.get_option('build') and not self._build_relay(): >- return False >- if not self._check_relay(): >- 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 >@@ -215,7 +193,7 @@ class IOSSimulatorPort(DarwinPort): > 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 >+ # App crashed > _log.debug('looking for crash log for %s:%s' % (name, str(pid))) > crash_log = '' > crash_logs = CrashLogs(self.host) >@@ -233,25 +211,6 @@ class IOSSimulatorPort(DarwinPort): > return stderr, None > return stderr, crash_log > >- def _build_relay(self): >- environment = self.host.copy_current_environment() >- environment.disable_gcc_smartquotes() >- env = environment.to_dictionary() >- >- try: >- # FIXME: We should be passing _arguments_for_configuration(), which respects build configuration and port, >- # instead of hardcoding --ios-simulator. >- self._run_script("build-layouttestrelay", args=["--ios-simulator"], env=env) >- except ScriptError, e: >- _log.error(e.message_with_output(output_limit=None)) >- return False >- return True >- >- def _build_driver(self): >- built_tool = super(IOSSimulatorPort, self)._build_driver() >- built_relay = self._build_relay() >- return built_tool and built_relay >- > def _build_driver_flags(self): > archs = ['ARCHS=i386'] if self.architecture() == 'x86' else [] > sdk = ['--sdk', 'iphonesimulator'] >@@ -264,9 +223,6 @@ class IOSSimulatorPort(DarwinPort): > configurations.append(TestConfiguration(version=self._version, architecture=architecture, build_type=build_type)) > return configurations > >- def _driver_class(self): >- return driver.IOSSimulatorDriver >- > def default_baseline_search_path(self): > if self.get_option('webkit_test_runner'): > fallback_names = [self._wk2_port_name()] + [self.port_name] + ['wk2'] >@@ -280,9 +236,9 @@ class IOSSimulatorPort(DarwinPort): > > def _create_simulators(self): > if (self.default_child_processes() < self.child_processes()): >- _log.warn("You have specified very high value({0}) for --child-processes".format(self.child_processes())) >- _log.warn("maximum child-processes which can be supported on this system are: {0}".format(self.default_child_processes())) >- _log.warn("This is very likely to fail.") >+ _log.warn("You have specified very high value({0}) for --child-processes".format(self.child_processes())) >+ _log.warn("maximum child-processes which can be supported on this system are: {0}".format(self.default_child_processes())) >+ _log.warn("This is very likely to fail.") > > if self._using_dedicated_simulators(): > self._createSimulatorApps() >@@ -413,7 +369,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>' >Index: Tools/Scripts/webkitpy/port/ios_unittest.py >=================================================================== >--- Tools/Scripts/webkitpy/port/ios_unittest.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/ios_unittest.py (working copy) >@@ -70,7 +70,7 @@ class iosTest(darwin_testcase.DarwinTest > port._run_script = run_script > self.assertEqual(port.architecture(), 'x86') > port._build_driver() >- self.assertEqual(self.args, ['--ios-simulator']) >+ self.assertEqual(self.args, ['ARCHS=i386', '--sdk', 'iphonesimulator']) > > def test_64bit(self): > # Apple Mac port is 64-bit by default >@@ -82,7 +82,7 @@ class iosTest(darwin_testcase.DarwinTest > > port._run_script = run_script > port._build_driver() >- self.assertEqual(self.args, ['--ios-simulator']) >+ self.assertEqual(self.args, ['--sdk', 'iphonesimulator']) > > def test_sdk_name(self): > port = self.make_port() >Index: Tools/Scripts/webkitpy/port/server_process.py >=================================================================== >--- Tools/Scripts/webkitpy/port/server_process.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/server_process.py (working copy) >@@ -59,7 +59,7 @@ class ServerProcess(object): > indefinitely. The class also handles transparently restarting processes > as necessary to keep issuing commands.""" > >- def __init__(self, port_obj, name, cmd, env=None, universal_newlines=False, treat_no_data_as_crash=False): >+ def __init__(self, port_obj, name, cmd, env=None, universal_newlines=False, treat_no_data_as_crash=False, worker_number=None): > self._port = port_obj > self._name = name # Should be the command name (e.g. DumpRenderTree, ImageDiff) > self._cmd = cmd >@@ -103,6 +103,11 @@ class ServerProcess(object): > def process_name(self): > return self._name > >+ @staticmethod >+ def _set_file_nonblocking(file): >+ fl = fcntl.fcntl(file.fileno(), fcntl.F_GETFL) >+ fcntl.fcntl(file.fileno(), fcntl.F_SETFL, fl | os.O_NONBLOCK) >+ > def _start(self): > if self._proc: > raise ValueError("%s already running" % self._name) >@@ -117,13 +122,9 @@ class ServerProcess(object): > universal_newlines=self._universal_newlines) > self._pid = self._proc.pid > self._port.find_system_pid(self.name(), self._pid) >- fd = self._proc.stdout.fileno() > if not self._use_win32_apis: >- fl = fcntl.fcntl(fd, fcntl.F_GETFL) >- fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) >- fd = self._proc.stderr.fileno() >- fl = fcntl.fcntl(fd, fcntl.F_GETFL) >- fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) >+ self._set_file_nonblocking(self._proc.stdout) >+ self._set_file_nonblocking(self._proc.stderr) > > def _handle_possible_interrupt(self): > """This routine checks to see if the process crashed or exited >@@ -150,7 +151,8 @@ class ServerProcess(object): > if not self._proc: > self._start() > try: >- self._proc.stdin.write(bytes) >+ if self._proc.stdin: >+ self._proc.stdin.write(bytes) > except IOError, e: > self.stop(0.0) > # stop() calls _reset(), so we have to set crashed to True after calling stop() >Index: Tools/Scripts/webkitpy/port/server_process_mock.py >=================================================================== >--- Tools/Scripts/webkitpy/port/server_process_mock.py (revision 210936) >+++ Tools/Scripts/webkitpy/port/server_process_mock.py (working copy) >@@ -28,7 +28,7 @@ > > > class MockServerProcess(object): >- def __init__(self, port_obj=None, name=None, cmd=None, env=None, universal_newlines=False, lines=None, crashed=False): >+ def __init__(self, port_obj=None, name=None, cmd=None, env=None, universal_newlines=False, lines=None, crashed=False, worker_number=None): > self.timed_out = False > self.lines = lines or [] > self.crashed = crashed >Index: Tools/Scripts/webkitpy/port/simulator_process.py >=================================================================== >--- Tools/Scripts/webkitpy/port/simulator_process.py (nonexistent) >+++ Tools/Scripts/webkitpy/port/simulator_process.py (working copy) >@@ -0,0 +1,129 @@ >+# Copyright (C) 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 errno >+import os >+import signal >+import time >+ >+from webkitpy.port.server_process import ServerProcess >+ >+ >+class SimulatorProcess(ServerProcess): >+ >+ class SimulatorProcessPopen(object): >+ >+ def __init__(self): >+ self.stdin = None >+ self.stdout = None >+ self.stderr = None >+ self.pid = None >+ self.returncode = None >+ >+ def poll(self): >+ if not self.pid: >+ self.returncode = -1 >+ if self.returncode: >+ return self.returncode >+ try: >+ os.kill(self.pid, 0) >+ except OSError, err: >+ if err.errno == errno.ESRCH: >+ self.returncode = 1 >+ elif err.errno != errno.EPERM: >+ self.returncode = -1 >+ return self.returncode >+ >+ def wait(self): >+ while not self.poll(): >+ time.sleep(.01) >+ return self.returncode >+ >+ def __init__(self, port_obj, name, cmd, env=None, universal_newlines=False, treat_no_data_as_crash=False, worker_number=None): >+ from webkitpy.xcode.simulator import Simulator # Avoid circular import >+ self._simulator_manager = Simulator(port_obj.host) >+ >+ self._bundle_id = port_obj.app_identifier_from_bundle(cmd[0]) >+ self._device = self._simulator_manager.find_device_by_udid(port_obj.device_id_for_worker_number(worker_number)) >+ assert self._device.install_app(cmd[0]) >+ env['IPC_IDENTIFIER'] = self._bundle_id + "-" + self._device.udid >+ >+ file_location = '/tmp/' + env['IPC_IDENTIFIER'] >+ self._in_path = file_location + '_IN' >+ self._out_path = file_location + '_OUT' >+ self._error_path = file_location + '_ERROR' >+ >+ super(SimulatorProcess, self).__init__(port_obj, name, cmd, env, universal_newlines, treat_no_data_as_crash) >+ >+ def _reset(self): >+ super(SimulatorProcess, self)._reset() >+ >+ # Unlinks are needed on reset in the event that the Python code unexpectedly >+ # fails between reset and kill. This can be caused by a sigkill or a crash. >+ # This ensures that os.mkfifo will not be obstructed by previous fifos. >+ # Other files will still cause os.mkfifo to fail. >+ try: >+ os.unlink(self._in_path) >+ except: >+ pass >+ try: >+ os.unlink(self._out_path) >+ except: >+ pass >+ try: >+ os.unlink(self._error_path) >+ except: >+ pass >+ >+ def _start(self): >+ if self._proc: >+ raise ValueError("%s already running" % self._name) >+ self._reset() >+ os.mkfifo(self._in_path, 0600) >+ os.mkfifo(self._out_path, 0600) >+ os.mkfifo(self._error_path, 0600) >+ >+ self._proc = SimulatorProcess.SimulatorProcessPopen() >+ self._proc.stdout = os.fdopen(os.open(self._out_path, os.O_RDONLY | os.O_NONBLOCK), "rb") >+ self._proc.stderr = os.fdopen(os.open(self._error_path, os.O_RDONLY | os.O_NONBLOCK), "rb") >+ >+ self._pid = self._device.launch_app(self._bundle_id, self._cmd[1:], env=self._env) >+ assert self._pid >+ self._proc.pid = self._pid >+ >+ def handler(signum, frame): >+ raise IOError("Couldn't open stdin") >+ signal.signal(signal.SIGALRM, handler) >+ signal.alarm(3) >+ try: >+ self._proc.stdin = open(self._in_path, "w", 0) >+ except: >+ self._proc.stdin = None >+ signal.alarm(0) >+ >+ if not self._proc.stdin: >+ self._crashed = True >+ >+ def _kill(self): >+ self._device.terminate_app(self._bundle_id) >+ super(SimulatorProcess, self)._kill() >Index: Tools/Scripts/webkitpy/xcode/simulator.py >=================================================================== >--- Tools/Scripts/webkitpy/xcode/simulator.py (revision 210936) >+++ Tools/Scripts/webkitpy/xcode/simulator.py (working copy) >@@ -167,7 +167,7 @@ class Device(object): > Represents a CoreSimulator device underneath a runtime > """ > >- def __init__(self, name, udid, available, runtime): >+ def __init__(self, name, udid, available, runtime, host=None): > """ > :param name: The device name > :type name: str >@@ -178,6 +178,7 @@ class Device(object): > :param runtime: The iOS Simulator runtime that hosts this device > :type runtime: Runtime > """ >+ self._host = host or Host() > self.name = name > self.udid = udid > self.available = available >@@ -260,6 +261,35 @@ class Device(object): > except subprocess.CalledProcessError: > raise RuntimeError('"xcrun simctl erase" failed: device state is {}'.format(Simulator.device_state(udid))) > >+ def install_app(self, app_path): >+ return not self._host.executive.run_command(['xcrun', 'simctl', 'install', self.udid, app_path], return_exit_code=True) >+ >+ def launch_app(self, bundle_identifier, args, env=None): >+ environment_to_use = {} >+ for value in (env or {}): >+ if not value.startswith("SIMCTL_CHILD_"): >+ environment_to_use['SIMCTL_CHILD_' + value] = env[value] >+ environment_to_use[value] = env[value] >+ >+ def launch_handler(err): >+ raise RuntimeError('Failed to launch app') >+ >+ try: >+ output = self._host.executive.run_command( >+ ['xcrun', 'simctl', 'launch', self.udid, bundle_identifier] + args, >+ env=environment_to_use, >+ error_handler=launch_handler, >+ ) >+ except RuntimeError: >+ return None >+ >+ # Output should be: "<bundle id>: <pid>" >+ assert output.startswith(bundle_identifier + ": ") >+ return int(output.rstrip('\n').split(' ')[1]) >+ >+ def terminate_app(self, bundle_identifier): >+ return not self._host.executive.run_command(['xcrun', 'simctl', 'terminate', self.udid, bundle_identifier], return_exit_code=True) >+ > def __eq__(self, other): > return self.udid == other.udid > >@@ -477,7 +507,8 @@ class Simulator(object): > device = Device(name=device_match.group('name').rstrip(), > udid=device_match.group('udid'), > available=device_match.group('availability') is None, >- runtime=current_runtime) >+ runtime=current_runtime, >+ host=self._host) > current_runtime.devices.append(device) > > def device_type(self, name=None, identifier=None):
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 165927
:
297242
|
297244
|
297250
|
297325
|
297333
|
297341
|
298112
|
298113
|
298114
|
298480
|
298485
|
298790
|
298791
|
298792
|
298794
|
299251
|
299284
|
299554
|
299619
|
299846
|
299874
|
299965
|
299967
|
299984
|
300076
|
300113
|
300129
|
301048