1 # Copyright (C) 2009, Google Inc. All rights reserved.
2 # Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
3 # Copyright (C) 2015 Apple Inc. All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # WebKit's Python module for understanding the various ports
37 from webkitpy.common.system.executive import Executive
40 class DeprecatedPort(object):
41 results_directory = "/tmp/layout-test-results"
43 # Subclasses must override
46 # FIXME: This is only used by BotInfo.
51 if self.port_flag_name:
52 return "--port=%s" % self.port_flag_name
55 # We might need to pass scm into this function for scm.checkout_root
56 def script_path(self, script_name):
57 return os.path.join("Tools", "Scripts", script_name)
59 def script_shell_command(self, script_name):
60 script_path = self.script_path(script_name)
61 return Executive.shell_command_for_script(script_path)
66 "gtk-wk2": GtkWK2Port,
69 "mac-wk2": MacWK2Port,
71 "efl-wk2": EflWK2Port,
77 # Do we really need MacPort as the ultimate default?
78 return ports.get(port_name, default_port.get(platform.system(), MacPort))()
81 # FIXME: This shouldn't use a static Executive().
82 args = '--makeargs="-j%s"' % Executive().cpu_count()
83 if os.environ.has_key('MAKEFLAGS'):
84 args = '--makeargs="%s"' % os.environ['MAKEFLAGS']
87 def update_webkit_command(self, non_interactive=False):
88 return self.script_shell_command("update-webkit")
90 def check_webkit_style_command(self):
91 return self.script_shell_command("check-webkit-style")
93 def prepare_changelog_command(self):
94 return self.script_shell_command("prepare-ChangeLog")
96 def build_webkit_command(self, build_style=None):
97 command = self.script_shell_command("build-webkit")
98 if build_style == "debug":
99 command.append("--debug")
100 if build_style == "release":
101 command.append("--release")
104 def run_javascriptcore_tests_command(self):
105 return self.script_shell_command("run-javascriptcore-tests")
107 def run_webkit_tests_command(self, build_style=None):
108 command = self.script_shell_command("run-webkit-tests")
109 if build_style == "debug":
110 command.append("--debug")
111 if build_style == "release":
112 command.append("--release")
115 def run_python_unittests_command(self):
116 return self.script_shell_command("test-webkitpy")
118 def run_perl_unittests_command(self):
119 return self.script_shell_command("test-webkitperl")
121 def run_bindings_tests_command(self):
122 return self.script_shell_command("run-bindings-tests")
125 class IOSPort(DeprecatedPort):
126 port_flag_name = "ios"
128 def build_webkit_command(self, build_style=None):
129 command = super(IOSPort, self).build_webkit_command(build_style=build_style)
130 command.append("--sdk=iphoneos")
134 class MacPort(DeprecatedPort):
135 port_flag_name = "mac"
137 def run_webkit_tests_command(self, build_style=None):
138 command = super(MacPort, self).run_webkit_tests_command(build_style)
139 command.append("--dump-render-tree")
142 class MacWK2Port(DeprecatedPort):
143 port_flag_name = "mac-wk2"
146 class WinPort(DeprecatedPort):
147 port_flag_name = "win"
149 def run_bindings_tests_command(self):
152 def run_webkit_tests_command(self, build_style=None):
153 command = super(WinPort, self).run_webkit_tests_command(build_style)
154 command.append("--dump-render-tree")
158 class GtkWK2Port(DeprecatedPort):
159 port_flag_name = "gtk-wk2"
161 def build_webkit_command(self, build_style=None):
162 command = super(GtkWK2Port, self).build_webkit_command(build_style=build_style)
163 command.append("--gtk")
164 command.append("--update-gtk")
165 command.append(super(GtkWK2Port, self).makeArgs())
168 def run_webkit_tests_command(self, build_style=None):
169 command = super(GtkWK2Port, self).run_webkit_tests_command(build_style)
170 command.append("--gtk")
174 class EflWK2Port(DeprecatedPort):
175 port_flag_name = "efl-wk2"
177 def build_webkit_command(self, build_style=None):
178 command = super(EflWK2Port, self).build_webkit_command(build_style=build_style)
179 command.append("--efl")
180 command.append("--update-efl")
181 command.append(super(EflWK2Port, self).makeArgs())