| OLD | NEW |
| (Empty) |
| 1 # Copyright (C) 2009, Google Inc. All rights reserved. | |
| 2 # | |
| 3 # Redistribution and use in source and binary forms, with or without | |
| 4 # modification, are permitted provided that the following conditions are | |
| 5 # met: | |
| 6 # | |
| 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 | |
| 12 # distribution. | |
| 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. | |
| 16 # | |
| 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. | |
| 28 # | |
| 29 # WebKit's Python module for understanding the various ports | |
| 30 | |
| 31 import os | |
| 32 import platform | |
| 33 import sys | |
| 34 | |
| 35 from webkitpy.common.system.executive import Executive | |
| 36 | |
| 37 | |
| 38 class DeprecatedPort(object): | |
| 39 results_directory = "/tmp/layout-test-results" | |
| 40 | |
| 41 # Subclasses must override | |
| 42 port_flag_name = None | |
| 43 | |
| 44 # FIXME: This is only used by BotInfo. | |
| 45 def name(self): | |
| 46 return self.__class__ | |
| 47 | |
| 48 def flag(self): | |
| 49 if self.port_flag_name: | |
| 50 return "--port=%s" % self.port_flag_name | |
| 51 return None | |
| 52 | |
| 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) | |
| 56 | |
| 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) | |
| 60 | |
| 61 @staticmethod | |
| 62 def port(port_name): | |
| 63 ports = { | |
| 64 "chromium": ChromiumPort, | |
| 65 "chromium-android": AndroidPort, | |
| 66 "chromium-xvfb": ChromiumXVFBPort, | |
| 67 } | |
| 68 return ports.get(port_name, ChromiumPort)() | |
| 69 | |
| 70 def makeArgs(self): | |
| 71 # FIXME: This shouldn't use a static Executive(). | |
| 72 args = '--makeargs="-j%s"' % Executive().cpu_count() | |
| 73 if os.environ.has_key('MAKEFLAGS'): | |
| 74 args = '--makeargs="%s"' % os.environ['MAKEFLAGS'] | |
| 75 return args | |
| 76 | |
| 77 def check_webkit_style_command(self): | |
| 78 return self.script_shell_command("check-webkit-style") | |
| 79 | |
| 80 def run_webkit_unit_tests_command(self): | |
| 81 return None | |
| 82 | |
| 83 def run_webkit_tests_command(self): | |
| 84 return self.script_shell_command("run-webkit-tests") | |
| 85 | |
| 86 def run_python_unittests_command(self): | |
| 87 return self.script_shell_command("test-webkitpy") | |
| 88 | |
| 89 def run_perl_unittests_command(self): | |
| 90 return self.script_shell_command("test-webkitperl") | |
| 91 | |
| 92 def run_bindings_tests_command(self): | |
| 93 return self.script_shell_command("run-bindings-tests") | |
| 94 | |
| 95 | |
| 96 class ChromiumPort(DeprecatedPort): | |
| 97 port_flag_name = "chromium" | |
| 98 | |
| 99 def run_webkit_tests_command(self): | |
| 100 # Note: This could be run-webkit-tests now. | |
| 101 command = self.script_shell_command("new-run-webkit-tests") | |
| 102 command.append("--chromium") | |
| 103 command.append("--skip-failing-tests") | |
| 104 return command | |
| 105 | |
| 106 def run_webkit_unit_tests_command(self): | |
| 107 return self.script_shell_command("run-chromium-webkit-unit-tests") | |
| 108 | |
| 109 | |
| 110 class AndroidPort(ChromiumPort): | |
| 111 port_flag_name = "chromium-android" | |
| 112 | |
| 113 | |
| 114 class ChromiumXVFBPort(ChromiumPort): | |
| 115 port_flag_name = "chromium-xvfb" | |
| 116 | |
| 117 def run_webkit_tests_command(self): | |
| 118 return ["xvfb-run"] + super(ChromiumXVFBPort, self).run_webkit_tests_com
mand() | |
| OLD | NEW |