Diff
Modified: trunk/Tools/ChangeLog (214552 => 214553)
--- trunk/Tools/ChangeLog 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/ChangeLog 2017-03-29 19:23:32 UTC (rev 214553)
@@ -1,5 +1,57 @@
2017-03-29 Jonathan Bedard <[email protected]>
+ Use TCP instead of FIFOs for Simulator/Device communication
+ https://bugs.webkit.org/show_bug.cgi?id=169419
+ <rdar://problem/30949615>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Using TCP instead of FIFOs when communicating with devices allows the device being tested
+ to be on a different machine then the one handling the management of the test run.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (dumpRenderTree): Call setUp/tearDownIOSLayoutTestCommunication() instead of using FIFOs.
+ * Scripts/webkitpy/port/device.py:
+ (Device.__init__): Initialize the listening_socket.
+ (Device.listening_port): Return port of listening socket.
+ (Device.prepare_for_testing): Open listening socket on an open port, prepare platform device
+ fro testing.
+ (Device.finished_testing): Close listening socket associated with this device, call the
+ platform device's finished_testing function if it exists.
+ * Scripts/webkitpy/port/ios.py:
+ (IOSPort.setup_test_run): Prepare each device for testing.
+ (IOSPort.clean_up_test_run): Notify each device that testing has completed.
+ * Scripts/webkitpy/port/ios_simulator.py:
+ (IOSSimulatorPort): Work around device persistence bug.
+ (IOSSimulatorPort.__init__): Ditto.
+ * Scripts/webkitpy/port/simulator_process.py:
+ (SimulatorProcess):
+ (SimulatorProcess.NonBlockingFileFromSocket): Add to work around shortcomings in
+ Python 2’s makefile.
+ (SimulatorProcess.NonBlockingFileFromSocket.__init__): Initialize file with socket.
+ (SimulatorProcess.ReadFileSocket.close): Close file and then socket;
+ (SimulatorProcess.__init__): Pass TCP port over environment, remove FIFO names.
+ (SimulatorProcess.__getattr__): Expose all file attributes.
+ (SimulatorProcess._accept_connection_create_file): Wait for connection from server and
+ create and return a file-like object from the incoming connection.
+ (SimulatorProcess._start): Use TCP connections instead of FIFOs.
+ (SimulatorProcess._start.handler): Output server port in timeout exception.
+ (SimulatorProcess._reset): Deleted.
+ * TestRunnerShared/IOSLayoutTestCommunication.cpp: Added.
+ (connectToServer): Return socket connected to the provided server address.
+ (setupiOSLayoutTestCommunication): Connect stdin, stdout and stderr as socket to a
+ TCP server running on localhost.
+ (tearDownIOSLayoutTestCommunication): Close stdin, stdout and stderr TCP sockets.
+ * TestRunnerShared/IOSLayoutTestCommunication.h: Added.
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::TestController::platformInitialize): Call setUpIOSLayoutTestCommunication()
+ instead of using FIFOs.
+ (WTR::TestController::platformDestroy): Call tearDownIOSLayoutTestCommunication().
+
+2017-03-29 Jonathan Bedard <[email protected]>
+
webkitpy: Add IOSDevicePort and IOSPort tests
https://bugs.webkit.org/show_bug.cgi?id=170206
<rdar://problem/31308364>
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (214552 => 214553)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2017-03-29 19:23:32 UTC (rev 214553)
@@ -80,6 +80,7 @@
2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D403EA215087142005358D2 /* LayoutTestHelper.m */; };
2DA2E3A51E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */; };
31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */; };
+ 312943F91E71F2B4001EE2CC /* IOOSLayoutTestCommunication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3148A0551E6F90F400D3B316 /* IOSLayoutTestCommunication.cpp */; };
4464CABE1C20A08B00E5BB55 /* DumpRenderTreeAppMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4464CABD1C20A07000E5BB55 /* DumpRenderTreeAppMain.mm */; };
4AD6A11413C8124000EA9737 /* FormValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD6A11313C8124000EA9737 /* FormValue.cpp */; };
5106803E15CC7B10001A8A23 /* SlowNPPNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5106803D15CC7B10001A8A23 /* SlowNPPNew.cpp */; };
@@ -294,6 +295,8 @@
2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeSpellChecker.mm; path = mac/DumpRenderTreeSpellChecker.mm; sourceTree = "<group>"; };
31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockWebNotificationProvider.h; path = mac/MockWebNotificationProvider.h; sourceTree = "<group>"; };
31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockWebNotificationProvider.mm; path = mac/MockWebNotificationProvider.mm; sourceTree = "<group>"; };
+ 3148A0551E6F90F400D3B316 /* IOSLayoutTestCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOSLayoutTestCommunication.cpp; path = ../TestRunnerShared/IOSLayoutTestCommunication.cpp; sourceTree = "<group>"; };
+ 3148A0561E6F90F400D3B316 /* IOSLayoutTestCommunication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOSLayoutTestCommunication.h; path = ../TestRunnerShared/IOSLayoutTestCommunication.h; sourceTree = "<group>"; };
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher100.ttf; path = fonts/WebKitWeightWatcher100.ttf; sourceTree = "<group>"; };
375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher200.ttf; path = fonts/WebKitWeightWatcher200.ttf; sourceTree = "<group>"; };
@@ -472,6 +475,7 @@
isa = PBXGroup;
children = (
0F18E6F11D6B9C640027E547 /* DerivedSources.make */,
+ 3148A0651E6F90F400D3B316 /* TestRunnerShared */,
0F18E6E71D6B9BF50027E547 /* UIScriptContext */,
A1158D6A18927CE10088C17B /* ios */,
A134E53418905E6C00901D06 /* config.h */,
@@ -695,6 +699,16 @@
name = LayoutTestHelper;
sourceTree = "<group>";
};
+ 3148A0651E6F90F400D3B316 /* TestRunnerShared */ = {
+ isa = PBXGroup;
+ children = (
+ 3148A0551E6F90F400D3B316 /* IOSLayoutTestCommunication.cpp */,
+ 3148A0561E6F90F400D3B316 /* IOSLayoutTestCommunication.h */,
+ );
+ name = TestRunnerShared;
+ path = ../WebKitTestRunner;
+ sourceTree = "<group>";
+ };
417DA9181373674D007C57FB /* WebCoreTestSupport */ = {
isa = PBXGroup;
children = (
@@ -1145,6 +1159,7 @@
7CBBC3231DDFCF9A00786B9D /* TestOptions.mm in Sources */,
0F18E70F1D6BACB60027E547 /* UIScriptControllerMac.mm in Sources */,
BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */,
+ 312943F91E71F2B4001EE2CC /* IOSLayoutTestCommunication.cpp in Sources */,
BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (214552 => 214553)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-03-29 19:23:32 UTC (rev 214553)
@@ -103,6 +103,7 @@
#if PLATFORM(IOS)
#import "DumpRenderTreeBrowserView.h"
+#import "IOSLayoutTestCommunication.h"
#import "UIKitSPI.h"
#import <QuartzCore/QuartzCore.h>
#import <WebCore/CoreGraphicsSPI.h>
@@ -1236,17 +1237,7 @@
void dumpRenderTree(int argc, const char *argv[])
{
#if PLATFORM(IOS)
- const char* identifier = getenv("IPC_IDENTIFIER");
- const char *stdinPath = [[NSString stringWithFormat:@"/tmp/%s_IN", identifier] UTF8String];
- const char *stdoutPath = [[NSString stringWithFormat:@"/tmp/%s_OUT", identifier] UTF8String];
- const char *stderrPath = [[NSString stringWithFormat:@"/tmp/%s_ERROR", identifier] UTF8String];
-
- int infd = open(stdinPath, O_RDWR);
- dup2(infd, STDIN_FILENO);
- int outfd = open(stdoutPath, O_RDWR);
- dup2(outfd, STDOUT_FILENO);
- int errfd = open(stderrPath, O_RDWR | O_NONBLOCK);
- dup2(errfd, STDERR_FILENO);
+ setUpIOSLayoutTestCommunication();
#endif
signal(SIGILL, &writeCrashedMessageOnFatalError);
@@ -1307,9 +1298,7 @@
}
#if PLATFORM(IOS)
- close(infd);
- close(outfd);
- close(errfd);
+ tearDownIOSLayoutTestCommunication();
#endif
}
Modified: trunk/Tools/Scripts/webkitpy/port/device.py (214552 => 214553)
--- trunk/Tools/Scripts/webkitpy/port/device.py 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/Scripts/webkitpy/port/device.py 2017-03-29 19:23:32 UTC (rev 214553)
@@ -20,11 +20,18 @@
# (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 socket
class Device(object):
def __init__(self, platform_device):
self.platform_device = platform_device
+ self.listening_socket = None
+ def listening_port(self):
+ if not self.listening_socket:
+ return None
+ return self.listening_socket.getsockname()[1]
+
def install_app(self, app_path, env=None):
return self.platform_device.install_app(app_path, env)
@@ -31,6 +38,21 @@
def launch_app(self, bundle_id, args, env=None):
return self.platform_device.launch_app(bundle_id, args, env)
+ def prepare_for_testing(self):
+ if not self.listening_socket:
+ self.listening_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.listening_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.listening_socket.bind(('127.0.0.1', 0))
+
+ if hasattr(self.platform_device, 'prepare_for_testing'):
+ self.platform_device.prepare_for_testing()
+
+ def finished_testing(self):
+ if hasattr(self.platform_device, 'teardown'):
+ self.platform_device.finished_testing()
+
+ self.listening_socket = None
+
@property
def executive(self):
return self.platform_device.executive
Modified: trunk/Tools/Scripts/webkitpy/port/ios.py (214552 => 214553)
--- trunk/Tools/Scripts/webkitpy/port/ios.py 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/Scripts/webkitpy/port/ios.py 2017-03-29 19:23:32 UTC (rev 214553)
@@ -117,3 +117,12 @@
# crash, but this crash will occur post-launch, after install_app has already killed the process.
if not device.install_app(self._path_to_driver(), {'DYLD_LIBRARY_PATH': self._build_path()}):
raise RuntimeError('Failed to install app {} on device {}'.format(self._path_to_driver(), device.udid))
+
+ for i in xrange(self.child_processes()):
+ self.device_for_worker_number(i).prepare_for_testing()
+
+ def clean_up_test_run(self):
+ super(IOSPort, self).clean_up_test_run()
+
+ for i in xrange(self.child_processes()):
+ self.device_for_worker_number(i).finished_testing()
Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator.py (214552 => 214553)
--- trunk/Tools/Scripts/webkitpy/port/ios_simulator.py 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator.py 2017-03-29 19:23:32 UTC (rev 214553)
@@ -66,7 +66,10 @@
},
}
+ #FIXME: Ports are recreated in each process. This is a problem for IOSSimulatorPort, it means devices are not
+ # persistent and devices hold a listening socket expected to be persistent across processes.
_DEVICE_MAP = {}
+ _CURRENT_DEVICE = None
def __init__(self, host, port_name, **kwargs):
super(IOSSimulatorPort, self).__init__(host, port_name, **kwargs)
@@ -75,7 +78,9 @@
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)
- self._current_device = Device(Simulator(host).current_device())
+ if not IOSSimulatorPort._CURRENT_DEVICE:
+ IOSSimulatorPort._CURRENT_DEVICE = Device(Simulator(host).current_device())
+ self._current_device = IOSSimulatorPort._CURRENT_DEVICE
if not self._current_device:
self.set_option('dedicated_simulators', True)
if not self.get_option('dedicated_simulators'):
Modified: trunk/Tools/Scripts/webkitpy/port/simulator_process.py (214552 => 214553)
--- trunk/Tools/Scripts/webkitpy/port/simulator_process.py 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/Scripts/webkitpy/port/simulator_process.py 2017-03-29 19:23:32 UTC (rev 214553)
@@ -54,64 +54,60 @@
time.sleep(0.01) # In seconds
return self.returncode
+ # Python 2's implementation of makefile does not return a non-blocking file.
+ class NonBlockingFileFromSocket(object):
+
+ def __init__(self, sock, type):
+ self.socket = sock
+ self._file = os.fdopen(sock.fileno(), type, 0)
+ ServerProcess._set_file_nonblocking(self._file)
+
+ def __getattr__(self, name):
+ return getattr(self._file, name)
+
+ def close(self):
+ result = self._file.close()
+ self.socket.close()
+ return result
+
+
def __init__(self, port_obj, name, cmd, env=None, universal_newlines=False, treat_no_data_as_crash=False, worker_number=None):
self._bundle_id = port_obj.app_identifier_from_bundle(cmd[0])
self._device = port_obj.device_for_worker_number(worker_number)
- env['IPC_IDENTIFIER'] = self._bundle_id + '-' + self._device.udid
- # This location matches the location used by WebKitTestRunner and DumpRenderTree
- # for the other side of these fifos.
- file_location = '/tmp/' + env['IPC_IDENTIFIER']
- self._in_path = file_location + '_IN'
- self._out_path = file_location + '_OUT'
- self._error_path = file_location + '_ERROR'
-
+ env['PORT'] = str(self._device.listening_port())
super(SimulatorProcess, self).__init__(port_obj, name, cmd, env, universal_newlines, treat_no_data_as_crash)
- def _reset(self):
- super(SimulatorProcess, self)._reset()
+ @staticmethod
+ def _accept_connection_create_file(server, type):
+ connection, address = server.accept()
+ assert address[0] == '127.0.0.1'
+ return SimulatorProcess.NonBlockingFileFromSocket(connection, type)
- # Unlinks are needed on reset in the event that the Python code unexpectedly
- # fails between _start() 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('{} already running'.format(self._name))
self._reset()
- FIFO_PERMISSION_FLAGS = 0600 # Only owner can read and write
- os.mkfifo(self._in_path, FIFO_PERMISSION_FLAGS)
- os.mkfifo(self._out_path, FIFO_PERMISSION_FLAGS)
- os.mkfifo(self._error_path, FIFO_PERMISSION_FLAGS)
-
- stdout = os.fdopen(os.open(self._out_path, os.O_RDONLY | os.O_NONBLOCK), 'rb')
- stderr = os.fdopen(os.open(self._error_path, os.O_RDONLY | os.O_NONBLOCK), 'rb')
-
+ # Each device has a listening socket intitilaized during the port's setup_test_run.
+ # 3 client connections will be accepted for stdin, stdout and stderr in that order.
+ self._device.listening_socket.listen(3)
self._pid = self._device.launch_app(self._bundle_id, self._cmd[1:], env=self._env)
def handler(signum, frame):
assert signum == signal.SIGALRM
- raise Exception('Timed out waiting for process to open {}'.format(self._in_path))
+ raise Exception('Timed out waiting for process to connect at port {}'.format(self._device.listening_port()))
signal.signal(signal.SIGALRM, handler)
signal.alarm(3) # In seconds
stdin = None
+ stdout = None
+ stderr = None
try:
- stdin = open(self._in_path, 'w', 0) # Opening with no buffering, like popen
+ # This order matches the client side connections in Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp setUpIOSLayoutTestCommunication()
+ stdin = SimulatorProcess._accept_connection_create_file(self._device.listening_socket, 'w')
+ stdout = SimulatorProcess._accept_connection_create_file(self._device.listening_socket, 'rb')
+ stderr = SimulatorProcess._accept_connection_create_file(self._device.listening_socket, 'rb')
except:
# We set self._proc as _reset() and _kill() depend on it.
self._proc = SimulatorProcess.Popen(self._pid, stdin, stdout, stderr, self._device)
Added: trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp (0 => 214553)
--- trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp (rev 0)
+++ trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.cpp 2017-03-29 19:23:32 UTC (rev 214553)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "config.h"
+#include "IOSLayoutTestCommunication.h"
+
+#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <wtf/Assertions.h>
+
+static int stdinSocket;
+static int stdoutSocket;
+static int stderrSocket;
+
+static int connectToServer(sockaddr_in& serverAddress)
+{
+ int result = socket(AF_INET, SOCK_STREAM, 0);
+ RELEASE_ASSERT(result >= 0);
+ RELEASE_ASSERT(connect(result, (struct sockaddr *) &serverAddress, sizeof(serverAddress)) >= 0);
+ return result;
+}
+
+void setUpIOSLayoutTestCommunication()
+{
+ int port = atoi(getenv("PORT"));
+ RELEASE_ASSERT(port > 0);
+
+ struct hostent* host = gethostbyname("127.0.0.1");
+ struct sockaddr_in serverAddress;
+ memset((char*) &serverAddress, 0, sizeof(serverAddress));
+ serverAddress.sin_family = AF_INET;
+ memcpy(
+ (char*)&serverAddress.sin_addr.s_addr,
+ (char*)host->h_addr,
+ host->h_length);
+ serverAddress.sin_port = htons(port);
+
+ // This order matches the server side listener in Tools/Scripts/webkitpy/port/simulator_process.py SimulatorProcess._start()
+ stdinSocket = connectToServer(serverAddress);
+ dup2(stdinSocket, STDIN_FILENO);
+
+ stdoutSocket = connectToServer(serverAddress);
+ dup2(stdoutSocket, STDOUT_FILENO);
+
+ stderrSocket = connectToServer(serverAddress);
+ dup2(stderrSocket, STDERR_FILENO);
+}
+
+void tearDownIOSLayoutTestCommunication()
+{
+ close(stdinSocket);
+ close(stdoutSocket);
+ close(stderrSocket);
+}
Added: trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.h (0 => 214553)
--- trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.h (rev 0)
+++ trunk/Tools/TestRunnerShared/IOSLayoutTestCommunication.h 2017-03-29 19:23:32 UTC (rev 214553)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+void setUpIOSLayoutTestCommunication();
+void tearDownIOSLayoutTestCommunication();
Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (214552 => 214553)
--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj 2017-03-29 19:23:32 UTC (rev 214553)
@@ -73,6 +73,7 @@
2E63EDA11891B291002A7AFC /* AccessibilityUIElementIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED781891ACE9002A7AFC /* AccessibilityUIElementIOS.mm */; };
2E63EDA61891BDC0002A7AFC /* TestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC9981711D3F51E0017BCA2 /* TestRunner.cpp */; };
2E749BF21891EBFA007FC175 /* EventSenderProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E63ED7A1891ACE9002A7AFC /* EventSenderProxyIOS.mm */; };
+ 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */; };
51058AD51D678820009A538C /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; };
51058AD61D678825009A538C /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
5641E2D014335E95008307E5 /* JSTextInputController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5641E2CE14335E95008307E5 /* JSTextInputController.cpp */; };
@@ -252,6 +253,8 @@
2EE52D141890A9FB0010ED21 /* TestControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestControllerIOS.mm; sourceTree = "<group>"; };
2EE52D161890A9FB0010ED21 /* mainIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = mainIOS.mm; path = ../ios/mainIOS.mm; sourceTree = "<group>"; };
3110BE0F15BA011400D216AC /* WebNotificationProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationProvider.h; sourceTree = "<group>"; };
+ 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOSLayoutTestCommunication.cpp; path = ../TestRunnerShared/IOSLayoutTestCommunication.cpp; sourceTree = "<group>"; };
+ 3148A0541E6F85B600D3B316 /* IOSLayoutTestCommunication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOSLayoutTestCommunication.h; path = ../TestRunnerShared/IOSLayoutTestCommunication.h; sourceTree = "<group>"; };
3164C8EF15D1ADA100EF1FE0 /* WebNotificationProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationProvider.cpp; sourceTree = "<group>"; };
378D442213346D00006A777B /* config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -450,6 +453,8 @@
0F18E71A1D6BC4BC0027E547 /* TestRunnerShared */ = {
isa = PBXGroup;
children = (
+ 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */,
+ 3148A0541E6F85B600D3B316 /* IOSLayoutTestCommunication.h */,
0F18E71B1D6BC4E60027E547 /* Bindings */,
0F73B5471BA782FE004B3EF4 /* UIScriptContext */,
);
@@ -970,6 +975,7 @@
A18510401B9AE13100744AEB /* PixelDumpSupport.cpp in Sources */,
A18510411B9AE13800744AEB /* TestController.cpp in Sources */,
A185103B1B9AE0E200744AEB /* TestControllerCocoa.mm in Sources */,
+ 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */,
A18510421B9AE13E00744AEB /* TestInvocation.cpp in Sources */,
A185103D1B9AE10600744AEB /* TestInvocationCG.cpp in Sources */,
0F622CE91BBB3A1A00838AD3 /* TestOptions.cpp in Sources */,
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (214552 => 214553)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-03-29 19:23:21 UTC (rev 214552)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-03-29 19:23:32 UTC (rev 214553)
@@ -27,6 +27,7 @@
#import "TestController.h"
#import "HIDEventGenerator.h"
+#import "IOSLayoutTestCommunication.h"
#import "PlatformWebView.h"
#import "TestInvocation.h"
#import "TestRunnerWKWebView.h"
@@ -49,21 +50,12 @@
void TestController::platformInitialize()
{
- const char* identifier = getenv("IPC_IDENTIFIER");
- const char *stdinPath = [[NSString stringWithFormat:@"/tmp/%s_IN", identifier] UTF8String];
- const char *stdoutPath = [[NSString stringWithFormat:@"/tmp/%s_OUT", identifier] UTF8String];
- const char *stderrPath = [[NSString stringWithFormat:@"/tmp/%s_ERROR", identifier] UTF8String];
-
- int infd = open(stdinPath, O_RDWR);
- dup2(infd, STDIN_FILENO);
- int outfd = open(stdoutPath, O_RDWR);
- dup2(outfd, STDOUT_FILENO);
- int errfd = open(stderrPath, O_RDWR | O_NONBLOCK);
- dup2(errfd, STDERR_FILENO);
+ setUpIOSLayoutTestCommunication();
}
void TestController::platformDestroy()
{
+ tearDownIOSLayoutTestCommunication();
}
void TestController::initializeInjectedBundlePath()