<!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>[285772] 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/285772">285772</a></dd>
<dt>Author</dt> <dd>jbedard@apple.com</dd>
<dt>Date</dt> <dd>2021-11-12 20:45:28 -0800 (Fri, 12 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[webkitpy] Symlink daemons into simulator runtime root
https://bugs.webkit.org/show_bug.cgi?id=233080
<rdar://problem/85362551>

Reviewed by Brady Eidson.

* Scripts/webkitpy/api_tests/manager.py:
(Manager._initialize_devices): Symlink daemons in the WebKit.framework into
simulator runtime root.
* Scripts/webkitpy/common/system/filesystem.py:
(FileSystem.symlink):
* Scripts/webkitpy/common/system/filesystem_mock.py:
(MockFileSystem.symlink):
* Scripts/webkitpy/port/darwin.py:
(DarwinPort.path_to_daemons):
* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager.Runtime.__init__): Add root.
(SimulatedDeviceManager._create_device_with_runtime): Pass runtime.
(SimulatedDevice.__init__): Link to runtime.
* Scripts/webkitpy/xcode/simulated_device_unittest.py:

Canonical link: https://commits.webkit.org/244216@main</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyapi_testsmanagerpy">trunk/Tools/Scripts/webkitpy/api_tests/manager.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemfilesystempy">trunk/Tools/Scripts/webkitpy/common/system/filesystem.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemfilesystem_mockpy">trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdarwinpy">trunk/Tools/Scripts/webkitpy/port/darwin.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyxcodesimulated_devicepy">trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyxcodesimulated_device_unittestpy">trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/ChangeLog       2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2021-11-12  Jonathan Bedard  <jbedard@apple.com>
+
+        [webkitpy] Symlink daemons into simulator runtime root
+        https://bugs.webkit.org/show_bug.cgi?id=233080
+        <rdar://problem/85362551>
+
+        Reviewed by Brady Eidson.
+
+        * Scripts/webkitpy/api_tests/manager.py:
+        (Manager._initialize_devices): Symlink daemons in the WebKit.framework into
+        simulator runtime root.
+        * Scripts/webkitpy/common/system/filesystem.py:
+        (FileSystem.symlink):
+        * Scripts/webkitpy/common/system/filesystem_mock.py:
+        (MockFileSystem.symlink):
+        * Scripts/webkitpy/port/darwin.py:
+        (DarwinPort.path_to_daemons):
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDeviceManager.Runtime.__init__): Add root.
+        (SimulatedDeviceManager._create_device_with_runtime): Pass runtime.
+        (SimulatedDevice.__init__): Link to runtime.
+        * Scripts/webkitpy/xcode/simulated_device_unittest.py:
+
</ins><span class="cx"> 2021-11-12  Darin Adler  <darin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Make sort-Xcode-project-file idempotent
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyapi_testsmanagerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/api_tests/manager.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/api_tests/manager.py        2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/api_tests/manager.py   2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -152,6 +152,22 @@
</span><span class="cx">     def _initialize_devices(self):
</span><span class="cx">         if 'simulator' in self._port.port_name:
</span><span class="cx">             SimulatedDeviceManager.initialize_devices(DeviceRequest(self._port.DEVICE_TYPE, allow_incomplete_match=True), self.host, simulator_ui=False)
</span><ins>+
+            # A Daemons executable path must be located within the runtime root.
+            roots = {
+                device.platform_device.runtime.root for device in SimulatedDeviceManager.INITIALIZED_DEVICES
+                if device.platform_device.runtime and device.platform_device.runtime.root
+            }
+            fs = self._port.host.filesystem
+            for root in roots:
+                _log.debug("Linking Daemons into runtime root '{}'".format(root))
+                for file in fs.files_under(self._port.path_to_daemons()):
+                    target = fs.join(root, 'usr', 'local', 'bin', 'webkit-testing', fs.basename(file))
+                    fs.maybe_make_directory(fs.dirname(target))
+                    if fs.isfile(target):
+                        fs.remove(target)
+                    fs.symlink(file, target)
+
</ins><span class="cx">         elif 'device' in self._port.port_name:
</span><span class="cx">             raise RuntimeError('Running api tests on {} is not supported'.format(self._port.port_name))
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemfilesystempy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/filesystem.py 2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem.py    2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -339,3 +339,6 @@
</span><span class="cx">             self.copytree(source, destination)
</span><span class="cx">         else:
</span><span class="cx">             self.copyfile(source, destination)
</span><ins>+
+    def symlink(self, *args, **kwargs):
+        os.symlink(*args, **kwargs)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemfilesystem_mockpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py    2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py       2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -436,7 +436,10 @@
</span><span class="cx">     def copy_from_base_host(self, source, destination):
</span><span class="cx">         self.move(source, destination)
</span><span class="cx"> 
</span><ins>+    def symlink(self, src, dst):
+        self.move(src, dst)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class WritableBinaryFileObject(object):
</span><span class="cx">     def __init__(self, fs, path):
</span><span class="cx">         self.fs = fs
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdarwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/darwin.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/darwin.py      2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/port/darwin.py 2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -82,6 +82,9 @@
</span><span class="cx">     def _path_to_webcore_library(self):
</span><span class="cx">         return self._build_path('WebCore.framework/Versions/A/WebCore')
</span><span class="cx"> 
</span><ins>+    def path_to_daemons(self):
+        return self._build_path('WebKit.framework/Daemons')
+
</ins><span class="cx">     def show_results_html_file(self, results_filename):
</span><span class="cx">         # We don't use self._run_script() because we don't want to wait for the script
</span><span class="cx">         # to exit and we want the output to show up on stdout in case there are errors
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyxcodesimulated_devicepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py   2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py      2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">             self.version = Version.from_string(runtime_dict['version'])
</span><span class="cx">             self.identifier = runtime_dict['identifier']
</span><span class="cx">             self.name = runtime_dict['name']
</span><ins>+            self.root = runtime_dict.get('runtimeRoot')
</ins><span class="cx"> 
</span><span class="cx">     AVAILABLE_RUNTIMES = []
</span><span class="cx">     AVAILABLE_DEVICES = []
</span><span class="lines">@@ -123,6 +124,7 @@
</span><span class="cx">             host=host,
</span><span class="cx">             device_type=device_type,
</span><span class="cx">             build_version=runtime.build_version,
</span><ins>+            runtime=runtime,
</ins><span class="cx">         ))
</span><span class="cx">         SimulatedDeviceManager.AVAILABLE_DEVICES.append(result)
</span><span class="cx">         return result
</span><span class="lines">@@ -544,7 +546,7 @@
</span><span class="cx">         'watchOS': 'com.apple.carousel.sessionservice',
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    def __init__(self, name, udid, host, device_type, build_version):
</del><ins>+    def __init__(self, name, udid, host, device_type, build_version, runtime):
</ins><span class="cx">         assert device_type.software_version
</span><span class="cx"> 
</span><span class="cx">         self.name = name
</span><span class="lines">@@ -551,6 +553,7 @@
</span><span class="cx">         self.udid = udid
</span><span class="cx">         self.device_type = device_type
</span><span class="cx">         self.build_version = build_version
</span><ins>+        self.runtime = runtime
</ins><span class="cx">         self._state = SimulatedDevice.DeviceState.SHUTTING_DOWN
</span><span class="cx"> 
</span><span class="cx">         self.executive = host.executive
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyxcodesimulated_device_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py (285771 => 285772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py  2021-11-13 03:22:14 UTC (rev 285771)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py     2021-11-13 04:45:28 UTC (rev 285772)
</span><span class="lines">@@ -168,7 +168,8 @@
</span><span class="cx">      "availability" : "(available)",
</span><span class="cx">      "name" : "iOS 9.3",
</span><span class="cx">      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-9-3",
</span><del>-     "version" : "9.3"
</del><ins>+     "version" : "9.3",
+     "runtimeRoot" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot"
</ins><span class="cx">    },
</span><span class="cx">    {
</span><span class="cx">      "buildversion" : "15A8401",
</span><span class="lines">@@ -175,7 +176,8 @@
</span><span class="cx">      "availability" : "(available)",
</span><span class="cx">      "name" : "iOS 11.0",
</span><span class="cx">      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-0",
</span><del>-     "version" : "11.0.1"
</del><ins>+     "version" : "11.0.1",
+     "runtimeRoot" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 11.0.1.simruntime/Contents/Resources/RuntimeRoot"
</ins><span class="cx">    },
</span><span class="cx">    {
</span><span class="cx">      "buildversion" : "15J380",
</span><span class="lines">@@ -182,7 +184,8 @@
</span><span class="cx">      "availability" : "(available)",
</span><span class="cx">      "name" : "tvOS 11.0",
</span><span class="cx">      "identifier" : "com.apple.CoreSimulator.SimRuntime.tvOS-11-0",
</span><del>-     "version" : "11.0"
</del><ins>+     "version" : "11.0",
+     "runtimeRoot" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 11.simruntime/Contents/Resources/RuntimeRoot"
</ins><span class="cx">    },
</span><span class="cx">    {
</span><span class="cx">      "buildversion" : "15R372",
</span><span class="lines">@@ -189,7 +192,8 @@
</span><span class="cx">      "availability" : "(available)",
</span><span class="cx">      "name" : "watchOS 4.0",
</span><span class="cx">      "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-0",
</span><del>-     "version" : "4.0"
</del><ins>+     "version" : "4.0",
+     "runtimeRoot" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/watchOS 4.simruntime/Contents/Resources/RuntimeRoot"
</ins><span class="cx">    },
</span><span class="cx">    {
</span><span class="cx">      "buildversion" : "16A367",
</span><span class="lines">@@ -196,7 +200,8 @@
</span><span class="cx">      "isAvailable" : "YES",
</span><span class="cx">      "name" : "iOS 12.0",
</span><span class="cx">      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-12-0",
</span><del>-     "version" : "12.0"
</del><ins>+     "version" : "12.0",
+     "runtimeRoot" : "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 12.simruntime/Contents/Resources/RuntimeRoot"
</ins><span class="cx">    }
</span><span class="cx">  ],
</span><span class="cx">  "devices" : {
</span></span></pre>
</div>
</div>

</body>
</html>