<!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>[279496] 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/279496">279496</a></dd>
<dt>Author</dt> <dd>jbedard@apple.com</dd>
<dt>Date</dt> <dd>2021-07-01 21:05:41 -0700 (Thu, 01 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[run-webkit-tests] Set software_variant from runtime
https://bugs.webkit.org/show_bug.cgi?id=227600
<rdar://problem/80052263>

Reviewed by Stephanie Lewis.

* Scripts/webkitpy/xcode/device_type.py:
(DeviceType._define_software_variant_from_hardware_family):
(DeviceType.check_consistency):
(DeviceType.__contains__):
* Scripts/webkitpy/xcode/device_type_unittest.py:
(DeviceTypeTest.test_from_string):
(DeviceTypeTest.test_contained_in):
* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager._create_device_with_runtime):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyxcodedevice_typepy">trunk/Tools/Scripts/webkitpy/xcode/device_type.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyxcodedevice_type_unittestpy">trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyxcodesimulated_devicepy">trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (279495 => 279496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-07-02 03:14:26 UTC (rev 279495)
+++ trunk/Tools/ChangeLog       2021-07-02 04:05:41 UTC (rev 279496)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2021-07-01  Jonathan Bedard  <jbedard@apple.com>
+
+        [run-webkit-tests] Set software_variant from runtime
+        https://bugs.webkit.org/show_bug.cgi?id=227600
+        <rdar://problem/80052263>
+
+        Reviewed by Stephanie Lewis.
+
+        * Scripts/webkitpy/xcode/device_type.py:
+        (DeviceType._define_software_variant_from_hardware_family):
+        (DeviceType.check_consistency):
+        (DeviceType.__contains__):
+        * Scripts/webkitpy/xcode/device_type_unittest.py:
+        (DeviceTypeTest.test_from_string):
+        (DeviceTypeTest.test_contained_in):
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDeviceManager._create_device_with_runtime):
+
</ins><span class="cx"> 2021-07-01  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         loadSimulatedRequest: should do same delegate callbacks as loadHTMLString and loadData
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyxcodedevice_typepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/xcode/device_type.py (279495 => 279496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/xcode/device_type.py        2021-07-02 03:14:26 UTC (rev 279495)
+++ trunk/Tools/Scripts/webkitpy/xcode/device_type.py   2021-07-02 04:05:41 UTC (rev 279496)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         if self.software_variant:
</span><span class="cx">             return
</span><span class="cx"> 
</span><del>-        self.software_variant = 'iOS'
</del><ins>+        self.software_variant = None
</ins><span class="cx">         if self.hardware_family.lower().split(' ')[-1].startswith('watch'):
</span><span class="cx">             self.hardware_family = 'Apple Watch'
</span><span class="cx">             self.software_variant = 'watchOS'
</span><span class="lines">@@ -71,21 +71,20 @@
</span><span class="cx">         elif self.hardware_family.lower().split(' ')[-1].startswith('tv'):
</span><span class="cx">             self.hardware_family = 'Apple TV'
</span><span class="cx">             self.software_variant = 'tvOS'
</span><ins>+        elif self.hardware_family.lower().startswith('ipad') or self.hardware_family.lower().startswith('iphone'):
+            self.software_variant = 'iOS'
</ins><span class="cx"> 
</span><span class="cx">     def check_consistency(self):
</span><span class="cx">         if self.hardware_family is not None:
</span><del>-            assert self.software_variant is not None
</del><span class="cx">             if self.hardware_family == 'Apple Watch':
</span><span class="cx">                 assert self.software_variant == 'watchOS'
</span><span class="cx">             elif self.hardware_family == 'Apple TV':
</span><span class="cx">                 assert self.software_variant == 'tvOS'
</span><del>-            else:
</del><ins>+            elif self.hardware_family in ('iPhone', 'iPad'):
</ins><span class="cx">                 assert self.software_variant == 'iOS'
</span><span class="cx"> 
</span><span class="cx">         if self.hardware_type is not None:
</span><span class="cx">             assert self.hardware_family is not None
</span><del>-        if self.software_version:
-            assert self.software_variant is not None
</del><span class="cx"> 
</span><span class="cx">     def __init__(self, hardware_family=None, hardware_type=None, software_version=None, software_variant=None):
</span><span class="cx">         """
</span><span class="lines">@@ -146,11 +145,11 @@
</span><span class="cx"> 
</span><span class="cx">     def __contains__(self, other):
</span><span class="cx">         assert isinstance(other, DeviceType)
</span><del>-        if self.hardware_family is not None and (not other.hardware_family or self.hardware_family.lower() != other.hardware_family.lower()):
</del><ins>+        if self.hardware_family is not None and other.hardware_family is not None and self.hardware_family.lower() != other.hardware_family.lower():
</ins><span class="cx">             return False
</span><del>-        if self.standardized_hardware_type is not None and (not other.standardized_hardware_type or self.standardized_hardware_type.lower() != other.standardized_hardware_type.lower()):
</del><ins>+        if self.standardized_hardware_type is not None and other.standardized_hardware_type is not None and self.standardized_hardware_type.lower() != other.standardized_hardware_type.lower():
</ins><span class="cx">             return False
</span><del>-        if self.software_variant is not None and (not other.software_variant or self.software_variant.lower() != other.software_variant.lower()):
</del><ins>+        if self.software_variant is not None and other.software_variant is not None and self.software_variant.lower() != other.software_variant.lower():
</ins><span class="cx">             return False
</span><span class="cx">         if self.software_version is not None and other.software_version is not None and not other.software_version in self.software_version:
</span><span class="cx">             return False
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyxcodedevice_type_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py (279495 => 279496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py       2021-07-02 03:14:26 UTC (rev 279495)
+++ trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py  2021-07-02 04:05:41 UTC (rev 279496)
</span><span class="lines">@@ -104,7 +104,6 @@
</span><span class="cx">         self.assertEqual('iPad Air 2 running iOS', str(DeviceType.from_string('iPad Air 2')))
</span><span class="cx">         self.assertEqual('Apple Watch Series 2 - 42mm running watchOS', str(DeviceType.from_string('Apple Watch Series 2 - 42mm')))
</span><span class="cx">         self.assertEqual('Apple TV 4K running tvOS', str(DeviceType.from_string('Apple TV 4K')))
</span><del>-        self.assertEqual('Device running iOS', str(DeviceType.from_string('')))
</del><span class="cx">         self.assertEqual('Apple Watch running watchOS', str(DeviceType.from_string('Apple Watch')))
</span><span class="cx"> 
</span><span class="cx">     def test_comparison(self):
</span><span class="lines">@@ -141,7 +140,7 @@
</span><span class="cx"> 
</span><span class="cx">     def test_contained_in(self):
</span><span class="cx">         self.assertTrue(DeviceType.from_string('iPhone 6s') in DeviceType.from_string('iPhone'))
</span><del>-        self.assertFalse(DeviceType.from_string('iPhone') in DeviceType.from_string('iPhone 6s'))
</del><ins>+        self.assertFalse(DeviceType.from_string('iPad') in DeviceType.from_string('iPhone 6s'))
</ins><span class="cx">         self.assertTrue(DeviceType.from_string('iPhone', Version(11, 1)) in DeviceType.from_string('iPhone', Version(11)))
</span><span class="cx">         self.assertFalse(DeviceType.from_string('iPhone', Version(11)) in DeviceType.from_string('iPhone', Version(11, 1)))
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyxcodesimulated_devicepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (279495 => 279496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py   2021-07-02 03:14:26 UTC (rev 279495)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py      2021-07-02 04:05:41 UTC (rev 279496)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">         try:
</span><span class="cx">             device_type_string = SimulatedDeviceManager._device_identifier_to_name[readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']]
</span><span class="cx">             device_type = DeviceType.from_string(device_type_string, runtime.version)
</span><del>-            assert device_type.software_variant == runtime.os_variant
</del><ins>+            device_type.software_variant = runtime.os_variant
</ins><span class="cx">         except (ValueError, AssertionError):
</span><span class="cx">             return None
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>