Access expectations path through apple_additions
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 18:09:06 +0000 (18:09 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 18:09:06 +0000 (18:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174800
<rdar://problem/33498899>

Reviewed by David Kilzer.

Follow-up fix. Mapping of operating system names was done incorrectly.

* Scripts/webkitpy/port/ios.py:
(IOSPort._apple_additions_path): Correctly find the operating system to be replaced.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_layout_test_searchpath_with_apple_additions): Add test for operating
system name replacement.
* Scripts/webkitpy/port/ios_simulator_unittest.py:
(IOSSimulatorTest.test_layout_test_searchpath_with_apple_additions): Add test for operating
system name replacement.
* Scripts/webkitpy/port/mac.py: Correctly find the operating system to be replaced.
(MacPort._apple_additions_path):
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest.test_layout_test_searchpath_with_apple_additions): Add test for operating system
name replacement.
* Scripts/webkitpy/port/port_testcase.py:
(bind_mock_apple_additions.MockAppleAdditions.ios_os_name): Change the passed name so that
operating system name replacement can be tested.
(bind_mock_apple_additions.MockAppleAdditions.mac_os_name): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221087 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/ios.py
Tools/Scripts/webkitpy/port/ios_device_unittest.py
Tools/Scripts/webkitpy/port/ios_simulator_unittest.py
Tools/Scripts/webkitpy/port/mac.py
Tools/Scripts/webkitpy/port/mac_unittest.py
Tools/Scripts/webkitpy/port/port_testcase.py

index e4a7989..2347538 100644 (file)
@@ -4,6 +4,34 @@
         https://bugs.webkit.org/show_bug.cgi?id=174800
         <rdar://problem/33498899>
 
         https://bugs.webkit.org/show_bug.cgi?id=174800
         <rdar://problem/33498899>
 
+        Reviewed by David Kilzer.
+
+        Follow-up fix. Mapping of operating system names was done incorrectly.
+
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort._apple_additions_path): Correctly find the operating system to be replaced.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest.test_layout_test_searchpath_with_apple_additions): Add test for operating
+        system name replacement.
+        * Scripts/webkitpy/port/ios_simulator_unittest.py:
+        (IOSSimulatorTest.test_layout_test_searchpath_with_apple_additions): Add test for operating
+        system name replacement.
+        * Scripts/webkitpy/port/mac.py: Correctly find the operating system to be replaced.
+        (MacPort._apple_additions_path):
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest.test_layout_test_searchpath_with_apple_additions): Add test for operating system
+        name replacement.
+        * Scripts/webkitpy/port/port_testcase.py:
+        (bind_mock_apple_additions.MockAppleAdditions.ios_os_name): Change the passed name so that
+        operating system name replacement can be tested.
+        (bind_mock_apple_additions.MockAppleAdditions.mac_os_name): Ditto.
+
+2017-08-23  Jonathan Bedard  <jbedard@apple.com>
+
+        Access expectations path through apple_additions
+        https://bugs.webkit.org/show_bug.cgi?id=174800
+        <rdar://problem/33498899>
+
         Reviewed by Alexey Proskuryakov.
 
         When external test expectations are imported through additional-platform-directory, they will
         Reviewed by Alexey Proskuryakov.
 
         When external test expectations are imported through additional-platform-directory, they will
index 7e70b9b..1c944e9 100644 (file)
@@ -91,11 +91,16 @@ class IOSPort(DarwinPort):
         if name == 'wk2':
             return None
         split_name = name.split('-')
         if name == 'wk2':
             return None
         split_name = name.split('-')
-        if len(split_name) > 1 and split_name[1] != 'wk1' and split_name[1] != 'wk2' and split_name[1] != 'simulator' and split_name[1] != 'device':
-            os_name = apple_additions().ios_os_name(split_name[1])
+        os_index = -1
+        for i in xrange(2):
+            if split_name[os_index] == 'wk1' or split_name[os_index] == 'wk2' or split_name[os_index] == 'simulator' or split_name[os_index] == 'device':
+                os_index -= 1
+        if split_name[os_index] != split_name[0]:
+            os_name = apple_additions().mac_os_name(split_name[os_index])
             if not os_name:
                 return None
             if not os_name:
                 return None
