Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/win.py

Issue 135583003: checkpoint Blink-side work to use Apache on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: new rollup patch Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """Windows implementation of the Port interface.""" 29 """Windows implementation of the Port interface."""
30 30
31 import errno
31 import os 32 import os
32 import logging 33 import logging
33 34
35 try:
36 import _winreg
37 except ImportError as e:
38 _winreg = None
39 WindowsError = Exception # this shuts up pylint.
40
34 from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin 41 from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin
35 from webkitpy.layout_tests.models import test_run_results 42 from webkitpy.layout_tests.models import test_run_results
36 from webkitpy.layout_tests.port import base 43 from webkitpy.layout_tests.port import base
37 from webkitpy.layout_tests.servers import crash_service 44 from webkitpy.layout_tests.servers import crash_service
38 45
39 46
40 _log = logging.getLogger(__name__) 47 _log = logging.getLogger(__name__)
41 48
42 49
43 class WinPort(base.Port): 50 class WinPort(base.Port):
(...skipping 27 matching lines...) Expand all
71 self._dump_reader = DumpReaderWin(host, self._build_path()) 78 self._dump_reader = DumpReaderWin(host, self._build_path())
72 self._crash_service = None 79 self._crash_service = None
73 self._crash_service_available = None 80 self._crash_service_available = None
74 81
75 def additional_drt_flag(self): 82 def additional_drt_flag(self):
76 flags = super(WinPort, self).additional_drt_flag() 83 flags = super(WinPort, self).additional_drt_flag()
77 if not self.get_option('disable_breakpad'): 84 if not self.get_option('disable_breakpad'):
78 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._ dump_reader.crash_dumps_directory()] 85 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._ dump_reader.crash_dumps_directory()]
79 return flags 86 return flags
80 87
88 def check_httpd(self):
89 res = super(WinPort, self).check_httpd()
90 if self.get_option('use_apache'):
91 # In order to run CGI scripts on Win32 that use unix shebang lines, we need to
92 # create entries in the registry that remap the extensions (.pl and .cgi) to the
93 # appropriate Win32 paths. The command line arguments must match the command
94 # line arguments in the shebang line exactly.
95 if _winreg:
96 res = self._check_reg(r'.cgi\Shell\ExecCGI\Command') and res
97 res = self._check_reg(r'.pl\Shell\ExecCGI\Command') and res
98 else:
99 _log.warning("Could not check the registry; http may not work co rrectly.")
100
101 return res
102
103 def _check_reg(self, sub_key):
104 # see commends in check_httpd(), above, for why this routine exists and what it's doing.
105 try:
106 hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key)
107 args = _winreg.QueryValue(hkey, '').split()
108 _winreg.CloseKey(hkey)
109
110 # In order to keep multiple checkouts from stepping on each other, w e simply check that an
111 # existing entry points to a valid path and has the right command li ne.
112 if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].e ndswith('perl.exe') and args[1] == '-wT':
113 return True
114 except WindowsError, e:
115 if e.errno != errno.ENOENT:
116 raise e
117 # The key simply probably doesn't exist.
118 pass
119
120 cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'b in', 'perl.exe') + ' -wT'
121 hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes \\' + sub_key, 0, _winreg.KEY_WRITE)
122 _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline)
123 _winreg.CloseKey(hkey)
124 return True
125
81 def setup_test_run(self): 126 def setup_test_run(self):
82 super(WinPort, self).setup_test_run() 127 super(WinPort, self).setup_test_run()
83 128
84 if not self.get_option('disable_breakpad'): 129 if not self.get_option('disable_breakpad'):
85 assert not self._crash_service, 'Already running a crash service' 130 assert not self._crash_service, 'Already running a crash service'
86 if self._crash_service_available == None: 131 if self._crash_service_available == None:
87 self._crash_service_available = self._check_crash_service_availa ble() 132 self._crash_service_available = self._check_crash_service_availa ble()
88 if not self._crash_service_available: 133 if not self._crash_service_available:
89 return 134 return
90 service = crash_service.CrashService(self, self._dump_reader.crash_d umps_directory()) 135 service = crash_service.CrashService(self, self._dump_reader.crash_d umps_directory())
91 service.start() 136 service.start()
92 self._crash_service = service 137 self._crash_service = service
93 138
94 def clean_up_test_run(self): 139 def clean_up_test_run(self):
95 super(WinPort, self).clean_up_test_run() 140 super(WinPort, self).clean_up_test_run()
96 141
97 if self._crash_service: 142 if self._crash_service:
98 self._crash_service.stop() 143 self._crash_service.stop()
99 self._crash_service = None 144 self._crash_service = None
100 145
101 def setup_environ_for_server(self, server_name=None): 146 def setup_environ_for_server(self, server_name=None):
102 env = super(WinPort, self).setup_environ_for_server(server_name) 147 env = super(WinPort, self).setup_environ_for_server(server_name)
103 148
104 # FIXME: lighttpd depends on some environment variable we're not whiteli sting. 149 # FIXME: lighttpd depends on some environment variable we're not whiteli sting.
105 # We should add the variable to an explicit whitelist in base.Port. 150 # We should add the variable to an explicit whitelist in base.Port.
106 # FIXME: This is a temporary hack to get the cr-win bot online until 151 # FIXME: This is a temporary hack to get the cr-win bot online until
107 # someone from the cr-win port can take a look. 152 # someone from the cr-win port can take a look.
153 use_apache = self.get_option('use_apache')
154 apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP']
108 for key, value in os.environ.items(): 155 for key, value in os.environ.items():
109 if key not in env: 156 if key not in env and (not use_apache or key in apache_envvars):
110 env[key] = value 157 env[key] = value
111 158
159 if use_apache:
160 return env
161
112 # Put the cygwin directory first in the path to find cygwin1.dll. 162 # Put the cygwin directory first in the path to find cygwin1.dll.
113 env["PATH"] = "%s;%s" % (self.path_from_chromium_base("third_party", "cy gwin", "bin"), env["PATH"]) 163 env["PATH"] = "%s;%s" % (self.path_from_chromium_base("third_party", "cy gwin", "bin"), env["PATH"])
114 # Configure the cygwin directory so that pywebsocket finds proper 164 # Configure the cygwin directory so that pywebsocket finds proper
115 # python executable to run cgi program. 165 # python executable to run cgi program.
116 env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin ", "bin") 166 env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin ", "bin")
117 if self.get_option('register_cygwin'): 167 if self.get_option('register_cygwin'):
118 setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") 168 setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat")
119 self._executive.run_command([setup_mount]) # Paths are all absolute , so this does not require a cwd. 169 self._executive.run_command([setup_mount]) # Paths are all absolute , so this does not require a cwd.
120 return env 170 return env
121 171
(...skipping 15 matching lines...) Expand all
137 _log.error(' http://dev.chromium.org/developers/how-tos/build-ins tructions-windows') 187 _log.error(' http://dev.chromium.org/developers/how-tos/build-ins tructions-windows')
138 return result 188 return result
139 189
140 def operating_system(self): 190 def operating_system(self):
141 return 'win' 191 return 'win'
142 192
143 def relative_test_filename(self, filename): 193 def relative_test_filename(self, filename):
144 path = filename[len(self.layout_tests_dir()) + 1:] 194 path = filename[len(self.layout_tests_dir()) + 1:]
145 return path.replace('\\', '/') 195 return path.replace('\\', '/')
146 196
197 def path_to_apache(self):
198 return self.path_from_chromium_base('third_party', 'apache-win32', 'bin' , 'httpd.exe')
199
200 def path_to_apache_config_file(self):
201 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'w in-httpd.conf')
202
203 def _lighttpd_path(self, *comps):
204 return self.path_from_chromium_base('third_party', 'lighttpd', 'win', *c omps)
205
206 def path_to_lighttpd(self):
207 return self._lighttpd_path('LightTPD.exe')
208
209 def path_to_lighttpd_modules(self):
210 return self._lighttpd_path('lib')
211
212 def path_to_lighttpd_php(self):
213 return self._lighttpd_path('php5', 'php-cgi.exe')
214
147 # 215 #
148 # PROTECTED ROUTINES 216 # PROTECTED ROUTINES
149 # 217 #
150 218
151 def _uses_apache(self):
152 return False
153
154 def _lighttpd_path(self, *comps):
155 return self.path_from_chromium_base('third_party', 'lighttpd', 'win', *c omps)
156
157 def _path_to_apache(self):
158 return self.path_from_chromium_base('third_party', 'cygwin', 'usr', 'sbi n', 'httpd')
159
160 def _path_to_apache_config_file(self):
161 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'c ygwin-httpd.conf')
162
163 def _path_to_lighttpd(self):
164 return self._lighttpd_path('LightTPD.exe')
165
166 def _path_to_lighttpd_modules(self):
167 return self._lighttpd_path('lib')
168
169 def _path_to_lighttpd_php(self):
170 return self._lighttpd_path('php5', 'php-cgi.exe')
171
172 def _path_to_driver(self, configuration=None): 219 def _path_to_driver(self, configuration=None):
173 binary_name = '%s.exe' % self.driver_name() 220 binary_name = '%s.exe' % self.driver_name()
174 return self._build_path_with_configuration(configuration, binary_name) 221 return self._build_path_with_configuration(configuration, binary_name)
175 222
176 def _path_to_helper(self): 223 def _path_to_helper(self):
177 binary_name = 'layout_test_helper.exe' 224 binary_name = 'layout_test_helper.exe'
178 return self._build_path(binary_name) 225 return self._build_path(binary_name)
179 226
180 def _path_to_crash_service(self): 227 def _path_to_crash_service(self):
181 binary_name = 'content_shell_crash_service.exe' 228 binary_name = 'content_shell_crash_service.exe'
(...skipping 16 matching lines...) Expand all
198 return result 245 return result
199 246
200 def look_for_new_crash_logs(self, crashed_processes, start_time): 247 def look_for_new_crash_logs(self, crashed_processes, start_time):
201 if self.get_option('disable_breakpad'): 248 if self.get_option('disable_breakpad'):
202 return None 249 return None
203 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star t_time) 250 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star t_time)
204 251
205 def clobber_old_port_specific_results(self): 252 def clobber_old_port_specific_results(self):
206 if not self.get_option('disable_breakpad'): 253 if not self.get_option('disable_breakpad'):
207 self._dump_reader.clobber_old_results() 254 self._dump_reader.clobber_old_results()
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/test.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698