Changeset 121497 in webkit
- Timestamp:
- Jun 28, 2012 6:14:24 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 19 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r121493 r121497 1 2012-06-28 Dirk Pranke <dpranke@chromium.org> 2 3 derive ChromiumPort from WebKitPort in NRWT in order to support skipping tests if symbols are missing 4 https://bugs.webkit.org/show_bug.cgi?id=89706 5 6 Reviewed by Ojan Vafai. 7 8 Try again to land the change first landed in r121363. This patch 9 adds a bunch more tests and reworks the handling of 10 port-specific default values for --pixel-tests and --time-out-ms 11 to be more consistent (adding a default_pixel_tests() method, 12 pushing the webkit default_timeout_ms() value up into base.py, 13 and overriding it properly in the chromium and apple mac ports. 14 15 Also change the logic in 16 run_webkit_tests._setup_derived_options() to not second-guess 17 what the port wants the timeout value to be for debug builds; 18 computing this in two different places led to several bugs. 19 20 This change also changes the Chromium unittest ports to derive 21 from ChromiumPortTestCase instead of PortTestCase, so that we 22 ensure that we're running the same tests on all port variants 23 more easily. There's more cleanup that can be done here, but 24 this is good enough for now 25 26 * Scripts/webkitpy/layout_tests/port/base.py: 27 (Port.default_pixel_tests): 28 (Port): 29 (Port.default_timeout_ms): 30 * Scripts/webkitpy/layout_tests/port/chromium.py: 31 (ChromiumPort): 32 (ChromiumPort.__init__): 33 (ChromiumPort.default_pixel_tests): 34 (ChromiumPort.default_timeout_ms): 35 (ChromiumPort.driver_name): 36 (ChromiumPort._driver_class): 37 (ChromiumPort._missing_symbol_to_skipped_tests): 38 (ChromiumPort.skipped_layout_tests): 39 (ChromiumPort.setup_test_run): 40 (ChromiumPort._path_to_image_diff): 41 (ChromiumPort._convert_path): 42 * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py: 43 (ChromiumAndroidPortTest): 44 (ChromiumAndroidPortTest.test_expectations_files): 45 * Scripts/webkitpy/layout_tests/port/chromium_linux.py: 46 (ChromiumLinuxPort._modules_to_search_for_symbols): 47 * Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py: 48 (ChromiumLinuxPortTest): 49 * Scripts/webkitpy/layout_tests/port/chromium_mac.py: 50 (ChromiumMacPort._modules_to_search_for_symbols): 51 * Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py: 52 (ChromiumMacPortTest): 53 * Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py: 54 split off from chromium_unittest. 55 * Scripts/webkitpy/layout_tests/port/chromium_win.py: 56 (ChromiumWinPort._modules_to_search_for_symbols): 57 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py: 58 (ChromiumWinTest): 59 * Scripts/webkitpy/layout_tests/port/mac.py: 60 (MacPort.default_timeout_ms): 61 * Scripts/webkitpy/layout_tests/port/mac_unittest.py: 62 (MacTest.test_default_timeout_ms): 63 * Scripts/webkitpy/layout_tests/port/mock_drt.py: 64 (MockDRTPort.start_http_server): 65 * Scripts/webkitpy/layout_tests/port/port_testcase.py: 66 (PortTestCase.test_default_timeout_ms): 67 (PortTestCase): 68 (PortTestCase.test_default_pixel_tests): 69 * Scripts/webkitpy/layout_tests/port/test.py: 70 (TestPort.default_pixel_tests): 71 * Scripts/webkitpy/layout_tests/port/webkit.py: 72 (WebKitPort._modules_to_search_for_symbols): 73 (WebKitPort): 74 (WebKitPort._symbols_string): 75 (WebKitPort._skipped_tests_for_unsupported_features): 76 * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: 77 (TestWebKitPort._symbols_string): 78 (TestWebKitPort._tests_for_disabled_features): 79 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 80 (_set_up_derived_options): 81 1 82 2012-06-28 Joshua Bell <jsbell@chromium.org> 2 83 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r120865 r121497 137 137 self._results_directory = None 138 138 139 def default_test_timeout_ms(self): 140 return 6 * 1000 139 def default_pixel_tests(self): 140 # FIXME: Disable until they are run by default on build.webkit.org. 141 return False 142 143 def default_timeout_ms(self): 144 return 35 * 1000 141 145 142 146 def wdiff_available(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
r121406 r121497 44 44 from webkitpy.layout_tests.port.base import Port, VirtualTestSuite 45 45 from webkitpy.layout_tests.port.driver import DriverOutput 46 from webkitpy.layout_tests.port.webkit import WebKit Driver46 from webkitpy.layout_tests.port.webkit import WebKitPort, WebKitDriver 47 47 48 48 … … 50 50 51 51 52 class ChromiumPort( Port):52 class ChromiumPort(WebKitPort): 53 53 """Abstract base class for Chromium implementations of the Port class.""" 54 54 … … 108 108 109 109 def __init__(self, host, port_name, **kwargs): 110 Port.__init__(self,host, port_name, **kwargs)110 super(ChromiumPort, self).__init__(host, port_name, **kwargs) 111 111 # All sub-classes override this, but we need an initial value for testing. 112 112 self._chromium_base_dir_path = None 113 114 def default_pixel_tests(self): 115 return True 116 117 def default_timeout_ms(self): 118 if self.get_option('configuration') == 'Debug': 119 return 12 * 1000 120 return 6 * 1000 113 121 114 122 def _check_file_exists(self, path_to_file, file_description, … … 131 139 return True 132 140 141 def driver_name(self): 142 # FIXME: merge this with Port.driver_name, WebKitPort.driver_name 143 if self.get_option('driver_name'): 144 return self.get_option('driver_name') 145 return 'DumpRenderTree' 133 146 134 147 def check_build(self, needs_http): … … 258 271 return self._build_path(self.get_option('configuration'), 'layout-test-results') 259 272 273 def _driver_class(self): 274 return ChromiumDriver 275 276 def _missing_symbol_to_skipped_tests(self): 277 # FIXME: Should WebKitPort have these definitions also? 278 return { 279 "ff_mp3_decoder": ["webaudio/codec-tests/mp3"], 280 "ff_aac_decoder": ["webaudio/codec-tests/aac"], 281 } 282 283 def skipped_layout_tests(self, test_list): 284 # FIXME: Merge w/ WebKitPort.skipped_layout_tests() 285 return set(self._skipped_tests_for_unsupported_features(test_list)) 286 260 287 def setup_test_run(self): 261 288 # Delete the disk cache if any to ensure a clean test run. … … 265 292 if self._filesystem.exists(cachedir): 266 293 self._filesystem.rmtree(cachedir) 267 268 def _driver_class(self):269 return ChromiumDriver270 294 271 295 def start_helper(self): … … 366 390 def _build_path(self, *comps): 367 391 return self._static_build_path(self._filesystem, self.get_option('build_directory'), self.path_from_chromium_base(), self.path_from_webkit_base(), *comps) 392 393 def _path_to_image_diff(self): 394 binary_name = 'ImageDiff' 395 return self._build_path(self.get_option('configuration'), binary_name) 368 396 369 397 def _check_driver_build_up_to_date(self, configuration): … … 401 429 return cygpath(path) 402 430 return path 403 404 def _path_to_image_diff(self):405 binary_name = 'ImageDiff'406 return self._build_path(self.get_option('configuration'), binary_name)407 431 408 432 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
r118244 r121497 36 36 37 37 from webkitpy.layout_tests.port import chromium_android 38 from webkitpy.layout_tests.port import port_testcase38 from webkitpy.layout_tests.port import chromium_port_testcase 39 39 from webkitpy.layout_tests.port import Port 40 40 41 41 42 class ChromiumAndroidPortTest( port_testcase.PortTestCase):42 class ChromiumAndroidPortTest(chromium_port_testcase.ChromiumPortTestCase): 43 43 port_name = 'chromium-android' 44 44 port_maker = chromium_android.ChromiumAndroidPort … … 49 49 self.assertTrue(port.get_option('enable_hardware_gpu')) 50 50 self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-android')) 51 52 def test_expectations_files(self): 53 # FIXME: override this test temporarily while we're still upstreaming the android port and 54 # using a custom expectations file. 55 pass 51 56 52 57 @staticmethod -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
r121406 r121497 111 111 return map(self._webkit_baseline_path, port_names) 112 112 113 def _modules_to_search_for_symbols(self): 114 return [self._build_path(self.get_option('configuration'), 'libffmpegsumo.so')] 115 113 116 def check_build(self, needs_http): 114 117 result = chromium.ChromiumPort.check_build(self, needs_http) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py
r119649 r121497 34 34 35 35 from webkitpy.layout_tests.port import chromium_linux 36 from webkitpy.layout_tests.port import port_testcase36 from webkitpy.layout_tests.port import chromium_port_testcase 37 37 38 38 39 class ChromiumLinuxPortTest( port_testcase.PortTestCase):39 class ChromiumLinuxPortTest(chromium_port_testcase.ChromiumPortTestCase): 40 40 port_name = 'chromium-linux' 41 41 port_maker = chromium_linux.ChromiumLinuxPort -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
r121406 r121497 89 89 return map(self._webkit_baseline_path, fallback_paths[self._version]) 90 90 91 def _modules_to_search_for_symbols(self): 92 return [self._build_path(self.get_option('configuration'), 'ffmpegsumo.so')] 93 91 94 def check_build(self, needs_http): 92 95 result = chromium.ChromiumPort.check_build(self, needs_http) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py
r120865 r121497 30 30 31 31 from webkitpy.layout_tests.port import chromium_mac 32 from webkitpy.layout_tests.port import port_testcase32 from webkitpy.layout_tests.port import chromium_port_testcase 33 33 from webkitpy.tool.mocktool import MockOptions 34 34 35 35 36 class ChromiumMacPortTest( port_testcase.PortTestCase):36 class ChromiumMacPortTest(chromium_port_testcase.ChromiumPortTestCase): 37 37 os_name = 'mac' 38 38 os_version = 'leopard' -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py
r121495 r121497 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import StringIO30 import sys31 import time32 29 import unittest 33 30 34 31 from webkitpy.common.system import logtesting 35 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 36 from webkitpy.common.system.filesystem_mock import MockFileSystem 32 from webkitpy.common.system.executive_mock import MockExecutive2 37 33 from webkitpy.common.system.systemhost_mock import MockSystemHost 38 from webkitpy.layout_tests.port.config_mock import MockConfig39 from webkitpy.thirdparty.mock import Mock40 34 from webkitpy.tool.mocktool import MockOptions 41 35 42 import chromium43 36 import chromium_android 44 37 import chromium_linux … … 48 41 from webkitpy.layout_tests.models.test_configuration import TestConfiguration 49 42 from webkitpy.layout_tests.port import port_testcase 50 from webkitpy.layout_tests.port.driver import DriverInput 51 52 53 class ChromiumDriverTest(unittest.TestCase): 54 def setUp(self): 55 host = MockSystemHost() 56 options = MockOptions(configuration='Release', additional_drt_flag=['--test-shell']) 57 config = MockConfig(filesystem=host.filesystem, default_configuration='Release') 58 self.port = chromium_mac.ChromiumMacPort(host, 'chromium-mac-snowleopard', options=options, config=config) 59 self.driver = chromium.ChromiumDriver(self.port, worker_number=0, pixel_tests=True) 60 61 def test_test_shell_command(self): 62 expected_command = "test.html 2 checksum\n" 63 self.assertEqual(self.driver._test_shell_command("test.html", 2, "checksum"), expected_command) 64 65 def _assert_write_command_and_read_line(self, input=None, expected_line=None, expected_stdin=None, expected_crash=False): 66 if not expected_stdin: 67 if input: 68 expected_stdin = input 69 else: 70 # We reset stdin, so we should expect stdin.getValue = "" 71 expected_stdin = "" 72 self.driver._proc.stdin = StringIO.StringIO() 73 line, did_crash = self.driver._write_command_and_read_line(input) 74 self.assertEqual(self.driver._proc.stdin.getvalue(), expected_stdin) 75 self.assertEqual(line, expected_line) 76 self.assertEqual(did_crash, expected_crash) 77 78 def test_write_command_and_read_line(self): 79 self.driver._proc = Mock() # FIXME: This should use a tighter mock. 80 # Set up to read 3 lines before we get an IOError 81 self.driver._proc.stdout = StringIO.StringIO("first\nsecond\nthird\n") 82 83 unicode_input = u"I \u2661 Unicode" 84 utf8_input = unicode_input.encode("utf-8") 85 # Test unicode input conversion to utf-8 86 self._assert_write_command_and_read_line(input=unicode_input, expected_stdin=utf8_input, expected_line="first\n") 87 # Test str() input. 88 self._assert_write_command_and_read_line(input="foo", expected_line="second\n") 89 # Test input=None 90 self._assert_write_command_and_read_line(expected_line="third\n") 91 # Test reading from a closed/empty stream. 92 # reading from a StringIO does not raise IOError like a real file would, so raise IOError manually. 93 def mock_readline(): 94 raise IOError 95 self.driver._proc.stdout.readline = mock_readline 96 self._assert_write_command_and_read_line(expected_crash=True) 97 98 def test_crash_log(self): 99 self.driver._proc = Mock() 100 101 # Simulate a crash by having stdout close unexpectedly. 102 def mock_readline(): 103 raise IOError 104 self.driver._proc.stdout.readline = mock_readline 105 self.driver._proc.pid = 1234 106 107 self.driver.test_to_uri = lambda test: 'mocktesturi' 108 self.driver._port.driver_name = lambda: 'mockdriver' 109 self.driver._port._get_crash_log = lambda name, pid, out, err, newer_than: 'mockcrashlog' 110 driver_output = self.driver.run_test(DriverInput(test_name='some/test.html', timeout=1, image_hash=None, should_run_pixel_test=False)) 111 self.assertTrue(driver_output.crash) 112 self.assertEqual(driver_output.crashed_process_name, 'mockdriver') 113 self.assertEqual(driver_output.crashed_pid, 1234) 114 self.assertEqual(driver_output.crash_log, 'mockcrashlog') 115 116 def test_stop(self): 117 self.pid = None 118 self.wait_called = False 119 self.driver._proc = Mock() # FIXME: This should use a tighter mock. 120 self.driver._proc.pid = 1 121 self.driver._proc.stdin = StringIO.StringIO() 122 self.driver._proc.stdout = StringIO.StringIO() 123 self.driver._proc.stderr = StringIO.StringIO() 124 self.driver._proc.poll = lambda: None 125 126 def fake_wait(): 127 self.assertTrue(self.pid is not None) 128 self.wait_called = True 129 130 self.driver._proc.wait = fake_wait 131 132 class FakeExecutive(object): 133 def kill_process(other, pid): 134 self.pid = pid 135 self.driver._proc.poll = lambda: 2 136 137 self.driver._port._executive = FakeExecutive() 138 self.driver.KILL_TIMEOUT_DEFAULT = 0.01 139 self.driver.stop() 140 self.assertTrue(self.wait_called) 141 self.assertEquals(self.pid, 1) 142 143 def test_two_drivers(self): 144 145 class MockDriver(chromium.ChromiumDriver): 146 def __init__(self, port): 147 chromium.ChromiumDriver.__init__(self, port, worker_number=0, pixel_tests=False) 148 149 def cmd_line(self, pixel_test, per_test_args): 150 return 'python' 151 152 # get_option is used to get the timeout (ms) for a process before we kill it. 153 driver1 = MockDriver(self.port) 154 driver1._start(False, []) 155 driver2 = MockDriver(self.port) 156 driver2._start(False, []) 157 # It's possible for driver1 to timeout when stopping if it's sharing stdin with driver2. 158 start_time = time.time() 159 driver1.stop() 160 driver2.stop() 161 self.assertTrue(time.time() - start_time < 20) 162 163 def test_stop_cleans_up_properly(self): 164 self.driver._test_shell = False 165 self.driver.start(True, []) 166 last_tmpdir = self.port._filesystem.last_tmpdir 167 self.assertNotEquals(last_tmpdir, None) 168 self.driver.stop() 169 self.assertFalse(self.port._filesystem.isdir(last_tmpdir)) 170 171 def test_two_starts_cleans_up_properly(self): 172 # clone the WebKitDriverTest tests here since we override start() and stop() 173 self.driver._test_shell = False 174 self.driver.start(True, []) 175 last_tmpdir = self.port._filesystem.last_tmpdir 176 self.driver._start(True, []) 177 self.assertFalse(self.port._filesystem.isdir(last_tmpdir)) 178 179 class ChromiumPortTest(port_testcase.PortTestCase): 180 port_name = 'chromium-mac' 181 port_maker = chromium.ChromiumPort 43 44 45 class ChromiumPortTestCase(port_testcase.PortTestCase): 46 47 def test_default_timeout_ms(self): 48 self.assertEquals(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000) 49 self.assertEquals(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 12000) 50 51 def test_default_pixel_tests(self): 52 self.assertEquals(self.make_port().default_pixel_tests(), True) 53 54 def test_missing_symbol_to_skipped_tests(self): 55 # Test that we get the chromium skips and not the webkit default skips 56 port = self.make_port() 57 skip_dict = port._missing_symbol_to_skipped_tests() 58 self.assertTrue('ff_mp3_decoder' in skip_dict) 59 self.assertFalse('WebGLShader' in skip_dict) 182 60 183 61 def test_all_test_configurations(self): … … 203 81 ])) 204 82 205 def test_driver_cmd_line(self):206 # Override this test since ChromiumPort doesn't implement driver_cmd_line().207 pass208 209 def test_check_build(self):210 # Override this test since ChromiumPort doesn't implement _path_to_driver().211 pass212 213 def test_check_wdiff(self):214 # Override this test since ChromiumPort doesn't implement _path_to_driver().215 pass216 217 83 class TestMacPort(chromium_mac.ChromiumMacPort): 218 84 def __init__(self, options=None): … … 253 119 def test_default_configuration(self): 254 120 mock_options = MockOptions() 255 port = ChromiumPortTest .TestLinuxPort(options=mock_options)121 port = ChromiumPortTestCase.TestLinuxPort(options=mock_options) 256 122 self.assertEquals(mock_options.configuration, 'default') 257 123 self.assertTrue(port.default_configuration_called) 258 124 259 125 mock_options = MockOptions(configuration=None) 260 port = ChromiumPortTest .TestLinuxPort(mock_options)126 port = ChromiumPortTestCase.TestLinuxPort(mock_options) 261 127 self.assertEquals(mock_options.configuration, 'default') 262 128 self.assertTrue(port.default_configuration_called) 263 129 264 130 def test_diff_image(self): 265 class TestPort(ChromiumPortTest .TestLinuxPort):131 class TestPort(ChromiumPortTestCase.TestLinuxPort): 266 132 def _path_to_image_diff(self): 267 133 return "/path/to/image_diff" 268 134 269 port = ChromiumPortTest .TestLinuxPort()135 port = ChromiumPortTestCase.TestLinuxPort() 270 136 mock_image_diff = "MOCK Image Diff" 271 137 … … 319 185 class ChromiumPortLoggingTest(logtesting.LoggingTestCase): 320 186 def test_check_sys_deps(self): 321 port = ChromiumPortTest .TestLinuxPort()187 port = ChromiumPortTestCase.TestLinuxPort() 322 188 323 189 # Success -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
r121406 r121497 28 28 29 29 import StringIO 30 import sys31 30 import time 32 31 import unittest 33 32 34 33 from webkitpy.common.system import logtesting 35 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 36 from webkitpy.common.system.filesystem_mock import MockFileSystem 34 from webkitpy.common.system.executive_mock import MockExecutive2 37 35 from webkitpy.common.system.systemhost_mock import MockSystemHost 38 36 from webkitpy.layout_tests.port.config_mock import MockConfig … … 41 39 42 40 import chromium 43 import chromium_android44 import chromium_linux45 41 import chromium_mac 46 import chromium_win47 42 48 from webkitpy.layout_tests.models.test_configuration import TestConfiguration 49 from webkitpy.layout_tests.port import port_testcase 43 from webkitpy.layout_tests.port import chromium_port_testcase 50 44 from webkitpy.layout_tests.port.driver import DriverInput 51 45 … … 177 171 self.assertFalse(self.port._filesystem.isdir(last_tmpdir)) 178 172 179 class ChromiumPortTest(port_testcase.PortTestCase):180 port_name = 'chromium-mac'181 port_maker = chromium.ChromiumPort182 183 def test_all_test_configurations(self):184 """Validate the complete set of configurations this port knows about."""185 port = self.make_port()186 self.assertEquals(set(port.all_test_configurations()), set([187 TestConfiguration('icecreamsandwich', 'x86', 'debug'),188 TestConfiguration('icecreamsandwich', 'x86', 'release'),189 TestConfiguration('leopard', 'x86', 'debug'),190 TestConfiguration('leopard', 'x86', 'release'),191 TestConfiguration('snowleopard', 'x86', 'debug'),192 TestConfiguration('snowleopard', 'x86', 'release'),193 TestConfiguration('lion', 'x86', 'debug'),194 TestConfiguration('lion', 'x86', 'release'),195 TestConfiguration('xp', 'x86', 'debug'),196 TestConfiguration('xp', 'x86', 'release'),197 TestConfiguration('win7', 'x86', 'debug'),198 TestConfiguration('win7', 'x86', 'release'),199 TestConfiguration('lucid', 'x86', 'debug'),200 TestConfiguration('lucid', 'x86', 'release'),201 TestConfiguration('lucid', 'x86_64', 'debug'),202 TestConfiguration('lucid', 'x86_64', 'release'),203 ]))204 205 def test_driver_cmd_line(self):206 # Override this test since ChromiumPort doesn't implement driver_cmd_line().207 pass208 209 def test_check_build(self):210 # Override this test since ChromiumPort doesn't implement _path_to_driver().211 pass212 213 def test_check_wdiff(self):214 # Override this test since ChromiumPort doesn't implement _path_to_driver().215 pass216 217 class TestMacPort(chromium_mac.ChromiumMacPort):218 def __init__(self, options=None):219 options = options or MockOptions()220 chromium_mac.ChromiumMacPort.__init__(self, MockSystemHost(os_name='mac', os_version='leopard'), 'chromium-mac-leopard', options=options)221 222 def default_configuration(self):223 self.default_configuration_called = True224 return 'default'225 226 class TestAndroidPort(chromium_android.ChromiumAndroidPort):227 def __init__(self, options=None):228 options = options or MockOptions()229 chromium_win.ChromiumAndroidPort.__init__(self, MockSystemHost(os_name='android', os_version='icecreamsandwich'), 'chromium-android', options=options)230 231 def default_configuration(self):232 self.default_configuration_called = True233 return 'default'234 235 class TestLinuxPort(chromium_linux.ChromiumLinuxPort):236 def __init__(self, options=None):237 options = options or MockOptions()238 chromium_linux.ChromiumLinuxPort.__init__(self, MockSystemHost(os_name='linux', os_version='lucid'), 'chromium-linux-x86', options=options)239 240 def default_configuration(self):241 self.default_configuration_called = True242 return 'default'243 244 class TestWinPort(chromium_win.ChromiumWinPort):245 def __init__(self, options=None):246 options = options or MockOptions()247 chromium_win.ChromiumWinPort.__init__(self, MockSystemHost(os_name='win', os_version='xp'), 'chromium-win-xp', options=options)248 249 def default_configuration(self):250 self.default_configuration_called = True251 return 'default'252 253 def test_default_configuration(self):254 mock_options = MockOptions()255 port = ChromiumPortTest.TestLinuxPort(options=mock_options)256 self.assertEquals(mock_options.configuration, 'default')257 self.assertTrue(port.default_configuration_called)258 259 mock_options = MockOptions(configuration=None)260 port = ChromiumPortTest.TestLinuxPort(mock_options)261 self.assertEquals(mock_options.configuration, 'default')262 self.assertTrue(port.default_configuration_called)263 264 def test_diff_image(self):265 class TestPort(ChromiumPortTest.TestLinuxPort):266 def _path_to_image_diff(self):267 return "/path/to/image_diff"268 269 port = ChromiumPortTest.TestLinuxPort()270 mock_image_diff = "MOCK Image Diff"271 272 def mock_run_command(args):273 port._filesystem.write_binary_file(args[4], mock_image_diff)274 return 1275 276 # Images are different.277 port._executive = MockExecutive2(run_command_fn=mock_run_command)278 self.assertEquals(mock_image_diff, port.diff_image("EXPECTED", "ACTUAL")[0])279 280 # Images are the same.281 port._executive = MockExecutive2(exit_code=0)282 self.assertEquals(None, port.diff_image("EXPECTED", "ACTUAL")[0])283 284 # There was some error running image_diff.285 port._executive = MockExecutive2(exit_code=2)286 exception_raised = False287 try:288 port.diff_image("EXPECTED", "ACTUAL")289 except ValueError, e:290 exception_raised = True291 self.assertFalse(exception_raised)292 293 def test_expectations_files(self):294 port = self.make_port()295 port.port_name = 'chromium'296 297 expectations_path = port.path_to_test_expectations_file()298 chromium_overrides_path = port.path_from_chromium_base(299 'webkit', 'tools', 'layout_tests', 'test_expectations.txt')300 skia_overrides_path = port.path_from_chromium_base(301 'skia', 'skia_test_expectations.txt')302 303 port._options.builder_name = 'DUMMY_BUILDER_NAME'304 self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path])305 306 port._options.builder_name = 'builder (deps)'307 self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path])308 309 # A builder which does NOT observe the Chromium test_expectations,310 # but still observes the Skia test_expectations...311 port._options.builder_name = 'builder'312 self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path])313 314 def test_expectations_ordering(self):315 # since we don't implement self.port_name in ChromiumPort.316 pass317 318 173 319 174 class ChromiumPortLoggingTest(logtesting.LoggingTestCase): 175 176 # FIXME: put this someplace more useful 320 177 def test_check_sys_deps(self): 321 port = ChromiumPortTest.TestLinuxPort()178 port = chromium_port_testcase.ChromiumPortTestCase.TestLinuxPort() 322 179 323 180 # Success -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win.py
r121406 r121497 107 107 return map(self._webkit_baseline_path, port_names) 108 108 109 def _modules_to_search_for_symbols(self): 110 # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. 111 # See https://bugs.webkit.org/show_bug.cgi?id=89706. 112 return [] 113 109 114 def check_build(self, needs_http): 110 115 result = chromium.ChromiumPort.check_build(self, needs_http) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
r121266 r121497 33 33 from webkitpy.common.system.executive_mock import MockExecutive 34 34 from webkitpy.common.system.filesystem_mock import MockFileSystem 35 from webkitpy.layout_tests.port import chromium_port_testcase 35 36 from webkitpy.layout_tests.port import chromium_win 36 from webkitpy.layout_tests.port import port_testcase37 37 from webkitpy.tool.mocktool import MockOptions 38 38 39 39 40 class ChromiumWinTest( port_testcase.PortTestCase):40 class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase): 41 41 port_name = 'chromium-win' 42 42 port_maker = chromium_win.ChromiumWinPort -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py
r120738 r121497 66 66 self.set_option_default("batch_size", 1000) 67 67 68 def default_timeout_ms(self): 69 if self.get_option('guard_malloc'): 70 return 350 * 1000 71 return super(MacPort, self).default_timeout_ms() 72 68 73 def _build_driver_flags(self): 69 74 return ['ARCHS=i386'] if self.architecture() == 'x86' else [] -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
r120738 r121497 46 46 self.assertEqual(port._skipped_file_search_paths(), expected_paths) 47 47 48 def test_default_timeout_ms(self): 49 super(MacTest, self).test_default_timeout_ms() 50 self.assertEquals(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000) 51 48 52 def test_skipped_file_search_paths(self): 49 53 self.assert_skipped_file_search_paths('mac-snowleopard', set(['mac-snowleopard', 'mac'])) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
r114788 r121497 105 105 pass 106 106 107 def start_http_server(self ):107 def start_http_server(self, number_of_servers): 108 108 pass 109 109 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r120236 r121497 45 45 46 46 47 class PortTestCase( unittest.TestCase):47 class PortTestCase(object): 48 48 """Tests that all Port implementations must pass.""" 49 49 HTTP_PORTS = (8000, 8080, 8443) … … 62 62 port_name = self.port_maker.determine_full_port_name(host, options, port_name) 63 63 return self.port_maker(host, port_name, options=options, config=config, **kwargs) 64 65 def test_default_timeout_ms(self): 66 self.assertEquals(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 35000) 67 self.assertEquals(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 35000) 68 69 def test_default_pixel_tests(self): 70 self.assertEquals(self.make_port().default_pixel_tests(), False) 64 71 65 72 def test_driver_cmd_line(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py
r120851 r121497 358 358 self._version = version_map[port_name] 359 359 360 def default_pixel_tests(self): 361 return True 362 360 363 def _path_to_driver(self): 361 364 # This routine shouldn't normally be called, but it is called by -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r121406 r121497 52 52 53 53 class WebKitPort(Port): 54 def __init__(self, host, port_name=None, **kwargs):55 Port.__init__(self, host, port_name=port_name, **kwargs)56 57 # FIXME: Disable pixel tests until they are run by default on build.webkit.org.58 self.set_option_default("pixel_tests", False)59 # WebKit ports expect a 35s timeout, or 350s timeout when running with -g/--guard-malloc.60 # FIXME: --guard-malloc is only supported on Mac, so this logic should be in mac.py.61 default_time_out_seconds = 350 if self.get_option('guard_malloc') else 3562 self.set_option_default("time_out_ms", default_time_out_seconds * 1000)63 54 64 55 def driver_name(self): … … 265 256 return 'nm' 266 257 267 def _webcore_symbols_string(self): 268 webcore_library_path = self._path_to_webcore_library() 269 if not webcore_library_path: 270 return None 271 try: 272 return self._executive.run_command([self.nm_command(), webcore_library_path], error_handler=Executive.ignore_error) 273 except OSError, e: 274 _log.warn("Failed to run nm: %s. Can't determine WebCore supported features." % e) 275 return None 258 def _modules_to_search_for_symbols(self): 259 path = self._path_to_webcore_library() 260 if path: 261 return [path] 262 return [] 263 264 def _symbols_string(self): 265 symbols = '' 266 for path_to_module in self._modules_to_search_for_symbols(): 267 try: 268 symbols += self._executive.run_command([self.nm_command(), path_to_module], error_handler=Executive.ignore_error) 269 except OSError, e: 270 _log.warn("Failed to run nm: %s. Can't determine supported features correctly." % e) 271 return symbols 276 272 277 273 # Ports which use run-time feature detection should define this method and return … … 332 328 if self._has_test_in_directories(self._missing_symbol_to_skipped_tests().values(), test_list): 333 329 # Runtime feature detection not supported, fallback to static dectection: 334 # Disable any tests for symbols missing from the webcore symbol string.335 webcore_symbols_string = self._webcore_symbols_string()336 if webcore_symbols_string is not None:337 return reduce(operator.add, [directories for symbol_substring, directories in self._missing_symbol_to_skipped_tests().items() if symbol_substring not in webcore_symbols_string], [])330 # Disable any tests for symbols missing from the executable or libraries. 331 symbols_string = self._symbols_string() 332 if symbols_string is not None: 333 return reduce(operator.add, [directories for symbol_substring, directories in self._missing_symbol_to_skipped_tests().items() if symbol_substring not in symbols_string], []) 338 334 339 335 # Failed to get any runtime or symbol information, don't skip any tests. -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py
r121406 r121497 54 54 return [self.test_configuration()] 55 55 56 def _ webcore_symbols_string(self):56 def _symbols_string(self): 57 57 return self.symbols_string 58 58 … … 62 62 def _tests_for_disabled_features(self): 63 63 return ["accessibility", ] 64 65 66 class WebKitPortUnitTests(unittest.TestCase):67 def test_default_options(self):68 # The WebKit ports override new-run-webkit-test default options.69 options = MockOptions(pixel_tests=None, time_out_ms=None)70 port = WebKitPort(MockSystemHost(), options=options)71 self.assertEquals(port._options.pixel_tests, False)72 self.assertEquals(port._options.time_out_ms, 35000)73 74 # Note that we don't override options if specified by the user.75 options = MockOptions(pixel_tests=True, time_out_ms=6000)76 port = WebKitPort(MockSystemHost(), options=options)77 self.assertEquals(port._options.pixel_tests, True)78 self.assertEquals(port._options.time_out_ms, 6000)79 64 80 65 -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r120740 r121497 139 139 140 140 if options.pixel_tests is None: 141 options.pixel_tests = True141 options.pixel_tests = port.default_pixel_tests() 142 142 143 143 if not options.time_out_ms: 144 if options.configuration == "Debug": 145 options.time_out_ms = str(2 * port.default_test_timeout_ms()) 146 else: 147 options.time_out_ms = str(port.default_test_timeout_ms()) 144 options.time_out_ms = str(port.default_timeout_ms()) 148 145 149 146 options.slow_time_out_ms = str(5 * int(options.time_out_ms))
Note: See TracChangeset
for help on using the changeset viewer.