Changeset 92717 in webkit
- Timestamp:
- Aug 9, 2011 3:12:01 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r92708 r92717 1 2011-07-13 Eric Seidel <eric@webkit.org> 2 3 new-run-webkit-test's WinPort has no fallback logic 4 https://bugs.webkit.org/show_bug.cgi?id=64486 5 6 Reviewed by Adam Roben. 7 8 I've tried to write a patch for bug 64439 twice now, and both times 9 I've ended up re-writing half the port system. So I'm breaking 10 things up into smaller pieces, this being the first. 11 12 WinPort still does not have any port_name parsing, so when instantiated 13 with the name "win-xp" (i.e. by the rebaseline server) it will just behave as the 'win' port. 14 I'll fix this in a second pass when I standardize port_name parsing for all webkit ports. 15 16 Otherwise this should "just work" for windows. I've not been able to test the 17 version detection on my mac, but the unit tests show the code behaving as designed. 18 19 * Scripts/webkitpy/layout_tests/port/win.py: 20 * Scripts/webkitpy/layout_tests/port/win_unittest.py: Added. 21 1 22 2011-08-09 Adam Barth <abarth@webkit.org> 2 23 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py
r92147 r92717 31 31 class TestConfiguration(object): 32 32 def __init__(self, port=None, version=None, architecture=None, build_type=None, graphics_type=None): 33 # FIXME: TestConfiguration() fails due to port == None. 33 34 self.version = version or port.version() 34 35 self.architecture = architecture or port.architecture() -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
r92563 r92717 522 522 523 523 uri = self._port.test_to_uri(driver_input.test_name) 524 cmd = self._test_shell_command(uri, driver_input.timeout, 525 driver_input.image_hash) 524 cmd = self._test_shell_command(uri, driver_input.timeout, driver_input.image_hash) 526 525 (line, crash) = self._write_command_and_read_line(input=cmd) 527 526 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/win.py
r91866 r92717 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 """WebKit Win implementation of the Port interface."""30 31 29 import logging 30 import re 31 import sys 32 32 33 33 from webkitpy.layout_tests.models.test_configuration import TestConfiguration 34 from webkitpy.common.system.executive import ScriptError 34 35 from webkitpy.layout_tests.port.webkit import WebKitPort 35 36 … … 41 42 port_name = "win" 42 43 43 FALLBACK_PATHS = { 44 'win7': [ 45 "win", 46 "mac-snowleopard", 47 "mac", 48 ], 49 } 44 # This is a list of all supported OS-VERSION pairs for the AppleWin port 45 # and the order of fallback between them. Matches ORWT. 46 VERSION_FALLBACK_ORDER = ("win-xp", "win-vista", "win-7sp0", "win") 50 47 51 def __init__(self, **kwargs): 48 def _version_string_from_windows_version_tuple(self, windows_version_tuple): 49 if windows_version_tuple[:3] == (6, 1, 7600): 50 return '7sp0' 51 if windows_version_tuple[:2] == (6, 0): 52 return 'vista' 53 if windows_version_tuple[:2] == (5, 1): 54 return 'xp' 55 return None 56 57 def _detect_version(self): 58 # Note, this intentionally returns None to mean that it can't detect what the current version is. 59 # Callers can then decide what version they want to pretend to be. 60 try: 61 ver_output = self._executive.run_command(['cmd', '/c', 'ver']) 62 except (ScriptError, OSError) as e: 63 ver_output = "" 64 _log.error("Failed to detect Windows version, assuming latest.\n%s" % e) 65 match_object = re.search(r'(?P<major>\d)\.(?P<minor>\d)\.(?P<build>\d+)', ver_output) 66 if match_object: 67 version_tuple = tuple(map(int, match_object.groups())) 68 return self._version_string_from_windows_version_tuple(version_tuple) 69 70 def __init__(self, os_version_string=None, **kwargs): 71 # FIXME: This will not create a properly versioned WinPort object when instantiated from a buildbot-name, like win-xp. 72 # We'll need to add port_name parsing of some kind (either here, or in factory.py). 52 73 WebKitPort.__init__(self, **kwargs) 53 self._version = 'win7'74 self._version = os_version_string or self._detect_version() or 'future' # FIXME: This is a hack, as TestConfiguration assumes that this value is never None even though the base "win" port has no "version". 54 75 self._operating_system = 'win' 55 76 77 # FIXME: A more sophisitcated version of this function should move to WebKitPort and replace all calls to name(). 78 def _port_name_with_version(self): 79 components = [self.port_name] 80 if self._version != 'future': # FIXME: This is a hack, but TestConfiguration doesn't like self._version ever being None. 81 components.append(self._version) 82 return '-'.join(components) 83 56 84 def baseline_search_path(self): 57 # Based on code from old-run-webkit-tests expectedDirectoryForTest() 58 # FIXME: This does not work for WebKit2. 59 return map(self._webkit_baseline_path, self.FALLBACK_PATHS[self._version]) 85 try: 86 fallback_index = self.VERSION_FALLBACK_ORDER.index(self._port_name_with_version()) 87 fallback_names = list(self.VERSION_FALLBACK_ORDER[fallback_index:]) 88 except ValueError: 89 # Unknown versions just fall back to the base port results. 90 fallback_names = [self.port_name] 91 # FIXME: The AppleWin port falls back to AppleMac for some results. Eventually we'll have a shared 'apple' port. 92 if self.get_option('webkit_test_runner'): 93 fallback_names.insert(0, 'win-wk2') 94 fallback_names.append('mac-wk2') 95 # Note we do not add 'wk2' here, even though it's included in _skipped_search_paths(). 96 # FIXME: Perhaps we should get this list from MacPort? 97 fallback_names.extend(['mac-snowleopard', 'mac']) 98 return map(self._webkit_baseline_path, fallback_names) 60 99 61 100 def _generate_all_test_configurations(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py
r91866 r92717 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import StringIO 30 import sys 29 31 import unittest 30 32 33 from webkitpy.common.system.executive import ScriptError 34 from webkitpy.common.system.executive_mock import MockExecutive2 35 from webkitpy.common.system.filesystem_mock import MockFileSystem 31 36 from webkitpy.common.system.outputcapture import OutputCapture 37 from webkitpy.layout_tests.port import port_testcase 32 38 from webkitpy.layout_tests.port.win import WinPort 33 from webkitpy.layout_tests.port import port_testcase 34 from webkitpy.tool.mocktool import MockExecutive 39 from webkitpy.tool.mocktool import MockOptions, MockUser, MockExecutive 35 40 36 41 … … 44 49 expected_stderr = "MOCK: user.open_url: test.html\n" 45 50 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) 51 52 def test_detect_version(self): 53 port = self.make_port() 54 55 def mock_run_command(cmd): 56 self.assertEquals(cmd, ['cmd', '/c', 'ver']) 57 return "6.1.7600" 58 59 port._executive = MockExecutive2(run_command_fn=mock_run_command) 60 self.assertEquals(port._detect_version(), '7sp0') 61 62 def mock_run_command(cmd): 63 raise ScriptError('Failure') 64 65 port._executive = MockExecutive2(run_command_fn=mock_run_command) 66 # Failures log to the python error log, but we have no easy way to capture/test that. 67 self.assertEquals(port._detect_version(), None) 68 69 def _assert_search_path(self, expected_search_paths, version, use_webkit2=False): 70 port = WinPort(os_version_string=version, 71 options=MockOptions(webkit_test_runner=use_webkit2), 72 filesystem=MockFileSystem(), 73 user=MockUser(), 74 executive=MockExecutive()) 75 absolute_search_paths = map(port._webkit_baseline_path, expected_search_paths) 76 self.assertEquals(port.baseline_search_path(), absolute_search_paths) 77 78 def test_baseline_search_path(self): 79 self._assert_search_path(['win-xp', 'win-vista', 'win-7sp0', 'win', 'mac-snowleopard', 'mac'], 'xp') 80 self._assert_search_path(['win-vista', 'win-7sp0', 'win', 'mac-snowleopard', 'mac'], 'vista') 81 self._assert_search_path(['win-7sp0', 'win', 'mac-snowleopard', 'mac'], '7sp0') 82 self._assert_search_path(['win', 'mac-snowleopard', 'mac'], 'bogus') 83 84 self._assert_search_path(['win-wk2', 'win-xp', 'win-vista', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'xp', use_webkit2=True) 85 self._assert_search_path(['win-wk2', 'win-vista', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'vista', use_webkit2=True) 86 self._assert_search_path(['win-wk2', 'win-7sp0', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], '7sp0', use_webkit2=True) 87 self._assert_search_path(['win-wk2', 'win', 'mac-wk2', 'mac-snowleopard', 'mac'], 'bogus', use_webkit2=True)
Note: See TracChangeset
for help on using the changeset viewer.