Changeset 90826 in webkit
- Timestamp:
- Jul 12, 2011 10:52:54 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90824 r90826 1 2011-07-12 Eric Seidel <eric@webkit.org> 2 3 NRWT should open test results page with Safari trunk, not the system provided one on Mac 4 https://bugs.webkit.org/show_bug.cgi?id=64346 5 6 Reviewed by Adam Barth. 7 8 To fix this I implemented Port.show_results_html_file in Mac, Gtk and Qt ports with 9 implementations (mostly) matching those found in old-run-webkit-tests. 10 There are still some minor differences for Qt which Qt hackers may wish to tweak. 11 12 I had to add a WebKitPort._port_flag_for_scripts method (similar to flag() in common.config.ports.py) 13 for the Qt/Gtk ports which always require a flag passed to scripts. 14 15 While trying to test this, I found that FactoryTest.test_chromium_gpu_linux 16 was using a real filesystem (due to assert_platform) which due to 17 global variables in config.py was causing set-webkit-configuration to have 18 an affect on unit test results! So I fixed this by making FactoryTest.assert_port 19 pass a mock file system whenever calling factory.get. 20 21 Unfortunately TestPort was depending on always being passed a None filesystem 22 and asserting filesystem._tests (only true for unit_test_filesystem()). 23 So I just removed the FactoryTest.test_test and FactoryTest.test_dryrun tests 24 deciding that they were pretty much useless anyway. If others feel strongly 25 I'm happy to fix this in a different way. 26 27 * Scripts/webkitpy/common/system/executive.py: 28 - default arguments in python are screwy. They use a single shared 29 instance, so it's better to use argument=None and then argument = argument or Default() 30 if you have any chance of mutating (or returning) the default argument. 31 * Scripts/webkitpy/layout_tests/port/config.py: 32 - This code is wrong. We don't need to use a global variable here (as far as I can tell). 33 I'm not fixing it in this patch, but I've marked it with a FIXME and we can convert to 34 storing the results of the read on the Config object (which should only be created once during normal operation). 35 Unit tests shouldn't be hitting the disk anyway. It's possible Config should move off of Port and onto Tool/Host directly. 36 * Scripts/webkitpy/layout_tests/port/factory.py: 37 * Scripts/webkitpy/layout_tests/port/factory_unittest.py: 38 * Scripts/webkitpy/layout_tests/port/gtk.py: 39 * Scripts/webkitpy/layout_tests/port/gtk_unittest.py: Added. 40 * Scripts/webkitpy/layout_tests/port/mac.py: 41 * Scripts/webkitpy/layout_tests/port/mac_unittest.py: 42 * Scripts/webkitpy/layout_tests/port/qt.py: 43 * Scripts/webkitpy/layout_tests/port/qt_unittest.py: 44 * Scripts/webkitpy/layout_tests/port/webkit.py: 45 1 46 2011-07-12 Adam Roben <aroben@apple.com> 2 47 -
trunk/Tools/Scripts/webkitpy/common/system/executive.py
r90534 r90826 184 184 185 185 @staticmethod 186 def interpreter_for_script(script_path, fs=FileSystem()): 186 def interpreter_for_script(script_path, fs=None): 187 fs = fs or FileSystem() 187 188 lines = fs.read_text_file(script_path).splitlines() 188 189 if not len(lines): … … 200 201 201 202 @staticmethod 202 def shell_command_for_script(script_path, fs=FileSystem()): 203 def shell_command_for_script(script_path, fs=None): 204 fs = fs or FileSystem() 203 205 # Win32 does not support shebang. We need to detect the interpreter ourself. 204 206 if sys.platform == 'win32': -
trunk/Tools/Scripts/webkitpy/layout_tests/port/config.py
r90051 r90826 132 132 # FIXME: See the comment at the top of the file regarding unit tests 133 133 # and our use of global mutable static variables. 134 # FIXME: We should just @memoize this method and then this will only 135 # be read once per object lifetime (which should be sufficiently fast). 134 136 global _have_determined_configuration, _configuration 135 137 if not _have_determined_configuration: … … 147 149 def _read_configuration(self): 148 150 try: 149 configuration_path = self._filesystem.join(self.build_directory(None), 150 "Configuration") 151 configuration_path = self._filesystem.join(self.build_directory(None), "Configuration") 151 152 if not self._filesystem.exists(configuration_path): 152 153 return None -
trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py
r89031 r90826 76 76 77 77 if port_to_use is None: 78 raise NotImplementedError('unknown port; sys.platform = "%s"' % 79 sys.platform) 78 raise NotImplementedError('unknown port; sys.platform = "%s"' % sys.platform) 80 79 81 80 if port_to_use.startswith('test'): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
r89031 r90826 30 30 import unittest 31 31 32 from webkitpy.tool import mocktool 32 from webkitpy.common.system.filesystem_mock import MockFileSystem 33 from webkitpy.tool.mocktool import MockOptions, MockUser, MockExecutive 33 34 34 35 import chromium_gpu … … 57 58 def setUp(self): 58 59 self.real_sys_platform = sys.platform 59 self.webkit_options = mocktool.MockOptions(pixel_tests=False) 60 self.chromium_options = mocktool.MockOptions(pixel_tests=False, 61 chromium=True) 60 self.webkit_options = MockOptions(pixel_tests=False) 61 self.chromium_options = MockOptions(pixel_tests=False, chromium=True) 62 62 63 63 def tearDown(self): … … 72 72 port_obj: optional port object 73 73 """ 74 port_obj = port_obj or factory.get(port_name=port_name) 74 75 port_obj = port_obj or factory.get(port_name=port_name, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) 75 76 self.assertTrue(isinstance(port_obj, expected_port)) 76 77 … … 86 87 orig_platform = sys.platform 87 88 sys.platform = platform 88 self.assertTrue(isinstance(factory.get(options=options), 89 expected_port)) 89 self.assertTrue(isinstance(factory.get(options=options, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()), expected_port)) 90 90 sys.platform = orig_platform 91 92 def test_test(self):93 self.assert_port("test", test.TestPort)94 95 def test_dryrun(self):96 self.assert_port("dryrun-test", dryrun.DryRunPort)97 self.assert_port("dryrun-mac", dryrun.DryRunPort)98 91 99 92 def test_mac(self): … … 112 105 # The actual Chrome class names aren't available so we test that the 113 106 # objects we get are at least subclasses of the Chromium versions. 114 self.assert_port("google-chrome-linux32", 115 chromium_linux.ChromiumLinuxPort) 116 self.assert_port("google-chrome-linux64", 117 chromium_linux.ChromiumLinuxPort) 118 self.assert_port("google-chrome-win", 119 chromium_win.ChromiumWinPort) 120 self.assert_port("google-chrome-mac", 121 chromium_mac.ChromiumMacPort) 107 self.assert_port("google-chrome-linux32", chromium_linux.ChromiumLinuxPort) 108 self.assert_port("google-chrome-linux64", chromium_linux.ChromiumLinuxPort) 109 self.assert_port("google-chrome-win", chromium_win.ChromiumWinPort) 110 self.assert_port("google-chrome-mac", chromium_mac.ChromiumMacPort) 122 111 123 112 def test_gtk(self): … … 158 147 # Test what happens when you specify an unknown port. 159 148 orig_platform = sys.platform 160 self.assertRaises(NotImplementedError, factory.get, 161 port_name='unknown') 149 self.assertRaises(NotImplementedError, factory.get, port_name='unknown') 162 150 163 151 def test_unknown_default(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py
r90810 r90826 60 60 port_name = "gtk" 61 61 62 def _port_flag_for_scripts(self): 63 return "--gtk" 64 62 65 def create_driver(self, worker_number): 63 66 return GtkDriver(self, worker_number) … … 106 109 def _runtime_feature_list(self): 107 110 return None 111 112 # FIXME: We should find a way to share this implmentation with Gtk, 113 # or teach run-launcher how to call run-safari and move this down to WebKitPort. 114 def show_results_html_file(self, results_filename): 115 run_launcher_args = ["file://%s" % results_filename] 116 if self.get_option('webkit_test_runner'): 117 run_launcher_args.append('--webkit-test-runner') 118 # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] 119 # FIXME: old-run-webkit-tests converted results_filename path for cygwin. 120 self._run_script("run-launcher", run_launcher_args) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py
r90810 r90826 116 116 def _path_to_webcore_library(self): 117 117 return self._build_path('WebCore.framework/Versions/A/WebCore') 118 119 def show_results_html_file(self, results_filename): 120 self._run_script('run-safari', ['-NSOpen', results_filename]) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
r90543 r90826 34 34 from webkitpy.layout_tests.port import port_testcase 35 35 from webkitpy.common.system.filesystem_mock import MockFileSystem 36 from webkitpy.common.system.outputcapture import OutputCapture 36 37 from webkitpy.tool.mocktool import MockOptions, MockUser, MockExecutive 37 38 … … 39 40 class MacTest(port_testcase.PortTestCase): 40 41 def port_maker(self, platform): 42 # FIXME: This platform check should no longer be necessary and should be removed as soon as possible. 41 43 if platform != 'darwin': 42 44 return None … … 142 144 self._assert_search_path(['mac-wk2', 'mac-snowleopard', 'mac'], 'snowleopard', use_webkit2=True) 143 145 146 def test_show_results_html_file(self): 147 port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) 148 # Delay setting a should_log executive to avoid logging from MacPort.__init__. 149 port._executive = MockExecutive(should_log=True) 150 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-safari', '--release', '-NSOpen', 'test.html']\n" 151 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) 152 144 153 145 154 if __name__ == '__main__': -
trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py
r90810 r90826 43 43 port_name = "qt" 44 44 45 def _port_flag_for_scripts(self): 46 return "--qt" 47 45 48 def _operating_system_for_platform(self, platform): 46 49 if platform.startswith('linux'): … … 84 87 env['QTWEBKIT_PLUGIN_PATH'] = self._build_path('lib/plugins') 85 88 return env 89 90 # FIXME: We should find a way to share this implmentation with Gtk, 91 # or teach run-launcher how to call run-safari and move this down to WebKitPort. 92 def show_results_html_file(self, results_filename): 93 run_launcher_args = ["file://%s" % results_filename] 94 if self.get_option('webkit_test_runner'): 95 run_launcher_args.append('--webkit-test-runner') 96 self._run_script("run-launcher", run_launcher_args) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py
r90548 r90826 30 30 31 31 from webkitpy.common.system.filesystem_mock import MockFileSystem 32 from webkitpy.common.system.outputcapture import OutputCapture 32 33 from webkitpy.layout_tests.port.qt import QtPort 34 from webkitpy.layout_tests.port import port_testcase 33 35 from webkitpy.tool.mocktool import MockOptions, MockUser, MockExecutive 34 36 35 37 36 class QtPortTest(unittest.TestCase): 38 class QtPortTest(port_testcase.PortTestCase): 39 def port_maker(self, platform): 40 return QtPort 41 37 42 def _assert_search_path(self, search_paths, sys_platform, use_webkit2=False): 38 43 # FIXME: Port constructors should not "parse" the port name, but … … 57 62 self._assert_search_path(['qt-wk2', 'qt-win', 'qt'], 'cygwin', use_webkit2=True) 58 63 self._assert_search_path(['qt-wk2', 'qt-linux', 'qt'], 'linux2', use_webkit2=True) 64 65 def test_show_results_html_file(self): 66 port = self.make_port() 67 port._executive = MockExecutive(should_log=True) 68 expected_stderr = "MOCK run_command: ['Tools/Scripts/run-launcher', '--release', '--qt', 'file://test.html']\n" 69 OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r90810 r90826 94 94 return "build-dumprendertree" 95 95 96 def _port_flag_for_scripts(self): 97 # This is overrriden by ports which need a flag passed to scripts to distinguish the use of that port. 98 # For example --qt on linux, since a user might have both Gtk and Qt libraries installed. 99 # FIXME: Chromium should override this once ChromiumPort is a WebKitPort. 100 return None 101 102 # This is modeled after webkitdirs.pm argumentsForConfiguration() from old-run-webkit-tests 103 def _arguments_for_configuration(self): 104 config_args = [] 105 config_args.append(self._config.flag_for_configuration(self.get_option('configuration'))) 106 # FIXME: We may need to add support for passing --32-bit like old-run-webkit-tests had. 107 port_flag = self._port_flag_for_scripts() 108 if port_flag: 109 config_args.append(port_flag) 110 return config_args 111 112 def _run_script(self, script_name, args=None, include_configuration_arguments=True): 113 run_script_command = [self._config.script_path(script_name)] 114 if include_configuration_arguments: 115 run_script_command.extend(self._arguments_for_configuration()) 116 if args: 117 run_script_command.extend(args) 118 return self._executive.run_command(run_script_command, cwd=self._config.webkit_base_dir()) # It's unclear if setting cwd is necessary for all callers. 119 96 120 def _build_driver(self): 97 configuration = self.get_option('configuration')98 121 try: 99 # FIXME: We should probably have a run_script helper which automatically adds the configuration flags. 100 self._executive.run_command([ 101 self._config.script_path(self._driver_build_script_name()), 102 self._config.flag_for_configuration(configuration)], 103 # FIXME: It's unclear if this cwd= is necessary. Again a helper should do this for us. 104 cwd=self._config.webkit_base_dir()) 122 self._run_script(self._driver_build_script_name()) 105 123 except ScriptError: 106 124 _log.error("Failed to build %s" % self.driver_name())
Note: See TracChangeset
for help on using the changeset viewer.