class WinPort(base.Port): port_name = 'win' # FIXME: Figure out how to unify this with base.TestConfiguration.all_systems()? SUPPORTED_VERSIONS = ('xp', 'win7') FALLBACK_PATHS = { 'win7': [ 'win' ]} FALLBACK_PATHS['xp'] = ['win-xp'] + FALLBACK_PATHS['win7'] DEFAULT_BUILD_DIRECTORIES = ('build', 'out') @classmethod def determine_full_port_name(cls, host, options, port_name): if port_name.endswith('win'): assert host.platform.is_win() # We don't maintain separate baselines for vista, so we pretend it is win7. if host.platform.os_version in ('vista', '7sp0', '7sp1', 'future'): version = 'win7' else: version = host.platform.os_version port_name = port_name + '-' + version return port_name def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (self._version, self.SUPPORTED_VERSIONS) if not self.get_option('disable_breakpad'): self._dump_reader = DumpReaderWin(host, self._build_path()) self._crash_service = None self._crash_service_available = None def additional_drt_flag(self): flags = super(WinPort, self).additional_drt_flag() if not self.get_option('disable_breakpad'): flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._dump_reader.crash_dumps_directory()] return flags def setup_test_run(self): super(WinPort, self).setup_test_run() if not self.get_option('disable_breakpad'): assert not self._crash_service, 'Already running a crash service' if self._crash_service_available == None: self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: return service = crash_service.CrashService(self, self._dump_reader.crash_dumps_directory()) service.start() self._crash_service = service def clean_up_test_run(self): super(WinPort, self).clean_up_test_run() if self._crash_service: self._crash_service.stop() self._crash_service = None def setup_environ_for_server(self, server_name=None): env = super(WinPort, self).setup_environ_for_server(server_name) # FIXME: lighttpd depends on some environment variable we're not whitelisting. # 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. for key, value in os.environ.items(): if key not in env: env[key] = value # 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 # python executable to run cgi program. env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin", "bin") if self.get_option('register_cygwin'): setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") self._executive.run_command([setup_mount]) # Paths are all absolute, so this does not require a cwd. return env def _modules_to_search_for_symbols(self): # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. # See https://bugs.webkit.org/show_bug.cgi?id=89706. return [] def check_build(self, needs_http, printer): result = super(WinPort, self).check_build(needs_http, printer) self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: result = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS if result: _log.error('For complete Windows build requirements, please see:') _log.error('') _log.error(' http://dev.chromium.org/developers/how-tos/build-instructions-windows') return result def operating_system(self): return 'win' def relative_test_filename(self, filename): path = filename[len(self.layout_tests_dir()) + 1:] return path.replace('\\', '/') def uses_apache(self): return False 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): return self._lighttpd_path('LightTPD.exe') def path_to_lighttpd_modules(self): return self._lighttpd_path('lib') def path_to_lighttpd_php(self): return self._lighttpd_path('php5', 'php-cgi.exe') # # PROTECTED ROUTINES # def _lighttpd_path(self, *comps): return self.path_from_chromium_base('third_party', 'lighttpd', 'win', *comps) def _path_to_driver(self, configuration=None): binary_name = '%s.exe' % self.driver_name() return self._build_path_with_configuration(configuration, binary_name) def _path_to_helper(self): binary_name = 'layout_test_helper.exe' return self._build_path(binary_name) def _path_to_crash_service(self): binary_name = 'content_shell_crash_service.exe' return self._build_path(binary_name) def _path_to_image_diff(self): binary_name = 'image_diff.exe' return self._build_path(binary_name) def _path_to_wdiff(self): return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdiff.exe') def _check_crash_service_available(self): """Checks whether the crash service binary is present.""" result = self._check_file_exists(self._path_to_crash_service(), "content_shell_crash_service.exe") if not result: _log.error(" Could not find crash service, unexpected crashes won't be symbolized.") _log.error(' Did you build the target all_webkit?') _log.error('') return result def look_for_new_crash_logs(self, crashed_processes, start_time): if self.get_option('disable_breakpad'): return None return self._dump_reader.look_for_new_crash_logs(crashed_processes, start_time) def clobber_old_port_specific_results(self): if not self.get_option('disable_breakpad'): self._dump_reader.clobber_old_results()
class WinPort(base.Port): port_name = 'win' SUPPORTED_VERSIONS = ('win7', 'win10') FALLBACK_PATHS = {'win10': ['win']} FALLBACK_PATHS['win7'] = ['win7'] + FALLBACK_PATHS['win10'] DEFAULT_BUILD_DIRECTORIES = ('build', 'out') BUILD_REQUIREMENTS_URL = 'http://www.chromium.org/developers/how-tos/build-instructions-windows' @classmethod def determine_full_port_name(cls, host, options, port_name): if port_name.endswith('win'): assert host.platform.is_win() # We don't maintain separate baselines for vista, so we pretend it is win7. if host.platform.os_version in ('vista', '7sp0', '7sp1'): version = 'win7' # Same for win8, we treat it as win10. elif host.platform.os_version in ('8', '8.1', '10', 'future'): version = 'win10' else: version = host.platform.os_version port_name = port_name + '-' + version return port_name def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (self._version, self.SUPPORTED_VERSIONS) if self.get_option('disable_breakpad'): self._dump_reader = None else: self._dump_reader = DumpReaderWin(host, self._build_path()) self._crash_service = None self._crash_service_available = None def additional_driver_flag(self): flags = super(WinPort, self).additional_driver_flag() flags += ['--enable-direct-write'] if not self.get_option('disable_breakpad'): 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.uses_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 comments in check_httpd(), above, for why this routine exists and what it's doing. try: # Note that we HKCR is a union of HKLM and HKCR (with the latter # overriding the former), so reading from HKCR ensures that we get # the value if it is set in either place. See als comments below. 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 as e: if e.errno != errno.ENOENT: raise e # The key simply probably doesn't exist. # Note that we write to HKCU so that we don't need privileged access # to the registry, and that will get reflected in HKCR when it is read, above. 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() if not self.get_option('disable_breakpad'): assert not self._crash_service, 'Already running a crash service' if self._crash_service_available is None: self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: return service = crash_service.CrashService(self, self._dump_reader.crash_dumps_directory()) service.start() self._crash_service = service def clean_up_test_run(self): super(WinPort, self).clean_up_test_run() if self._crash_service: self._crash_service.stop() self._crash_service = None def setup_environ_for_server(self): env = super(WinPort, self).setup_environ_for_server() # FIXME: This is a temporary hack to get the cr-win bot online until # someone from the cr-win port can take a look. apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP'] for key, value in self.host.environ.copy().items(): if key not in env and key in apache_envvars: env[key] = value # 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 # python executable to run cgi program. env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin", "bin") if self.get_option('register_cygwin'): setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") self._executive.run_command([setup_mount]) # Paths are all absolute, so this does not require a cwd. return env def _modules_to_search_for_symbols(self): # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. # See https://bugs.webkit.org/show_bug.cgi?id=89706. return [] def check_build(self, needs_http, printer): result = super(WinPort, self).check_build(needs_http, printer) self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: result = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS if result: _log.error('For complete Windows build requirements, please see:') _log.error('') _log.error(' http://dev.chromium.org/developers/how-tos/build-instructions-windows') return result def operating_system(self): return 'win' def relative_test_filename(self, filename): path = filename[len(self.layout_tests_dir()) + 1:] return path.replace('\\', '/') def uses_apache(self): val = self.get_option('use_apache') if val is None: return True return val def path_to_apache(self): return self.path_from_chromium_base('third_party', 'apache-win32', 'bin', 'httpd.exe') def path_to_apache_config_file(self): return self._filesystem.join(self.apache_config_directory(), 'win-httpd.conf') # # PROTECTED ROUTINES # def _path_to_driver(self, target=None): binary_name = '%s.exe' % self.driver_name() return self._build_path_with_target(target, binary_name) def _path_to_crash_service(self): binary_name = 'content_shell_crash_service.exe' return self._build_path(binary_name) def _path_to_image_diff(self): binary_name = 'image_diff.exe' return self._build_path(binary_name) def _path_to_wdiff(self): return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdiff.exe') def _check_crash_service_available(self): """Checks whether the crash service binary is present.""" result = self._check_file_exists(self._path_to_crash_service(), "content_shell_crash_service.exe") if not result: _log.error(" Could not find crash service, unexpected crashes won't be symbolized.") _log.error(' Did you build the target blink_tests?') _log.error('') return result def look_for_new_crash_logs(self, crashed_processes, start_time): if self.get_option('disable_breakpad'): return None return self._dump_reader.look_for_new_crash_logs(crashed_processes, start_time) def clobber_old_port_specific_results(self): if not self.get_option('disable_breakpad'): self._dump_reader.clobber_old_results()
class WinPort(base.Port): port_name = 'win' # FIXME: Figure out how to unify this with base.TestConfiguration.all_systems()? SUPPORTED_VERSIONS = ('xp', 'win7') FALLBACK_PATHS = {'win7': ['win']} FALLBACK_PATHS['xp'] = ['win-xp'] + FALLBACK_PATHS['win7'] DEFAULT_BUILD_DIRECTORIES = ('build', 'out') @classmethod def determine_full_port_name(cls, host, options, port_name): if port_name.endswith('win'): assert host.platform.is_win() # We don't maintain separate baselines for vista, so we pretend it is win7. if host.platform.os_version in ('vista', '7sp0', '7sp1', 'future'): version = 'win7' else: version = host.platform.os_version port_name = port_name + '-' + version return port_name def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % ( self._version, self.SUPPORTED_VERSIONS) if not self.get_option('disable_breakpad'): self._dump_reader = DumpReaderWin(host, self._build_path()) self._crash_service = None self._crash_service_available = None def additional_drt_flag(self): flags = super(WinPort, self).additional_drt_flag() if not self.get_option('disable_breakpad'): flags += [ '--enable-crash-reporter', '--crash-dumps-dir=%s' % self._dump_reader.crash_dumps_directory() ] return flags def setup_test_run(self): super(WinPort, self).setup_test_run() if not self.get_option('disable_breakpad'): assert not self._crash_service, 'Already running a crash service' if self._crash_service_available == None: self._crash_service_available = self._check_crash_service_available( ) if not self._crash_service_available: return service = crash_service.CrashService( self, self._dump_reader.crash_dumps_directory()) service.start() self._crash_service = service def clean_up_test_run(self): super(WinPort, self).clean_up_test_run() if self._crash_service: self._crash_service.stop() self._crash_service = None def setup_environ_for_server(self, server_name=None): env = super(WinPort, self).setup_environ_for_server(server_name) # FIXME: lighttpd depends on some environment variable we're not whitelisting. # 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. for key, value in os.environ.items(): if key not in env: env[key] = value # 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 # python executable to run cgi program. env["CYGWIN_PATH"] = self.path_from_chromium_base( "third_party", "cygwin", "bin") if self.get_option('register_cygwin'): setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") self._executive.run_command([ setup_mount ]) # Paths are all absolute, so this does not require a cwd. return env def _modules_to_search_for_symbols(self): # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. # See https://bugs.webkit.org/show_bug.cgi?id=89706. return [] def check_build(self, needs_http, printer): result = super(WinPort, self).check_build(needs_http, printer) self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: result = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS if result: _log.error('For complete Windows build requirements, please see:') _log.error('') _log.error( ' http://dev.chromium.org/developers/how-tos/build-instructions-windows' ) return result def operating_system(self): return 'win' def relative_test_filename(self, filename): path = filename[len(self.layout_tests_dir()) + 1:] return path.replace('\\', '/') # # PROTECTED ROUTINES # def _uses_apache(self): return False 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): return self._lighttpd_path('LightTPD.exe') def _path_to_lighttpd_modules(self): return self._lighttpd_path('lib') def _path_to_lighttpd_php(self): return self._lighttpd_path('php5', 'php-cgi.exe') def _path_to_driver(self, configuration=None): binary_name = '%s.exe' % self.driver_name() return self._build_path_with_configuration(configuration, binary_name) def _path_to_helper(self): binary_name = 'LayoutTestHelper.exe' return self._build_path(binary_name) def _path_to_crash_service(self): binary_name = 'content_shell_crash_service.exe' return self._build_path(binary_name) def _path_to_image_diff(self): binary_name = 'image_diff.exe' return self._build_path(binary_name) def _path_to_wdiff(self): return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdiff.exe') def _check_crash_service_available(self): """Checks whether the crash service binary is present.""" result = self._check_file_exists(self._path_to_crash_service(), "content_shell_crash_service.exe") if not result: _log.error( " Could not find crash service, unexpected crashes won't be symbolized." ) _log.error(' Did you build the target all_webkit?') _log.error('') return result def look_for_new_crash_logs(self, crashed_processes, start_time): if self.get_option('disable_breakpad'): return None return self._dump_reader.look_for_new_crash_logs( crashed_processes, start_time) def clobber_old_port_specific_results(self): if not self.get_option('disable_breakpad'): self._dump_reader.clobber_old_results()
class WinPort(base.Port): port_name = 'win' SUPPORTED_VERSIONS = ('win7', 'win10') FALLBACK_PATHS = {'win10': ['win']} FALLBACK_PATHS['win7'] = ['win7'] + FALLBACK_PATHS['win10'] DEFAULT_BUILD_DIRECTORIES = ('build', 'out') BUILD_REQUIREMENTS_URL = 'http://www.chromium.org/developers/how-tos/build-instructions-windows' @classmethod def determine_full_port_name(cls, host, options, port_name): if port_name.endswith('win'): assert host.platform.is_win() # We don't maintain separate baselines for vista, so we pretend it is win7. if host.platform.os_version in ('vista', '7sp0', '7sp1'): version = 'win7' # Same for win8, we treat it as win10. elif host.platform.os_version in ('8', '8.1', '10', 'future'): version = 'win10' else: version = host.platform.os_version port_name = port_name + '-' + version return port_name def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % ( self._version, self.SUPPORTED_VERSIONS) if self.get_option('disable_breakpad'): self._dump_reader = None else: self._dump_reader = DumpReaderWin(host, self._build_path()) self._crash_service = None self._crash_service_available = None def additional_driver_flag(self): flags = super(WinPort, self).additional_driver_flag() flags += ['--enable-direct-write'] if not self.get_option('disable_breakpad'): 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.uses_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 comments in check_httpd(), above, for why this routine exists and what it's doing. try: # Note that we HKCR is a union of HKLM and HKCR (with the latter # overriding the former), so reading from HKCR ensures that we get # the value if it is set in either place. See als comments below. 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 as e: if e.errno != errno.ENOENT: raise e # The key simply probably doesn't exist. # Note that we write to HKCU so that we don't need privileged access # to the registry, and that will get reflected in HKCR when it is read, above. 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() if not self.get_option('disable_breakpad'): assert not self._crash_service, 'Already running a crash service' if self._crash_service_available is None: self._crash_service_available = self._check_crash_service_available( ) if not self._crash_service_available: return service = crash_service.CrashService( self, self._dump_reader.crash_dumps_directory()) service.start() self._crash_service = service def clean_up_test_run(self): super(WinPort, self).clean_up_test_run() if self._crash_service: self._crash_service.stop() self._crash_service = None def setup_environ_for_server(self): env = super(WinPort, self).setup_environ_for_server() # FIXME: This is a temporary hack to get the cr-win bot online until # someone from the cr-win port can take a look. apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP'] for key, value in self.host.environ.copy().items(): if key not in env and key in apache_envvars: env[key] = value # 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 # python executable to run cgi program. env["CYGWIN_PATH"] = self.path_from_chromium_base( "third_party", "cygwin", "bin") if self.get_option('register_cygwin'): setup_mount = self.path_from_chromium_base("third_party", "cygwin", "setup_mount.bat") self._executive.run_command([ setup_mount ]) # Paths are all absolute, so this does not require a cwd. return env def _modules_to_search_for_symbols(self): # FIXME: we should return the path to the ffmpeg equivalents to detect if we have the mp3 and aac codecs installed. # See https://bugs.webkit.org/show_bug.cgi?id=89706. return [] def check_build(self, needs_http, printer): result = super(WinPort, self).check_build(needs_http, printer) self._crash_service_available = self._check_crash_service_available() if not self._crash_service_available: result = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS if result: _log.error('For complete Windows build requirements, please see:') _log.error('') _log.error( ' http://dev.chromium.org/developers/how-tos/build-instructions-windows' ) return result def operating_system(self): return 'win' def relative_test_filename(self, filename): path = filename[len(self.layout_tests_dir()) + 1:] return path.replace('\\', '/') def uses_apache(self): val = self.get_option('use_apache') if val is None: return True return val def path_to_apache(self): return self.path_from_chromium_base('third_party', 'apache-win32', 'bin', 'httpd.exe') def path_to_apache_config_file(self): return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'win-httpd.conf') # # PROTECTED ROUTINES # def _path_to_driver(self, target=None): binary_name = '%s.exe' % self.driver_name() return self._build_path_with_target(target, binary_name) def _path_to_crash_service(self): binary_name = 'content_shell_crash_service.exe' return self._build_path(binary_name) def _path_to_image_diff(self): binary_name = 'image_diff.exe' return self._build_path(binary_name) def _path_to_wdiff(self): return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdiff.exe') def _check_crash_service_available(self): """Checks whether the crash service binary is present.""" result = self._check_file_exists(self._path_to_crash_service(), "content_shell_crash_service.exe") if not result: _log.error( " Could not find crash service, unexpected crashes won't be symbolized." ) _log.error(' Did you build the target blink_tests?') _log.error('') return result def look_for_new_crash_logs(self, crashed_processes, start_time): if self.get_option('disable_breakpad'): return None return self._dump_reader.look_for_new_crash_logs( crashed_processes, start_time) def clobber_old_port_specific_results(self): if not self.get_option('disable_breakpad'): self._dump_reader.clobber_old_results()
class WinPort(base.Port): port_name = 'win' SUPPORTED_VERSIONS = ('win7', 'win10') FALLBACK_PATHS = {'win10': ['win']} FALLBACK_PATHS['win7'] = ['win7'] + FALLBACK_PATHS['win10'] BUILD_REQUIREMENTS_URL = 'https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md' @classmethod def determine_full_port_name(cls, host, options, port_name): if port_name.endswith('win'): assert host.platform.is_win() # We don't maintain separate baselines for vista, so we pretend it is win7. if host.platform.os_version in ('vista', '7sp0', '7sp1'): version = 'win7' # Same for win8, we treat it as win10. elif host.platform.os_version in ('8', '8.1', '10', 'future'): version = 'win10' else: version = host.platform.os_version port_name = port_name + '-' + version return port_name def __init__(self, host, port_name, **kwargs): super(WinPort, self).__init__(host, port_name, **kwargs) self._version = port_name[port_name.index('win-') + len('win-'):] assert self._version in self.SUPPORTED_VERSIONS, '%s is not in %s' % ( self._version, self.SUPPORTED_VERSIONS) if self.get_option('disable_breakpad'): self._dump_reader = None else: self._dump_reader = DumpReaderWin(host, self._build_path()) def additional_driver_flags(self): flags = super(WinPort, self).additional_driver_flags() flags += ['--enable-direct-write'] if not self.get_option('disable_breakpad'): 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.uses_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 comments in check_httpd(), above, for why this routine exists and what it's doing. try: # Note that we HKCR is a union of HKLM and HKCR (with the latter # overriding the former), so reading from HKCR ensures that we get # the value if it is set in either place. See als comments below. 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 as error: # WindowsError is not defined on non-Windows platforms - pylint: disable=undefined-variable if error.errno != errno.ENOENT: raise # The key simply probably doesn't exist. # Note that we write to HKCU so that we don't need privileged access # to the registry, and that will get reflected in HKCR when it is read, above. 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_environ_for_server(self): # A few extra environment variables are required for Apache on Windows. env = super(WinPort, self).setup_environ_for_server() apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP'] for key, value in self.host.environ.copy().items(): if key not in env and key in apache_envvars: env[key] = value return env def check_build(self, needs_http, printer): result = super(WinPort, self).check_build(needs_http, printer) if result: _log.error('For complete Windows build requirements, please see:') _log.error('') _log.error( ' https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md' ) return result def operating_system(self): return 'win' def relative_test_filename(self, filename): path = filename[len(self.layout_tests_dir()) + 1:] return path.replace('\\', '/') def uses_apache(self): val = self.get_option('use_apache') if val is None: return True return val def path_to_apache(self): return self._path_from_chromium_base('third_party', 'apache-win32', 'bin', 'httpd.exe') def path_to_apache_config_file(self): return self._filesystem.join(self.apache_config_directory(), 'win-httpd.conf') # # PROTECTED ROUTINES # def _path_to_driver(self, target=None): binary_name = '%s.exe' % self.driver_name() return self._build_path_with_target(target, binary_name) def _path_to_image_diff(self): binary_name = 'image_diff.exe' return self._build_path(binary_name) def look_for_new_crash_logs(self, crashed_processes, start_time): if self.get_option('disable_breakpad'): return None return self._dump_reader.look_for_new_crash_logs( crashed_processes, start_time) def clobber_old_port_specific_results(self): if not self.get_option('disable_breakpad'): self._dump_reader.clobber_old_results()