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 # Subclasses must override
44 # FIXME: This is only used by BotInfo.
49 if self.port_flag_name:
50 return "--port=%s" % self.port_flag_name
53 # We might need to pass scm into this function for scm.checkout_root
54 def script_path(self, script_name):
55 return os.path.join("Tools", "Scripts", script_name)
57 def script_shell_command(self, script_name):
58 script_path = self.script_path(script_name)
59 return Executive.shell_command_for_script(script_path)
65 "gtk-wk2": GtkWK2Port,
67 "mac-wk2": MacWK2Port,
76 # Do we really need MacPort as the ultimate default?
77 return ports.get(port_name, default_port.get(platform.system(), MacPort))()
80 # FIXME: This shouldn't use a static Executive().
81 args = '--makeargs="-j%s"' % Executive().cpu_count()
82 if os.environ.has_key('MAKEFLAGS'):
83 args = '--makeargs="%s"' % os.environ['MAKEFLAGS']
86 def update_webkit_command(self, non_interactive=False):
87 return self.script_shell_command("update-webkit")
89 def check_webkit_style_command(self):
90 return self.script_shell_command("check-webkit-style")
92 def prepare_changelog_command(self):
93 return self.script_shell_command("prepare-ChangeLog")
95 def build_webkit_command(self, build_style=None):
96 command = self.script_shell_command("build-webkit")
97 if build_style == "debug":
98 command.append("--debug")
99 if build_style == "release":
100 command.append("--release")
103 def run_javascriptcore_tests_command(self):
104 return self.script_shell_command("run-javascriptcore-tests")
106 def run_webkit_unit_tests_command(self):
109 def run_webkit_tests_command(self):
110 return self.script_shell_command("run-webkit-tests")
112 def run_python_unittests_command(self):
113 return self.script_shell_command("test-webkitpy")
115 def run_perl_unittests_command(self):
116 return self.script_shell_command("test-webkitperl")
118 def run_bindings_tests_command(self):
119 return self.script_shell_command("run-bindings-tests")
122 class MacPort(DeprecatedPort):
123 port_flag_name = "mac"
126 class MacWK2Port(DeprecatedPort):
127 port_flag_name = "mac-wk2"
129 def run_webkit_tests_command(self):
130 command = super(MacWK2Port, self).run_webkit_tests_command()
135 class WinPort(DeprecatedPort):
136 port_flag_name = "win"
138 def run_bindings_tests_command(self):
142 class GtkPort(DeprecatedPort):
143 port_flag_name = "gtk"
145 def build_webkit_command(self, build_style=None):
146 command = super(GtkPort, self).build_webkit_command(build_style=build_style)
147 command.append("--gtk")
148 command.append("--update-gtk")
149 command.append("--no-webkit2")
150 command.append(super(GtkPort, self).makeArgs())
153 def run_webkit_tests_command(self):
154 command = super(GtkPort, self).run_webkit_tests_command()
155 command.append("--gtk")
159 class GtkWK2Port(DeprecatedPort):
160 port_flag_name = "gtk-wk2"
162 def build_webkit_command(self, build_style=None):
163 command = super(GtkWK2Port, self).build_webkit_command(build_style=build_style)
164 command.append("--gtk")
165 command.append("--update-gtk")
166 command.append("--no-webkit1")
167 command.append(super(GtkWK2Port, self).makeArgs())
170 def run_webkit_tests_command(self):
171 command = super(GtkWK2Port, self).run_webkit_tests_command()
172 command.append("--gtk")
177 class QtPort(DeprecatedPort):
178 port_flag_name = "qt"
180 def build_webkit_command(self, build_style=None):
181 command = super(QtPort, self).build_webkit_command(build_style=build_style)
182 command.append("--qt")
183 command.append(super(QtPort, self).makeArgs())
187 class EflPort(DeprecatedPort):
188 port_flag_name = "efl"
190 def build_webkit_command(self, build_style=None):
191 command = super(EflPort, self).build_webkit_command(build_style=build_style)
192 command.append("--efl")
193 command.append("--update-efl")
194 command.append(super(EflPort, self).makeArgs())