-            name = split_name[0] + '-' + os_name + ('-' + '-'.join(split_name[2:]) if len(split_name) > 2 else '')
+            split_name[os_index] = os_name
+        name = '-'.join(split_name)
         return self._filesystem.join(apple_additions().layout_tests_path(), name)
 
     @memoized
         return self._filesystem.join(apple_additions().layout_tests_path(), name)
 
     @memoized
index 64682ec..ff2fdf9 100644 (file)
@@ -93,15 +93,15 @@ class IOSDeviceTest(ios_testcase.IOSTest):
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
-        self.assertEqual(search_path[0], '/additional_testing_path/ios-device-11-wk1')
+        self.assertEqual(search_path[0], '/additional_testing_path/ios-device-add-11-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-device-11-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-device-11-wk1')
-        self.assertEqual(search_path[2], '/additional_testing_path/ios-device-11')
+        self.assertEqual(search_path[2], '/additional_testing_path/ios-device-add-11')
         self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-device-11')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-device-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-device-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-device')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-device')
         self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-device-11')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-device-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-device-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-device')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-device')
-        self.assertEqual(search_path[8], '/additional_testing_path/ios-11')
+        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-11')
         self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-11')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
         self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-11')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
index 7f589bf..45b4744 100644 (file)
@@ -92,15 +92,15 @@ class IOSSimulatorTest(ios_testcase.IOSTest):
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
-        self.assertEqual(search_path[0], '/additional_testing_path/ios-simulator-8-wk1')
+        self.assertEqual(search_path[0], '/additional_testing_path/ios-simulator-add-8-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-simulator-8-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-simulator-8-wk1')
-        self.assertEqual(search_path[2], '/additional_testing_path/ios-simulator-8')
+        self.assertEqual(search_path[2], '/additional_testing_path/ios-simulator-add-8')
         self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-simulator-8')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-simulator-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-simulator-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-simulator')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-simulator')
         self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-simulator-8')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-simulator-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-simulator-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-simulator')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-simulator')
-        self.assertEqual(search_path[8], '/additional_testing_path/ios-8')
+        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-8')
         self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-8')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
         self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-8')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
index 23b999e..cd8aead 100644 (file)
@@ -61,11 +61,15 @@ class MacPort(DarwinPort):
         if name == 'wk2':
             return None
         split_name = name.split('-')
         if name == 'wk2':
             return None
         split_name = name.split('-')
-        if len(split_name) > 1 and split_name[1] != 'wk1' and split_name[1] != 'wk2':
-            os_name = apple_additions().mac_os_name(split_name[1])
+        os_index = -1
+        if split_name[-1] == 'wk1' or split_name[-1] == 'wk2':
+            os_index = -2
+        if split_name[os_index] != split_name[0]:
+            os_name = apple_additions().mac_os_name(split_name[os_index])
             if not os_name:
                 return None
             if not os_name:
                 return None
-            name = split_name[0] + '-' + os_name + ('-' + '-'.join(split_name[2:])) if len(split_name) > 2 else ''
+            split_name[os_index] = os_name
+        name = '-'.join(split_name)
         return self._filesystem.join(apple_additions().layout_tests_path(), name)
 
     @memoized
         return self._filesystem.join(apple_additions().layout_tests_path(), name)
 
     @memoized
index 1fca397..b2ec06f 100644 (file)
@@ -146,5 +146,7 @@ class MacTest(darwin_testcase.DarwinTest):
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
-        self.assertEqual(search_path[0], '/additional_testing_path/mac-lion-wk1')
+        self.assertEqual(search_path[0], '/additional_testing_path/mac-add-lion-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/mac-lion-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/mac-lion-wk1')
+        self.assertEqual(search_path[2], '/additional_testing_path/mac-add-lion')
+        self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/mac-lion')
index 6f34e5c..29e827d 100644 (file)
@@ -87,11 +87,11 @@ def bind_mock_apple_additions():
 
         @staticmethod
         def ios_os_name(name):
 
         @staticmethod
         def ios_os_name(name):
-            return name
+            return 'add-{}'.format(name)
 
         @staticmethod
         def mac_os_name(name):
 
         @staticmethod
         def mac_os_name(name):
-            return name
+            return 'add-{}'.format(name)
 
     # apple_additions is a memoized function. Take advantage of this fact and manipulate the cache
     # to temporarily return a mocked result
 
     # apple_additions is a memoized function. Take advantage of this fact and manipulate the cache
     # to temporarily return a mocked result