Changeset 99781 in webkit
- Timestamp:
- Nov 9, 2011, 4:24:08 PM (15 years ago)
- Location:
- trunk/Tools
- Files:
-
- 14 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/base_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py (modified) (2 diffs)
-
Scripts/webkitpy/layout_tests/port/chromium_unittest.py (modified) (2 diffs)
-
Scripts/webkitpy/layout_tests/port/chromium_win.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py (modified) (5 diffs)
-
Scripts/webkitpy/layout_tests/port/efl_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/gtk_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/mac_unittest.py (modified) (2 diffs)
-
Scripts/webkitpy/layout_tests/port/port_testcase.py (modified) (19 diffs)
-
Scripts/webkitpy/layout_tests/port/qt_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/webkit_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/win_unittest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r99773 r99781 1 2011-11-09 Eric Seidel <eric@webkit.org> 2 3 Remove the concept of platform-dependent unittests 4 https://bugs.webkit.org/show_bug.cgi?id=71963 5 6 Reviewed by Adam Barth. 7 8 These have been the source of never-ending sadness. 9 We'd change behavior and forget to update results in 10 some unittests because they were only run on certain platforms. 11 This change removes a large source of these platform-dependent 12 unittests, which was caused by the port_maker stuff. 13 14 It's possible that this change will break test-webkitpy 15 on some platforms, but that will be a one-time cost. 16 I will fix the breakage by removing the platform-dependantness 17 of any such broken tests. 18 19 * Scripts/webkitpy/layout_tests/port/base_unittest.py: 20 * Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py: 21 * Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py: 22 * Scripts/webkitpy/layout_tests/port/chromium_unittest.py: 23 * Scripts/webkitpy/layout_tests/port/chromium_win.py: 24 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py: 25 * Scripts/webkitpy/layout_tests/port/efl_unittest.py: 26 * Scripts/webkitpy/layout_tests/port/gtk_unittest.py: 27 * Scripts/webkitpy/layout_tests/port/mac_unittest.py: 28 * Scripts/webkitpy/layout_tests/port/port_testcase.py: 29 * Scripts/webkitpy/layout_tests/port/qt_unittest.py: 30 * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: 31 * Scripts/webkitpy/layout_tests/port/win_unittest.py: 32 1 33 2011-11-09 Eric Seidel <eric@webkit.org> 2 34 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
r99773 r99781 49 49 50 50 class PortTest(unittest.TestCase): 51 def make_port(self, *args, **kwargs):52 kwargs.setdefault('host', MockHost())53 return Port( *args, **kwargs)51 def make_port(self, host=None, **kwargs): 52 host = host or MockHost() 53 return Port(host, **kwargs) 54 54 55 55 def test_format_wdiff_output_as_html(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py
r99773 r99781 37 37 38 38 class ChromiumLinuxPortTest(port_testcase.PortTestCase): 39 def port_maker(self, platform): 40 if not platform.startswith('linux'): 41 return None 42 return chromium_linux.ChromiumLinuxPort 39 port_maker = chromium_linux.ChromiumLinuxPort 43 40 44 def assert_architecture(self, port_name=None, file_output=None, 45 expected_architecture=None): 41 def assert_architecture(self, port_name=None, file_output=None, expected_architecture=None): 46 42 host = MockHost() 47 43 host.filesystem.exists = lambda x: 'DumpRenderTree' in x -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py
r99773 r99781 37 37 38 38 class ChromiumMacPortTest(port_testcase.PortTestCase): 39 def port_maker(self, platform): 40 # FIXME: This platform check should be removed! 41 if platform != 'darwin': 42 return None 43 return chromium_mac.ChromiumMacPort 39 port_maker = chromium_mac.ChromiumMacPort 44 40 45 41 def test_check_wdiff(self): 46 port = chromium_mac.ChromiumMacPort(MockHost()) 47 self.assertTrue(port.check_wdiff()) 42 self.assertTrue(self.make_port().check_wdiff()) 48 43 49 44 def assert_name(self, port_name, os_version_string, expected): 50 port = chromium_mac.ChromiumMacPort(MockHost(),port_name=port_name, os_version_string=os_version_string)45 port = self.make_port(port_name=port_name, os_version_string=os_version_string) 51 46 self.assertEquals(expected, port.name()) 52 47 53 48 def test_versions(self): 54 port = chromium_mac.ChromiumMacPort(MockHost()) 55 self.assertTrue(port.name() in ('chromium-cg-mac-leopard', 'chromium-cg-mac-snowleopard', 'chromium-cg-mac-lion', 'chromium-cg-mac-future')) 49 self.assertTrue(self.make_port().name() in ('chromium-cg-mac-leopard', 'chromium-cg-mac-snowleopard', 'chromium-cg-mac-lion', 'chromium-cg-mac-future')) 56 50 57 51 self.assert_name(None, '10.5.3', 'chromium-cg-mac-leopard') … … 77 71 78 72 def test_baseline_path(self): 79 port = chromium_mac.ChromiumMacPort(MockHost(),port_name='chromium-mac-leopard')73 port = self.make_port(port_name='chromium-mac-leopard') 80 74 self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac-leopard')) 81 75 82 port = chromium_mac.ChromiumMacPort(MockHost(),port_name='chromium-mac-snowleopard')76 port = self.make_port(port_name='chromium-mac-snowleopard') 83 77 self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac-snowleopard')) 84 78 85 port = chromium_mac.ChromiumMacPort(MockHost(),port_name='chromium-mac-lion')79 port = self.make_port(port_name='chromium-mac-lion') 86 80 self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac')) 87 81 88 82 def test_graphics_type(self): 89 port = chromium_mac.ChromiumMacPort(MockHost(), port_name='chromium-cg-mac') 90 self.assertEquals('cpu-cg', port.graphics_type()) 91 port = chromium_mac.ChromiumMacPort(MockHost(), port_name='chromium-mac') 92 self.assertEquals('cpu', port.graphics_type()) 83 self.assertEquals('cpu-cg', self.make_port(port_name='chromium-cg-mac').graphics_type()) 84 self.assertEquals('cpu', self.make_port(port_name='chromium-mac').graphics_type()) 93 85 # For now, Mac defaults to cpu-cg graphics type. 94 port = chromium_mac.ChromiumMacPort(MockHost()) 95 self.assertEquals('cpu-cg', port.graphics_type()) 86 self.assertEquals('cpu-cg', self.make_port().graphics_type()) 96 87 97 88 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
r99773 r99781 118 118 119 119 class ChromiumPortTest(port_testcase.PortTestCase): 120 def port_maker(self, platform): 121 return chromium.ChromiumPort 120 port_maker = chromium.ChromiumPort 122 121 123 122 def test_all_test_configurations(self): … … 277 276 def test_overrides_and_builder_names(self): 278 277 port = self.make_port() 279 if not port:280 return281 278 282 279 filesystem = MockFileSystem() -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
r99773 r99781 56 56 57 57 class ChromiumWinPort(chromium.ChromiumPort): 58 """Chromium Win implementation of the Port class."""59 60 58 # FIXME: Figure out how to unify this with base.TestConfiguration.all_systems()? 61 59 SUPPORTED_VERSIONS = ('xp', 'vista', 'win7') -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
r99773 r99781 33 33 from webkitpy.common.system import outputcapture 34 34 from webkitpy.common.host_mock import MockHost 35 from webkitpy.common.system.executive_mock import MockExecutive 35 36 from webkitpy.common.system.filesystem_mock import MockFileSystem 36 37 … … 52 53 self._port = None 53 54 54 def port_maker(self, platform): 55 if platform not in ('cygwin', 'win32'): 56 return None 57 return chromium_win.ChromiumWinPort 55 port_maker = chromium_win.ChromiumWinPort 58 56 59 57 def _mock_path_from_chromium_base(self, *comps): … … 61 59 62 60 def test_uses_apache(self): 63 port = self.make_port() 64 if not port: 65 return 66 67 self.assertFalse(port._uses_apache()) 61 self.assertFalse(self.make_port()._uses_apache()) 68 62 69 63 def test_setup_environ_for_server(self): 70 64 port = self.make_port() 71 if not port:72 return73 65 74 66 port._executive = MockExecutive(should_log=True) … … 83 75 def test_setup_environ_for_server_register_cygwin(self): 84 76 port = self.make_port(options=ChromiumWinTest.RegisterCygwinOption()) 85 if not port:86 return87 77 88 78 port._executive = MockExecutive(should_log=True) … … 90 80 self._port = port 91 81 setup_mount = self._mock_path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") 92 expected_stderr = "MOCK run_command: %s, cwd=None\n" % [setup_mount] 82 # FIXME: This is kinda lame, we only run setup_mount on win32 platforms, so we only expect the run_command output there. 83 if sys.platform != "win32": 84 expected_stderr = "" 85 else: 86 expected_stderr = "MOCK run_command: %s, cwd=None\n" % [setup_mount] 93 87 output = outputcapture.OutputCapture() 94 88 output.assert_outputs(self, port.setup_environ_for_server, expected_stderr=expected_stderr) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py
r99140 r99781 34 34 35 35 class EflPortTest(port_testcase.PortTestCase): 36 def port_maker(self, platform): 37 return EflPort 36 port_maker = EflPort 38 37 39 38 def test_show_results_html_file(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py
r99140 r99781 36 36 37 37 class GtkPortTest(port_testcase.PortTestCase): 38 def port_maker(self, platform): 39 return GtkPort 38 port_maker = GtkPort 40 39 41 40 def test_show_results_html_file(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
r99773 r99781 37 37 38 38 class MacTest(port_testcase.PortTestCase): 39 def port_maker(self, platform): 40 # FIXME: This platform check should no longer be necessary and should be removed as soon as possible. 41 if platform != 'darwin': 42 return None 43 return MacPort 39 port_maker = MacPort 44 40 45 41 def assert_skipped_file_search_paths(self, port_name, expected_paths): 46 port = MacPort(MockHost(),port_name=port_name)42 port = self.make_port(port_name=port_name) 47 43 self.assertEqual(port._skipped_file_search_paths(), expected_paths) 48 44 … … 75 71 76 72 def test_tests_from_skipped_file_contents(self): 77 port = MacPort(MockHost())73 port = self.make_port() 78 74 self.assertEqual(port._tests_from_skipped_file_contents(self.example_skipped_file), self.example_skipped_tests) 79 75 80 76 def assert_name(self, port_name, os_version_string, expected): 81 port = MacPort(MockHost(),port_name=port_name, os_version_string=os_version_string)77 port = self.make_port(port_name=port_name, os_version_string=os_version_string) 82 78 self.assertEquals(expected, port.name()) 83 79 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r99773 r99781 48 48 from webkitpy.common.system.executive_mock import MockExecutive 49 49 from webkitpy.common.host_mock import MockHost 50 mock_options = MockOptions(configuration='Release')51 50 52 51 … … 56 55 WEBSOCKET_PORTS = (8880,) 57 56 58 def port_maker(self, platform): 59 """Override to return the class object of the port to be tested, 60 or None if a valid port object cannot be constructed on the specified 61 platform.""" 62 raise NotImplementedError() 63 64 def make_port(self, options=mock_options): 65 """This routine should be used for tests that should only be run 66 when we can create a full, valid port object.""" 67 maker = self.port_maker(sys.platform) 68 if not maker: 69 return None 70 71 return maker(options=options, host=MockHost()) 57 # Subclasses override this to point to their Port subclass. 58 port_maker = None 59 60 def make_port(self, host=None, options=None, **kwargs): 61 host = host or MockHost() 62 options = options or MockOptions(configuration='Release') 63 return self.port_maker(host, options=options, **kwargs) 72 64 73 65 def test_default_worker_model(self): 74 66 port = self.make_port() 75 if not port:76 return77 78 67 if multiprocessing: 79 68 self.assertEqual(port.default_worker_model(), 'processes') … … 83 72 def test_driver_cmd_line(self): 84 73 port = self.make_port() 85 if not port:86 return87 74 self.assertTrue(len(port.driver_cmd_line())) 88 75 … … 94 81 95 82 def test_uses_apache(self): 96 port = self.make_port() 97 if not port: 98 return 99 100 self.assertTrue(port._uses_apache()) 83 self.assertTrue(self.make_port()._uses_apache()) 101 84 102 85 def assert_servers_are_down(self, host, ports): … … 123 106 def integration_test_http_lock(self): 124 107 port = self.make_port() 125 if not port:126 return127 108 # Only checking that no exception is raised. 128 109 port.acquire_http_lock() … … 131 112 def integration_test_check_sys_deps(self): 132 113 port = self.make_port() 133 if not port:134 return135 114 # Only checking that no exception is raised. 136 115 port.check_sys_deps(True) … … 138 117 def integration_test_helper(self): 139 118 port = self.make_port() 140 if not port:141 return142 119 # Only checking that no exception is raised. 143 120 port.start_helper() … … 146 123 def integration_test_http_server__normal(self): 147 124 port = self.make_port() 148 if not port:149 return150 125 self.assert_servers_are_down('localhost', self.HTTP_PORTS) 151 126 port.start_http_server() … … 156 131 def integration_test_http_server__fails(self): 157 132 port = self.make_port() 158 if not port:159 return160 133 # Test that if a port isn't available, the call fails. 161 134 for port_number in self.HTTP_PORTS: … … 188 161 # first port to be treated as stale and killed. 189 162 port = self.make_port() 190 if not port:191 return192 163 # Test that if a port isn't available, the call fails. 193 164 port.start_http_server() … … 213 184 def integration_test_image_diff(self): 214 185 port = self.make_port() 215 if not port: 216 return 217 186 # FIXME: This test will never run since we are using a MockFilesystem for these tests!?!? 218 187 if not port.check_image_diff(): 219 188 # The port hasn't been built - don't run the tests. … … 238 207 def test_diff_image__missing_both(self): 239 208 port = self.make_port() 240 if not port:241 return242 209 self.assertFalse(port.diff_image(None, None)[0]) 243 210 self.assertFalse(port.diff_image(None, '')[0]) … … 247 214 def test_diff_image__missing_actual(self): 248 215 port = self.make_port() 249 if not port:250 return251 216 self.assertTrue(port.diff_image(None, 'foo')[0]) 252 217 self.assertTrue(port.diff_image('', 'foo')[0]) … … 254 219 def test_diff_image__missing_expected(self): 255 220 port = self.make_port() 256 if not port:257 return258 221 self.assertTrue(port.diff_image('foo', None)[0]) 259 222 self.assertTrue(port.diff_image('foo', '')[0]) … … 261 224 def test_check_build(self): 262 225 port = self.make_port() 263 if not port:264 return265 226 port.check_build(needs_http=True) 266 227 267 228 def test_check_wdiff(self): 268 229 port = self.make_port() 269 if not port:270 return271 230 port.check_wdiff() 272 231 273 232 def integration_test_websocket_server__normal(self): 274 233 port = self.make_port() 275 if not port:276 return277 278 234 self.assert_servers_are_down('localhost', self.WEBSOCKET_PORTS) 279 235 port.start_websocket_server() … … 284 240 def integration_test_websocket_server__fails(self): 285 241 port = self.make_port() 286 if not port:287 return288 242 289 243 # Test that start() fails if a port isn't available. … … 310 264 def integration_test_websocket_server__two_servers(self): 311 265 port = self.make_port() 312 if not port:313 return314 266 315 267 # Test that calling start() on two different ports causes the … … 337 289 def test_test_configuration(self): 338 290 port = self.make_port() 339 if not port:340 return341 291 self.assertTrue(port.test_configuration()) 342 292 343 293 def test_all_test_configurations(self): 344 294 port = self.make_port() 345 if not port:346 return347 295 self.assertTrue(len(port.all_test_configurations()) > 0) 348 296 self.assertTrue(port.test_configuration() in port.all_test_configurations(), "%s not in %s" % (port.test_configuration(), port.all_test_configurations())) … … 350 298 def integration_test_http_server__loop(self): 351 299 port = self.make_port() 352 if not port:353 return354 300 355 301 i = 0 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py
r99773 r99781 40 40 41 41 class QtPortTest(port_testcase.PortTestCase): 42 def port_maker(self, platform): 43 return QtPort 42 port_maker = QtPort 44 43 45 44 def _assert_search_path(self, search_paths, sys_platform, use_webkit2=False, qt_version='4.7'): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py
r99773 r99781 81 81 82 82 class WebKitPortTest(port_testcase.PortTestCase): 83 def port_maker(self, platform): 84 return TestWebKitPort 83 port_maker = TestWebKitPort 85 84 86 85 def test_check_build(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py
r99773 r99781 42 42 43 43 class WinPortTest(port_testcase.PortTestCase): 44 def port_maker(self, platform): 45 return WinPort 44 port_maker = WinPort 46 45 47 46 def test_show_results_html_file(self):
Note:
See TracChangeset
for help on using the changeset viewer.