| Index: Tools/Scripts/webkitpy/layout_tests/port/win.py
|
| diff --git a/Tools/Scripts/webkitpy/layout_tests/port/win.py b/Tools/Scripts/webkitpy/layout_tests/port/win.py
|
| index 88e8d0de15e3ef0de01ea1ae4019f43f1fbb7b63..43846f4b6cb49f95669d48c5ee8e63db0995b662 100644
|
| --- a/Tools/Scripts/webkitpy/layout_tests/port/win.py
|
| +++ b/Tools/Scripts/webkitpy/layout_tests/port/win.py
|
| @@ -28,9 +28,16 @@
|
|
|
| """Windows implementation of the Port interface."""
|
|
|
| +import errno
|
| import os
|
| import logging
|
|
|
| +try:
|
| + import _winreg
|
| +except ImportError as e:
|
| + _winreg = None
|
| + WindowsError = Exception # this shuts up pylint.
|
| +
|
| from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin
|
| from webkitpy.layout_tests.models import test_run_results
|
| from webkitpy.layout_tests.port import base
|
| @@ -78,6 +85,44 @@ class WinPort(base.Port):
|
| flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._dump_reader.crash_dumps_directory()]
|
| return flags
|
|
|
| + def check_httpd(self):
|
| + res = super(WinPort, self).check_httpd()
|
| + if self.get_option('use_apache'):
|
| + # In order to run CGI scripts on Win32 that use unix shebang lines, we need to
|
| + # create entries in the registry that remap the extensions (.pl and .cgi) to the
|
| + # appropriate Win32 paths. The command line arguments must match the command
|
| + # line arguments in the shebang line exactly.
|
| + if _winreg:
|
| + res = self._check_reg(r'.cgi\Shell\ExecCGI\Command') and res
|
| + res = self._check_reg(r'.pl\Shell\ExecCGI\Command') and res
|
| + else:
|
| + _log.warning("Could not check the registry; http may not work correctly.")
|
| +
|
| + return res
|
| +
|
| + def _check_reg(self, sub_key):
|
| + # see commends in check_httpd(), above, for why this routine exists and what it's doing.
|
| + try:
|
| + hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key)
|
| + args = _winreg.QueryValue(hkey, '').split()
|
| + _winreg.CloseKey(hkey)
|
| +
|
| + # In order to keep multiple checkouts from stepping on each other, we simply check that an
|
| + # existing entry points to a valid path and has the right command line.
|
| + if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].endswith('perl.exe') and args[1] == '-wT':
|
| + return True
|
| + except WindowsError, e:
|
| + if e.errno != errno.ENOENT:
|
| + raise e
|
| + # The key simply probably doesn't exist.
|
| + pass
|
| +
|
| + cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'bin', 'perl.exe') + ' -wT'
|
| + hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes\\' + sub_key, 0, _winreg.KEY_WRITE)
|
| + _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline)
|
| + _winreg.CloseKey(hkey)
|
| + return True
|
| +
|
| def setup_test_run(self):
|
| super(WinPort, self).setup_test_run()
|
|
|
| @@ -105,10 +150,15 @@ class WinPort(base.Port):
|
| # We should add the variable to an explicit whitelist in base.Port.
|
| # FIXME: This is a temporary hack to get the cr-win bot online until
|
| # someone from the cr-win port can take a look.
|
| + use_apache = self.get_option('use_apache')
|
| + apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP']
|
| for key, value in os.environ.items():
|
| - if key not in env:
|
| + if key not in env and (not use_apache or key in apache_envvars):
|
| env[key] = value
|
|
|
| + if use_apache:
|
| + return env
|
| +
|
| # Put the cygwin directory first in the path to find cygwin1.dll.
|
| env["PATH"] = "%s;%s" % (self.path_from_chromium_base("third_party", "cygwin", "bin"), env["PATH"])
|
| # Configure the cygwin directory so that pywebsocket finds proper
|
| @@ -144,31 +194,28 @@ class WinPort(base.Port):
|
| path = filename[len(self.layout_tests_dir()) + 1:]
|
| return path.replace('\\', '/')
|
|
|
| - #
|
| - # PROTECTED ROUTINES
|
| - #
|
| + def path_to_apache(self):
|
| + return self.path_from_chromium_base('third_party', 'apache-win32', 'bin', 'httpd.exe')
|
|
|
| - def _uses_apache(self):
|
| - return False
|
| + def path_to_apache_config_file(self):
|
| + return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'win-httpd.conf')
|
|
|
| def _lighttpd_path(self, *comps):
|
| return self.path_from_chromium_base('third_party', 'lighttpd', 'win', *comps)
|
|
|
| - def _path_to_apache(self):
|
| - return self.path_from_chromium_base('third_party', 'cygwin', 'usr', 'sbin', 'httpd')
|
| -
|
| - def _path_to_apache_config_file(self):
|
| - return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'cygwin-httpd.conf')
|
| -
|
| - def _path_to_lighttpd(self):
|
| + def path_to_lighttpd(self):
|
| return self._lighttpd_path('LightTPD.exe')
|
|
|
| - def _path_to_lighttpd_modules(self):
|
| + def path_to_lighttpd_modules(self):
|
| return self._lighttpd_path('lib')
|
|
|
| - def _path_to_lighttpd_php(self):
|
| + def path_to_lighttpd_php(self):
|
| return self._lighttpd_path('php5', 'php-cgi.exe')
|
|
|
| + #
|
| + # PROTECTED ROUTINES
|
| + #
|
| +
|
| def _path_to_driver(self, configuration=None):
|
| binary_name = '%s.exe' % self.driver_name()
|
| return self._build_path_with_configuration(configuration, binary_name)
|
|
|