<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202743] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202743">202743</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2016-07-01 10:08:38 -0700 (Fri, 01 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify LayoutTestRelay
https://bugs.webkit.org/show_bug.cgi?id=159353

Reviewed by Daniel Bates.

1. Use UDID to pass the device from webkitpy to LayoutTestRelay, searching for it
by name and runtime makes no sense.
2. Removed code to create devices, webkitpy always does this in advance.
3. Don't create copies of testing apps - we can install the same one into
each simulator, now that we don't run multiple tester processes in a single simulator.
4. Pass information on how to find I/O pipes via environment, not via Info.plist.
5. Removed code that kept testing apps alive in the background.
6. Slightly updated coding style in functions that I touched.

* LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h:
Updated for what we acually use at this point.

* LayoutTestRelay/LayoutTestRelay/LTRelayController.h:
* LayoutTestRelay/LayoutTestRelay/LTRelayController.m:
(-[LTRelayController initWithDevice:productDir:appPath:deviceUDID:dumpToolArguments:]):
(-[LTRelayController ipcIdentifier]):
(-[LTRelayController processName]):
(-[LTRelayController didReceiveStdoutData:]):
(-[LTRelayController didCrashWithMessage:]):
(-[LTRelayController installApp]):
(-[LTRelayController _environmentVariables]):
(-[LTRelayController launchApp]):
(-[LTRelayController start]):
(-[LTRelayController initWithDevice:productDir:appPath:identifierSuffix:dumpToolArguments:]): Deleted.
(-[LTRelayController uniqueAppPath]): Deleted.
(-[LTRelayController uniqueAppURL]): Deleted.
(-[LTRelayController uniqueAppIdentifier]): Deleted.
(-[LTRelayController createUniqueApp]): Deleted.
* LayoutTestRelay/LayoutTestRelay/main.m:
(usage):
(getRequiredStringArgument):
(main):
(getTestingSimDevice): Deleted.
* Scripts/webkitpy/port/driver.py:
(IOSSimulatorDriver.cmd_line):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformInitialize):
* WebKitTestRunner/ios/mainIOS.mm:
(-[WebKitTestRunnerApp applicationDidEnterBackground:]):
* DumpRenderTree/mac/DumpRenderTree.mm:
(dumpRenderTree):
(-[DumpRenderTree applicationDidEnterBackground:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsLayoutTestRelayLayoutTestRelayCoreSimulatorSPIh">trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h</a></li>
<li><a href="#trunkToolsLayoutTestRelayLayoutTestRelayLTRelayControllerh">trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.h</a></li>
<li><a href="#trunkToolsLayoutTestRelayLayoutTestRelayLTRelayControllerm">trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.m</a></li>
<li><a href="#trunkToolsLayoutTestRelayLayoutTestRelaymainm">trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosTestControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosmainIOSmm">trunk/Tools/WebKitTestRunner/ios/mainIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/ChangeLog        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2016-07-01  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Simplify LayoutTestRelay
+        https://bugs.webkit.org/show_bug.cgi?id=159353
+
+        Reviewed by Daniel Bates.
+
+        1. Use UDID to pass the device from webkitpy to LayoutTestRelay, searching for it
+        by name and runtime makes no sense.
+        2. Removed code to create devices, webkitpy always does this in advance.
+        3. Don't create copies of testing apps - we can install the same one into
+        each simulator, now that we don't run multiple tester processes in a single simulator.
+        4. Pass information on how to find I/O pipes via environment, not via Info.plist.
+        5. Removed code that kept testing apps alive in the background.
+        6. Slightly updated coding style in functions that I touched.
+
+        * LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h:
+        Updated for what we acually use at this point.
+
+        * LayoutTestRelay/LayoutTestRelay/LTRelayController.h:
+        * LayoutTestRelay/LayoutTestRelay/LTRelayController.m:
+        (-[LTRelayController initWithDevice:productDir:appPath:deviceUDID:dumpToolArguments:]):
+        (-[LTRelayController ipcIdentifier]):
+        (-[LTRelayController processName]):
+        (-[LTRelayController didReceiveStdoutData:]):
+        (-[LTRelayController didCrashWithMessage:]):
+        (-[LTRelayController installApp]):
+        (-[LTRelayController _environmentVariables]):
+        (-[LTRelayController launchApp]):
+        (-[LTRelayController start]):
+        (-[LTRelayController initWithDevice:productDir:appPath:identifierSuffix:dumpToolArguments:]): Deleted.
+        (-[LTRelayController uniqueAppPath]): Deleted.
+        (-[LTRelayController uniqueAppURL]): Deleted.
+        (-[LTRelayController uniqueAppIdentifier]): Deleted.
+        (-[LTRelayController createUniqueApp]): Deleted.
+        * LayoutTestRelay/LayoutTestRelay/main.m:
+        (usage):
+        (getRequiredStringArgument):
+        (main):
+        (getTestingSimDevice): Deleted.
+        * Scripts/webkitpy/port/driver.py:
+        (IOSSimulatorDriver.cmd_line):
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformInitialize):
+        * WebKitTestRunner/ios/mainIOS.mm:
+        (-[WebKitTestRunnerApp applicationDidEnterBackground:]):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (dumpRenderTree):
+        (-[DumpRenderTree applicationDidEnterBackground:]):
+
</ins><span class="cx"> 2016-07-01  Konstantin Tokarev  &lt;annulen@yandex.ru&gt;
</span><span class="cx"> 
</span><span class="cx">         [cmake] Build TestNetscapePlugin only if NPAPI is enabled.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -1259,10 +1259,10 @@
</span><span class="cx"> void dumpRenderTree(int argc, const char *argv[])
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
-    const char *stdinPath = [[NSString stringWithFormat:@&quot;/tmp/%@_IN&quot;, identifier] UTF8String];
-    const char *stdoutPath = [[NSString stringWithFormat:@&quot;/tmp/%@_OUT&quot;, identifier] UTF8String];
-    const char *stderrPath = [[NSString stringWithFormat:@&quot;/tmp/%@_ERROR&quot;, identifier] UTF8String];
</del><ins>+    const char* identifier = getenv(&quot;IPC_IDENTIFIER&quot;);
+    const char *stdinPath = [[NSString stringWithFormat:@&quot;/tmp/%s_IN&quot;, identifier] UTF8String];
+    const char *stdoutPath = [[NSString stringWithFormat:@&quot;/tmp/%s_OUT&quot;, identifier] UTF8String];
+    const char *stderrPath = [[NSString stringWithFormat:@&quot;/tmp/%s_ERROR&quot;, identifier] UTF8String];
</ins><span class="cx"> 
</span><span class="cx">     int infd = open(stdinPath, O_RDWR);
</span><span class="cx">     dup2(infd, STDIN_FILENO);
</span><span class="lines">@@ -1354,25 +1354,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)applicationDidEnterBackground:(UIApplication *)application
</span><span class="cx"> {
</span><del>-    /* Apps will get suspended or killed some time after entering the background state but we want to be able to run multiple copies of DumpRenderTree. Periodically check to see if our remaining background time dips below a threshold and create a new background task.
-    */
-    void (^expirationHandler)() = ^ {
-        [application endBackgroundTask:backgroundTaskIdentifier];
-        backgroundTaskIdentifier = UIBackgroundTaskInvalid;
-    };
-
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
-        NSTimeInterval timeRemaining;
-        while (true) {
-            timeRemaining = [application backgroundTimeRemaining];
-            if (timeRemaining &lt;= 10.0 || backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
-                [application endBackgroundTask:backgroundTaskIdentifier];
-                backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:expirationHandler];
-            }
-            sleep(5);
-        }
-    });
</del><ins>+    RELEASE_ASSERT_NOT_REACHED();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_webThreadEventLoopHasRun
</span></span></pre></div>
<a id="trunkToolsLayoutTestRelayLayoutTestRelayCoreSimulatorSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/CoreSimulatorSPI.h        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -35,32 +35,14 @@
</span><span class="cx"> #define kSimDeviceLaunchApplicationArguments @&quot;arguments&quot;
</span><span class="cx"> #define kSimDeviceLaunchApplicationEnvironment @&quot;environment&quot;
</span><span class="cx"> 
</span><del>-typedef NS_ENUM(NSUInteger, SimDeviceState) {
-    SimDeviceStateCreating = 0,
-};
-
-@interface SimDeviceType : NSObject
-+ (NSDictionary *)supportedDeviceTypesByIdentifier;
-@property (readonly, copy) NSString *identifier;
-@end
-
-@interface SimRuntime : NSObject
-+ (NSDictionary *)supportedRuntimesByIdentifier;
-@end
-
</del><span class="cx"> @interface SimDevice : NSObject
</span><span class="cx"> - (BOOL)installApplication:(NSURL *)installURL withOptions:(NSDictionary *)options error:(NSError **)error;
</span><span class="cx"> - (pid_t)launchApplicationWithID:(NSString *)bundleID options:(NSDictionary *)options error:(NSError **)error;
</span><del>-@property (readonly, retain) SimDeviceType *deviceType;
-@property (readonly, retain) SimRuntime *runtime;
-@property (readonly, assign) SimDeviceState state;
-@property (readonly, copy) NSString *name;
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @interface SimDeviceSet : NSObject
</span><span class="cx"> + (SimDeviceSet *)defaultSet;
</span><del>-- (SimDevice *)createDeviceWithType:(SimDeviceType *)deviceType runtime:(SimRuntime *)runtime name:(NSString *)name error:(NSError **)error;
-@property (readonly, copy) NSArray *devices;
</del><ins>+@property (readonly, copy) NSDictionary *devicesByUDID;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsLayoutTestRelayLayoutTestRelayLTRelayControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.h (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.h        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.h        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> @class SimDevice;
</span><span class="cx"> 
</span><span class="cx"> @interface LTRelayController : NSObject &lt;LTRelayDelegate&gt;
</span><del>-- (id)initWithDevice:(SimDevice *)device productDir:(NSString *)productDir appPath:(NSString *)appPath identifierSuffix:(NSString *)suffix dumpToolArguments:(NSArray *)arguments;
</del><ins>+- (id)initWithDevice:(SimDevice *)device productDir:(NSString *)productDir appPath:(NSString *)appPath deviceUDID:(NSUUID *)udid dumpToolArguments:(NSArray *)arguments;
</ins><span class="cx"> - (void)start;
</span><span class="cx"> - (void)finish;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsLayoutTestRelayLayoutTestRelayLTRelayControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.m (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.m        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/LTRelayController.m        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -33,12 +33,10 @@
</span><span class="cx"> @property (readonly, strong) dispatch_source_t standardInputDispatchSource;
</span><span class="cx"> @property (readonly, strong) NSFileHandle *standardOutput;
</span><span class="cx"> @property (readonly, strong) NSFileHandle *standardError;
</span><del>-@property (readonly, strong) NSString *uniqueAppPath;
-@property (readonly, strong) NSString *uniqueAppIdentifier;
-@property (readonly, strong) NSURL *uniqueAppURL;
-@property (readonly, strong) NSString *originalAppIdentifier;
-@property (readonly, strong) NSString *originalAppPath;
-@property (readonly, strong) NSString *identifierSuffix;
</del><ins>+@property (readonly, strong) NSString *ipcIdentifier;
+@property (readonly, strong) NSString *appBundleIdentifier;
+@property (readonly, strong) NSString *appPath;
+@property (readonly, strong) NSUUID *deviceUDID;
</ins><span class="cx"> @property (readonly, strong) NSArray *dumpToolArguments;
</span><span class="cx"> @property (readonly, strong) NSString *productDir;
</span><span class="cx"> @property (strong) SimDevice *device;
</span><span class="lines">@@ -49,14 +47,14 @@
</span><span class="cx"> 
</span><span class="cx"> @implementation LTRelayController
</span><span class="cx"> 
</span><del>-- (id)initWithDevice:(SimDevice *)device productDir:(NSString *)productDir appPath:(NSString *)appPath identifierSuffix:(NSString *)suffix dumpToolArguments:(NSArray *)arguments
</del><ins>+- (id)initWithDevice:(SimDevice *)device productDir:(NSString *)productDir appPath:(NSString *)appPath deviceUDID:(NSUUID *)udid dumpToolArguments:(NSArray *)arguments
</ins><span class="cx"> {
</span><span class="cx">     if ((self = [super init])) {
</span><span class="cx">         _device = device;
</span><span class="cx">         _productDir = productDir;
</span><del>-        _originalAppPath = appPath;
-        _originalAppIdentifier = [NSDictionary dictionaryWithContentsOfFile:[_originalAppPath stringByAppendingPathComponent:@&quot;Info.plist&quot;]][(NSString *)kCFBundleIdentifierKey];
-        _identifierSuffix = suffix;
</del><ins>+        _appPath = appPath;
+        _appBundleIdentifier = [[NSBundle bundleWithPath:appPath] bundleIdentifier];
+        _deviceUDID = udid;
</ins><span class="cx">         _dumpToolArguments = arguments;
</span><span class="cx">         _standardInputDispatchSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, STDIN_FILENO, 0, dispatch_get_main_queue());
</span><span class="cx">         _standardOutput = [NSFileHandle fileHandleWithStandardOutput];
</span><span class="lines">@@ -78,29 +76,20 @@
</span><span class="cx">             }
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-        _relay = [[LTPipeRelay alloc] initWithPrefix:[@&quot;/tmp&quot; stringByAppendingPathComponent:[self uniqueAppIdentifier]]];
</del><ins>+        _relay = [[LTPipeRelay alloc] initWithPrefix:[@&quot;/tmp&quot; stringByAppendingPathComponent:self.ipcIdentifier]];
</ins><span class="cx">         [_relay setRelayDelegate:self];
</span><span class="cx">     }
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (NSString *)uniqueAppPath
</del><ins>+- (NSString *)ipcIdentifier
</ins><span class="cx"> {
</span><del>-    return [[self originalAppPath] stringByReplacingOccurrencesOfString:@&quot;.app&quot; withString:[NSString stringWithFormat:@&quot;%@.app&quot;, [self identifierSuffix]]];
</del><ins>+    return [NSString stringWithFormat:@&quot;%@-%@&quot;, self.appBundleIdentifier, self.deviceUDID.UUIDString];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (NSURL *)uniqueAppURL
-{
-    return [NSURL fileURLWithPath:[self uniqueAppPath]];
-}
-
-- (NSString *)uniqueAppIdentifier
-{
-    return [[self originalAppIdentifier] stringByAppendingString:[self identifierSuffix]];
-}
</del><span class="cx"> - (NSString *)processName
</span><span class="cx"> {
</span><del>-    return [[[self originalAppIdentifier] componentsSeparatedByString:@&quot;.&quot;] lastObject];
</del><ins>+    return [self.appBundleIdentifier componentsSeparatedByString:@&quot;.&quot;].lastObject;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)didReceiveStdoutData:(NSData *)data
</span><span class="lines">@@ -151,35 +140,16 @@
</span><span class="cx">     exit(EXIT_FAILURE);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)createUniqueApp
</del><ins>+- (void)installApp
</ins><span class="cx"> {
</span><del>-    NSError *error;
-    NSFileManager *fileManager = [NSFileManager defaultManager];
-    [fileManager removeItemAtPath:[self uniqueAppPath] error:&amp;error];
-    error = nil;
-
-    [fileManager copyItemAtPath:[self originalAppPath] toPath:[self uniqueAppPath] error:&amp;error];
-    if (error) {
-        NSLog(@&quot;Couldn't copy %@ to %@: %@&quot;, [self originalAppPath], [self uniqueAppPath], [error description]);
-        exit(EXIT_FAILURE);
-    }
-
-    NSString *infoPlistPath = [[self uniqueAppPath] stringByAppendingPathComponent:@&quot;Info.plist&quot;];
-    NSMutableDictionary *plist = [NSMutableDictionary dictionaryWithContentsOfFile:infoPlistPath];
-    [plist setValue:[self uniqueAppIdentifier] forKey:(NSString *)kCFBundleIdentifierKey];
-    BOOL written = [plist writeToFile:infoPlistPath atomically:YES];
-    if (!written) {
-        NSLog(@&quot;Couldn't write unique app plist at %@&quot;, infoPlistPath);
-        exit(EXIT_FAILURE);
-    }
-
</del><span class="cx">     NSDictionary *installOptions = @{
</span><del>-        (NSString *)kCFBundleIdentifierKey: [self uniqueAppIdentifier],
</del><ins>+        (NSString *)kCFBundleIdentifierKey: self.appBundleIdentifier,
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    [[self device] installApplication:[self uniqueAppURL] withOptions:installOptions error:&amp;error];
</del><ins>+    NSError *error = nil;
+    [self.device installApplication:[NSURL fileURLWithPath:self.appPath] withOptions:installOptions error:&amp;error];
</ins><span class="cx">     if (error) {
</span><del>-        NSLog(@&quot;Couldn't install %@: %@&quot;, [[self uniqueAppURL] path], [error description]);
</del><ins>+        NSLog(@&quot;Couldn't install %@: %@&quot;, self.appPath, error.description);
</ins><span class="cx">         exit(EXIT_FAILURE);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -207,6 +177,7 @@
</span><span class="cx">         NSString *productDirectory = [self productDir];
</span><span class="cx"> 
</span><span class="cx">         NSMutableDictionary *dictionary = [@{
</span><ins>+            @&quot;IPC_IDENTIFIER&quot;: self.ipcIdentifier,
</ins><span class="cx">             @&quot;DYLD_FRAMEWORK_PATH&quot;: productDirectory,
</span><span class="cx">             @&quot;__XPC_DYLD_FRAMEWORK_PATH&quot;: productDirectory,
</span><span class="cx">             @&quot;DYLD_LIBRARY_PATH&quot;: productDirectory,
</span><span class="lines">@@ -236,10 +207,10 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     NSError *error;
</span><del>-    pid_t pid = [[self device] launchApplicationWithID:[self uniqueAppIdentifier] options:launchOptions error:&amp;error];
</del><ins>+    pid_t pid = [self.device launchApplicationWithID:self.appBundleIdentifier options:launchOptions error:&amp;error];
</ins><span class="cx"> 
</span><span class="cx">     if (pid &lt; 0) {
</span><del>-        NSLog(@&quot;Couldn't launch unique app instance %@: %@&quot;, [self uniqueAppIdentifier], [error description]);
</del><ins>+        NSLog(@&quot;Couldn't launch %@: %@&quot;, self.appBundleIdentifier, error.description);
</ins><span class="cx">         exit(EXIT_FAILURE);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -257,7 +228,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)start
</span><span class="cx"> {
</span><del>-    [self createUniqueApp];
</del><ins>+    [self installApp];
</ins><span class="cx">     [[self relay] setup];
</span><span class="cx">     [self launchApp];
</span><span class="cx">     [[self relay] connect];
</span></span></pre></div>
<a id="trunkToolsLayoutTestRelayLayoutTestRelaymainm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/LayoutTestRelay/LayoutTestRelay/main.m        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -32,42 +32,15 @@
</span><span class="cx"> void usage()
</span><span class="cx"> {
</span><span class="cx">     NSString *helpText = @&quot;LayoutTestRelay: run a dump tool in the simulator. Not for direct consumption.\n&quot;
</span><del>-    &quot;Usage: LayoutTestRelay [-h] [options] -- [dump tool arguments]\n&quot;
-    &quot;Required options:\n&quot;
-    &quot;    -app &lt;app_path&gt;          Path to the built iOS .app bundle directory.\n&quot;
-    &quot;    -runtime &lt;identifier&gt;    iOS Simulator Runtime identifier (see `xcrun -sdk iphonesimulator simctl`)\n&quot;
-    &quot;    -deviceType &lt;identifier&gt; iOS Simulator device identifier (see simctl).\n&quot;
-    &quot;    -suffix &lt;text&gt;           Used to create multiple unique instances when installing to the simulator.\n&quot;
-    &quot;    -productDir &lt;dir&gt;        /path/to/WebKitBuild/{configuration}-{short platform}.\n&quot;;
</del><ins>+        &quot;Usage: LayoutTestRelay [-h] [options] -- [dump tool arguments]\n&quot;
+        &quot;Required options:\n&quot;
+        &quot;    -udid &lt;identifier&gt;       Simulator device identifier\n&quot;
+        &quot;    -app &lt;app_path&gt;          Path to the built iOS .app bundle directory.\n&quot;
+        &quot;    -productDir &lt;dir&gt;        /path/to/WebKitBuild/{configuration}-{short platform}.\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">     fprintf(stderr, &quot;%s\n&quot;, [helpText UTF8String]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SimDevice *getTestingSimDevice(SimDeviceType *deviceType, SimRuntime *runtime, NSString *suffix)
-{
-    NSString *deviceName = [[[[deviceType identifier] componentsSeparatedByString:@&quot;.&quot;] lastObject] stringByReplacingOccurrencesOfString:@&quot;-&quot; withString:@&quot; &quot;];
-    deviceName = [NSString stringWithFormat:@&quot;%@%@%@&quot;, deviceName, @&quot; WebKit Tester&quot;, suffix];
-
-    for (SimDevice *device in [[SimDeviceSet defaultSet] devices]) {
-        if ([[device name] isEqualToString:deviceName] &amp;&amp; [[device deviceType] isEqualTo:deviceType] &amp;&amp; [[device runtime] isEqualTo:runtime])
-            return device;
-    }
-
-    NSError *error;
-    SimDevice *device = [[SimDeviceSet defaultSet] createDeviceWithType:deviceType runtime:runtime name:deviceName error:&amp;error];
-
-    if (error) {
-        NSLog(@&quot;Couldn't create device: %@&quot;, [error description]);
-        return nil;
-    }
-
-    while ([device state] == SimDeviceStateCreating)
-        sleep(1);
-
-    return device;
-}
-
-
</del><span class="cx"> NSString *getRequiredStringArgument(NSString *parameter)
</span><span class="cx"> {
</span><span class="cx">     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
</span><span class="lines">@@ -117,28 +90,19 @@
</span><span class="cx">                 exit(EXIT_FAILURE);
</span><span class="cx">             }
</span><span class="cx">         }
</span><ins>+
+        NSUUID *udid = [[NSUUID alloc] initWithUUIDString:getRequiredStringArgument(@&quot;udid&quot;)];
</ins><span class="cx">         NSString *appPath = getRequiredStringArgument(@&quot;app&quot;);
</span><del>-        NSString *runtimeIdentifier = getRequiredStringArgument(@&quot;runtime&quot;);
-        SimRuntime *runtime = [SimRuntime supportedRuntimesByIdentifier][runtimeIdentifier];
-        if (!runtime) {
-            NSLog(@&quot;There is no supported runtime \&quot;%@\&quot;&quot;, runtimeIdentifier);
-            exit(EXIT_FAILURE);
-        }
</del><ins>+        NSString *productDirectory = getRequiredStringArgument(@&quot;productDir&quot;);
+        NSArray *dumpToolArguments = getDumpToolArguments();
</ins><span class="cx"> 
</span><del>-        NSString *deviceTypeIdentifier = getRequiredStringArgument(@&quot;deviceType&quot;);
-        SimDeviceType *deviceType = [SimDeviceType supportedDeviceTypesByIdentifier][deviceTypeIdentifier];
-        if (!deviceType) {
-            NSLog(@&quot;There is no supported device type \&quot;%@\&quot;&quot;, deviceTypeIdentifier);
</del><ins>+        SimDevice *device = [SimDeviceSet.defaultSet.devicesByUDID objectForKey:udid];
+        if (!device) {
+            NSLog(@&quot;Device %@ couldn't be found&quot;, udid);
</ins><span class="cx">             exit(EXIT_FAILURE);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        NSString *suffix = getRequiredStringArgument(@&quot;suffix&quot;);
-        NSString *productDir = getRequiredStringArgument(@&quot;productDir&quot;);
-        NSArray *dumpToolArguments = getDumpToolArguments();
-
-        SimDevice *device = getTestingSimDevice(deviceType, runtime, suffix);
-
-        relayController = [[LTRelayController alloc] initWithDevice:device productDir:productDir appPath:appPath identifierSuffix:suffix dumpToolArguments:dumpToolArguments];
</del><ins>+        relayController = [[LTRelayController alloc] initWithDevice:device productDir:productDirectory appPath:appPath deviceUDID:udid dumpToolArguments:dumpToolArguments];
</ins><span class="cx">         [relayController start];
</span><span class="cx"> 
</span><span class="cx">         atexit(finish);
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -594,9 +594,7 @@
</span><span class="cx">         dump_tool_args = cmd[1:]
</span><span class="cx">         product_dir = self._port._build_path()
</span><span class="cx">         relay_args = [
</span><del>-            '-runtime', self._port.simulator_runtime.identifier,
-            '-deviceType', self._port.simulator_device_type.identifier,
-            '-suffix', str(self._worker_number),
</del><ins>+            '-udid', self._port.testing_device(self._worker_number).udid,
</ins><span class="cx">             '-productDir', product_dir,
</span><span class="cx">             '-app', dump_tool,
</span><span class="cx">         ]
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosTestControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -46,10 +46,10 @@
</span><span class="cx"> 
</span><span class="cx"> void TestController::platformInitialize()
</span><span class="cx"> {
</span><del>-    NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
-    const char *stdinPath = [[NSString stringWithFormat:@&quot;/tmp/%@_IN&quot;, identifier] UTF8String];
-    const char *stdoutPath = [[NSString stringWithFormat:@&quot;/tmp/%@_OUT&quot;, identifier] UTF8String];
-    const char *stderrPath = [[NSString stringWithFormat:@&quot;/tmp/%@_ERROR&quot;, identifier] UTF8String];
</del><ins>+    const char* identifier = getenv(&quot;IPC_IDENTIFIER&quot;);
+    const char *stdinPath = [[NSString stringWithFormat:@&quot;/tmp/%s_IN&quot;, identifier] UTF8String];
+    const char *stdoutPath = [[NSString stringWithFormat:@&quot;/tmp/%s_OUT&quot;, identifier] UTF8String];
+    const char *stderrPath = [[NSString stringWithFormat:@&quot;/tmp/%s_ERROR&quot;, identifier] UTF8String];
</ins><span class="cx"> 
</span><span class="cx">     int infd = open(stdinPath, O_RDWR);
</span><span class="cx">     dup2(infd, STDIN_FILENO);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosmainIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/mainIOS.mm (202742 => 202743)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/mainIOS.mm        2016-07-01 17:06:57 UTC (rev 202742)
+++ trunk/Tools/WebKitTestRunner/ios/mainIOS.mm        2016-07-01 17:08:38 UTC (rev 202743)
</span><span class="lines">@@ -52,24 +52,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)applicationDidEnterBackground:(UIApplication *)application
</span><span class="cx"> {
</span><del>-    /* Apps will get suspended or killed some time after entering the background state but we want to be able to run multiple copies of DumpRenderTree. Periodically check to see if our remaining background time dips below a threshold and create a new background task.
-    */
-    void (^expirationHandler)() = ^ {
-        [application endBackgroundTask:backgroundTaskIdentifier];
-        backgroundTaskIdentifier = UIBackgroundTaskInvalid;
-    };
-
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        NSTimeInterval timeRemaining;
-        while (true) {
-            timeRemaining = [application backgroundTimeRemaining];
-            if (timeRemaining &lt;= 10.0 || backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
-                [application endBackgroundTask:backgroundTaskIdentifier];
-                backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:expirationHandler];
-            }
-            sleep(5);
-        }
-    });
</del><ins>+    RELEASE_ASSERT_NOT_REACHED();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_handleHIDEvent:(IOHIDEventRef)event
</span></span></pre>
</div>
</div>

</body>
</html>