1 # Copyright (C) 2009, Google Inc. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 # WebKit's Python module for understanding the various ports
35 from webkitpy.common.system.executive import Executive
38 class DeprecatedPort(object):
39 results_directory = "/tmp/layout-test-results"
41 # FIXME: This is only used by BotInfo.
46 if self.port_flag_name:
47 return "--port=%s" % self.port_flag_name
50 # We might need to pass scm into this function for scm.checkout_root
51 def script_path(self, script_name):
52 return os.path.join("Tools", "Scripts", script_name)
54 def script_shell_command(self, script_name):
55 script_path = self.script_path(script_name)
56 return Executive.shell_command_for_script(script_path)
61 "chromium": ChromiumPort,
62 "chromium-android": ChromiumAndroidPort,
63 "chromium-xvfb": ChromiumXVFBPort,
74 # Do we really need MacPort as the ultimate default?
75 return ports.get(port_name, default_port.get(platform.system(), MacPort))()
78 # FIXME: This shouldn't use a static Executive().
79 args = '--makeargs="-j%s"' % Executive().cpu_count()
80 if os.environ.has_key('MAKEFLAGS'):
81 args = '--makeargs="%s"' % os.environ['MAKEFLAGS']
84 def update_webkit_command(self, non_interactive=False):
85 return self.script_shell_command("update-webkit")
87 def check_webkit_style_command(self):
88 return self.script_shell_command("check-webkit-style")
90 def prepare_changelog_command(self):
91 return self.script_shell_command("prepare-ChangeLog")
93 def build_webkit_command(self, build_style=None):
94 command = self.script_shell_command("build-webkit")
95 if build_style == "debug":
96 command.append("--debug")
97 if build_style == "release":
98 command.append("--release")
101 def run_javascriptcore_tests_command(self):
102 return self.script_shell_command("run-javascriptcore-tests")
104 def run_webkit_unit_tests_command(self):
107 def run_webkit_tests_command(self):
108 return self.script_shell_command("run-webkit-tests")
110 def run_python_unittests_command(self):
111 return self.script_shell_command("test-webkitpy")
113 def run_perl_unittests_command(self):
114 return self.script_shell_command("test-webkitperl")
116 def layout_tests_results_path(self):
117 return os.path.join(self.results_directory, "full_results.json")
119 def unit_tests_results_path(self):
120 return os.path.join(self.results_directory, "webkit_unit_tests_output.xml")
123 class MacPort(DeprecatedPort):
124 port_flag_name = "mac"
127 class WinPort(DeprecatedPort):
128 port_flag_name = "win"
131 class GtkPort(DeprecatedPort):
132 port_flag_name = "gtk"
134 def build_webkit_command(self, build_style=None):
135 command = super(GtkPort, self).build_webkit_command(build_style=build_style)
136 command.append("--gtk")
137 command.append("--update-gtk")
138 command.append(super(GtkPort, self).makeArgs())
141 def run_webkit_tests_command(self):
142 command = super(GtkPort, self).run_webkit_tests_command()
143 command.append("--gtk")
147 class QtPort(DeprecatedPort):
148 port_flag_name = "qt"
150 def build_webkit_command(self, build_style=None):
151 command = super(QtPort, self).build_webkit_command(build_style=build_style)
152 command.append("--qt")
153 command.append(super(QtPort, self).makeArgs())
157 class EflPort(DeprecatedPort):
158 port_flag_name = "efl"
160 def build_webkit_command(self, build_style=None):
161 command = super(EflPort, self).build_webkit_command(build_style=build_style)
162 command.append("--efl")
163 command.append(super(EflPort, self).makeArgs())
167 class ChromiumPort(DeprecatedPort):
168 port_flag_name = "chromium"
170 def update_webkit_command(self, non_interactive=False):
171 command = super(ChromiumPort, self).update_webkit_command(non_interactive=non_interactive)
172 command.append("--chromium")
174 command.append("--force-update")
177 def build_webkit_command(self, build_style=None):
178 command = super(ChromiumPort, self).build_webkit_command(build_style=build_style)
179 command.append("--chromium")
180 command.append("--update-chromium")
183 def run_webkit_tests_command(self):
184 # Note: This could be run-webkit-tests now.
185 command = self.script_shell_command("new-run-webkit-tests")
186 command.append("--chromium")
187 command.append("--skip-failing-tests")
190 def run_webkit_unit_tests_command(self):
191 return self.script_shell_command("run-chromium-webkit-unit-tests")
193 def run_javascriptcore_tests_command(self):
197 class ChromiumAndroidPort(ChromiumPort):
198 port_flag_name = "chromium-android"
200 def update_webkit_command(self, non_interactive=False):
201 command = super(ChromiumAndroidPort, self).update_webkit_command(non_interactive=non_interactive)
202 command.append("--chromium-android")
205 def build_webkit_command(self, build_style=None):
206 command = super(ChromiumAndroidPort, self).build_webkit_command(build_style=build_style)
207 command.append("--chromium-android")
211 class ChromiumXVFBPort(ChromiumPort):
212 port_flag_name = "chromium-xvfb"
214 def run_webkit_tests_command(self):
215 return ["xvfb-run"] + super(ChromiumXVFBPort, self).run_webkit_tests_command()