Title: [279496] trunk/Tools
Revision
279496
Author
jbed...@apple.com
Date
2021-07-01 21:05:41 -0700 (Thu, 01 Jul 2021)

Log Message

[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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (279495 => 279496)


--- trunk/Tools/ChangeLog	2021-07-02 03:14:26 UTC (rev 279495)
+++ trunk/Tools/ChangeLog	2021-07-02 04:05:41 UTC (rev 279496)
@@ -1,3 +1,21 @@
+2021-07-01  Jonathan Bedard  <jbed...@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):
+
 2021-07-01  Alex Christensen  <achristen...@webkit.org>
 
         loadSimulatedRequest: should do same delegate callbacks as loadHTMLString and loadData

Modified: trunk/Tools/Scripts/webkitpy/xcode/device_type.py (279495 => 279496)


--- 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)
@@ -64,7 +64,7 @@
         if self.software_variant:
             return
 
-        self.software_variant = 'iOS'
+        self.software_variant = None
         if self.hardware_family.lower().split(' ')[-1].startswith('watch'):
             self.hardware_family = 'Apple Watch'
             self.software_variant = 'watchOS'
@@ -71,21 +71,20 @@
         elif self.hardware_family.lower().split(' ')[-1].startswith('tv'):
             self.hardware_family = 'Apple TV'
             self.software_variant = 'tvOS'
+        elif self.hardware_family.lower().startswith('ipad') or self.hardware_family.lower().startswith('iphone'):
+            self.software_variant = 'iOS'
 
     def check_consistency(self):
         if self.hardware_family is not None:
-            assert self.software_variant is not None
             if self.hardware_family == 'Apple Watch':
                 assert self.software_variant == 'watchOS'
             elif self.hardware_family == 'Apple TV':
                 assert self.software_variant == 'tvOS'
-            else:
+            elif self.hardware_family in ('iPhone', 'iPad'):
                 assert self.software_variant == 'iOS'
 
         if self.hardware_type is not None:
             assert self.hardware_family is not None
-        if self.software_version:
-            assert self.software_variant is not None
 
     def __init__(self, hardware_family=None, hardware_type=None, software_version=None, software_variant=None):
         """
@@ -146,11 +145,11 @@
 
     def __contains__(self, other):
         assert isinstance(other, DeviceType)
-        if self.hardware_family is not None and (not other.hardware_family or self.hardware_family.lower() != other.hardware_family.lower()):
+        if self.hardware_family is not None and other.hardware_family is not None and self.hardware_family.lower() != other.hardware_family.lower():
             return False
-        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()):
+        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():
             return False
-        if self.software_variant is not None and (not other.software_variant or self.software_variant.lower() != other.software_variant.lower()):
+        if self.software_variant is not None and other.software_variant is not None and self.software_variant.lower() != other.software_variant.lower():
             return False
         if self.software_version is not None and other.software_version is not None and not other.software_version in self.software_version:
             return False

Modified: trunk/Tools/Scripts/webkitpy/xcode/device_type_unittest.py (279495 => 279496)


--- 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)
@@ -104,7 +104,6 @@
         self.assertEqual('iPad Air 2 running iOS', str(DeviceType.from_string('iPad Air 2')))
         self.assertEqual('Apple Watch Series 2 - 42mm running watchOS', str(DeviceType.from_string('Apple Watch Series 2 - 42mm')))
         self.assertEqual('Apple TV 4K running tvOS', str(DeviceType.from_string('Apple TV 4K')))
-        self.assertEqual('Device running iOS', str(DeviceType.from_string('')))
         self.assertEqual('Apple Watch running watchOS', str(DeviceType.from_string('Apple Watch')))
 
     def test_comparison(self):
@@ -141,7 +140,7 @@
 
     def test_contained_in(self):
         self.assertTrue(DeviceType.from_string('iPhone 6s') in DeviceType.from_string('iPhone'))
-        self.assertFalse(DeviceType.from_string('iPhone') in DeviceType.from_string('iPhone 6s'))
+        self.assertFalse(DeviceType.from_string('iPad') in DeviceType.from_string('iPhone 6s'))
         self.assertTrue(DeviceType.from_string('iPhone', Version(11, 1)) in DeviceType.from_string('iPhone', Version(11)))
         self.assertFalse(DeviceType.from_string('iPhone', Version(11)) in DeviceType.from_string('iPhone', Version(11, 1)))
 

Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (279495 => 279496)


--- 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)
@@ -112,7 +112,7 @@
         try:
             device_type_string = SimulatedDeviceManager._device_identifier_to_name[readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']]
             device_type = DeviceType.from_string(device_type_string, runtime.version)
-            assert device_type.software_variant == runtime.os_variant
+            device_type.software_variant = runtime.os_variant
         except (ValueError, AssertionError):
             return None
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to