OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 _log = logging.getLogger(__name__) | 47 _log = logging.getLogger(__name__) |
48 | 48 |
49 | 49 |
50 class WinPort(base.Port): | 50 class WinPort(base.Port): |
51 port_name = 'win' | 51 port_name = 'win' |
52 | 52 |
53 # FIXME: Figure out how to unify this with base.TestConfiguration.all_system
s()? | 53 # FIXME: Figure out how to unify this with base.TestConfiguration.all_system
s()? |
54 SUPPORTED_VERSIONS = ('xp', 'win7') | 54 SUPPORTED_VERSIONS = ('xp', 'win7') |
55 | 55 |
56 FALLBACK_PATHS = { 'win7': [ 'win' ]} | 56 FALLBACK_PATHS = {'win7': ['win']} |
57 FALLBACK_PATHS['xp'] = ['win-xp'] + FALLBACK_PATHS['win7'] | 57 FALLBACK_PATHS['xp'] = ['win-xp'] + FALLBACK_PATHS['win7'] |
58 | 58 |
59 DEFAULT_BUILD_DIRECTORIES = ('build', 'out') | 59 DEFAULT_BUILD_DIRECTORIES = ('build', 'out') |
60 | 60 |
61 BUILD_REQUIREMENTS_URL = 'http://www.chromium.org/developers/how-tos/build-i
nstructions-windows' | 61 BUILD_REQUIREMENTS_URL = 'http://www.chromium.org/developers/how-tos/build-i
nstructions-windows' |
62 | 62 |
63 @classmethod | 63 @classmethod |
64 def determine_full_port_name(cls, host, options, port_name): | 64 def determine_full_port_name(cls, host, options, port_name): |
65 if port_name.endswith('win'): | 65 if port_name.endswith('win'): |
66 assert host.platform.is_win() | 66 assert host.platform.is_win() |
67 # We don't maintain separate baselines for vista, so we pretend it i
s win7. | 67 # We don't maintain separate baselines for vista, so we pretend it i
s win7. |
68 if host.platform.os_version in ('vista', '7sp0', '7sp1', 'future'): | 68 if host.platform.os_version in ('vista', '7sp0', '7sp1', 'future'): |
69 version = 'win7' | 69 version = 'win7' |
70 else: | 70 else: |
71 version = host.platform.os_version | 71 version = host.platform.os_version |
72 port_name = port_name + '-' + version | 72 port_name = port_name + '-' + version |
73 return port_name | 73 return port_name |
74 | 74 |
75 def __init__(self, host, port_name, **kwargs): | 75 def __init__(self, host, port_name, **kwargs): |
76 super(WinPort, self).__init__(host, port_name, **kwargs) | 76 super(WinPort, self).__init__(host, port_name, **kwargs) |
77 self._version = port_name[port_name.index('win-') + len('win-'):] | 77 self._version = port_name[port_name.index('win-') + len('win-'):] |
78 assert self._version in self.SUPPORTED_VERSIONS, "%s is not in %s" % (se
lf._version, self.SUPPORTED_VERSIONS) | 78 assert self._version in self.SUPPORTED_VERSIONS, '%s is not in %s' % (se
lf._version, self.SUPPORTED_VERSIONS) |
79 if not self.get_option('disable_breakpad'): | 79 if not self.get_option('disable_breakpad'): |
80 self._dump_reader = DumpReaderWin(host, self._build_path()) | 80 self._dump_reader = DumpReaderWin(host, self._build_path()) |
81 self._crash_service = None | 81 self._crash_service = None |
82 self._crash_service_available = None | 82 self._crash_service_available = None |
83 | 83 |
84 def additional_drt_flag(self): | 84 def additional_drt_flag(self): |
85 flags = super(WinPort, self).additional_drt_flag() | 85 flags = super(WinPort, self).additional_drt_flag() |
86 flags += ['--enable-direct-write'] | 86 flags += ['--enable-direct-write'] |
87 if not self.get_option('disable_breakpad'): | 87 if not self.get_option('disable_breakpad'): |
88 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._
dump_reader.crash_dumps_directory()] | 88 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._
dump_reader.crash_dumps_directory()] |
89 return flags | 89 return flags |
90 | 90 |
91 def check_httpd(self): | 91 def check_httpd(self): |
92 res = super(WinPort, self).check_httpd() | 92 res = super(WinPort, self).check_httpd() |
93 if self.uses_apache(): | 93 if self.uses_apache(): |
94 # In order to run CGI scripts on Win32 that use unix shebang lines,
we need to | 94 # In order to run CGI scripts on Win32 that use unix shebang lines,
we need to |
95 # create entries in the registry that remap the extensions (.pl and
.cgi) to the | 95 # create entries in the registry that remap the extensions (.pl and
.cgi) to the |
96 # appropriate Win32 paths. The command line arguments must match the
command | 96 # appropriate Win32 paths. The command line arguments must match the
command |
97 # line arguments in the shebang line exactly. | 97 # line arguments in the shebang line exactly. |
98 if _winreg: | 98 if _winreg: |
99 res = self._check_reg(r'.cgi\Shell\ExecCGI\Command') and res | 99 res = self._check_reg(r'.cgi\Shell\ExecCGI\Command') and res |
100 res = self._check_reg(r'.pl\Shell\ExecCGI\Command') and res | 100 res = self._check_reg(r'.pl\Shell\ExecCGI\Command') and res |
101 else: | 101 else: |
102 _log.warning("Could not check the registry; http may not work co
rrectly.") | 102 _log.warning('Could not check the registry; http may not work co
rrectly.') |
103 | 103 |
104 return res | 104 return res |
105 | 105 |
106 def _check_reg(self, sub_key): | 106 def _check_reg(self, sub_key): |
107 # see comments in check_httpd(), above, for why this routine exists and
what it's doing. | 107 # see comments in check_httpd(), above, for why this routine exists and
what it's doing. |
108 try: | 108 try: |
109 # Note that we HKCR is a union of HKLM and HKCR (with the latter | 109 # Note that we HKCR is a union of HKLM and HKCR (with the latter |
110 # overridding the former), so reading from HKCR ensures that we get | 110 # overridding the former), so reading from HKCR ensures that we get |
111 # the value if it is set in either place. See als comments below. | 111 # the value if it is set in either place. See als comments below. |
112 hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key) | 112 hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, sub_key) |
113 args = _winreg.QueryValue(hkey, '').split() | 113 args = _winreg.QueryValue(hkey, '').split() |
114 _winreg.CloseKey(hkey) | 114 _winreg.CloseKey(hkey) |
115 | 115 |
116 # In order to keep multiple checkouts from stepping on each other, w
e simply check that an | 116 # In order to keep multiple checkouts from stepping on each other, w
e simply check that an |
117 # existing entry points to a valid path and has the right command li
ne. | 117 # existing entry points to a valid path and has the right command li
ne. |
118 if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].e
ndswith('perl.exe') and args[1] == '-wT': | 118 if len(args) == 2 and self._filesystem.exists(args[0]) and args[0].e
ndswith('perl.exe') and args[1] == '-wT': |
119 return True | 119 return True |
120 except WindowsError, e: | 120 except WindowsError as e: |
121 if e.errno != errno.ENOENT: | 121 if e.errno != errno.ENOENT: |
122 raise e | 122 raise e |
123 # The key simply probably doesn't exist. | 123 # The key simply probably doesn't exist. |
124 pass | 124 pass |
125 | 125 |
126 # Note that we write to HKCU so that we don't need privileged access | 126 # Note that we write to HKCU so that we don't need privileged access |
127 # to the registry, and that will get reflected in HKCR when it is read,
above. | 127 # to the registry, and that will get reflected in HKCR when it is read,
above. |
128 cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'b
in', 'perl.exe') + ' -wT' | 128 cmdline = self.path_from_chromium_base('third_party', 'perl', 'perl', 'b
in', 'perl.exe') + ' -wT' |
129 hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes
\\' + sub_key, 0, _winreg.KEY_WRITE) | 129 hkey = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, 'Software\\Classes
\\' + sub_key, 0, _winreg.KEY_WRITE) |
130 _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline) | 130 _winreg.SetValue(hkey, '', _winreg.REG_SZ, cmdline) |
131 _winreg.CloseKey(hkey) | 131 _winreg.CloseKey(hkey) |
132 return True | 132 return True |
133 | 133 |
134 def setup_test_run(self): | 134 def setup_test_run(self): |
135 super(WinPort, self).setup_test_run() | 135 super(WinPort, self).setup_test_run() |
136 | 136 |
137 if not self.get_option('disable_breakpad'): | 137 if not self.get_option('disable_breakpad'): |
138 assert not self._crash_service, 'Already running a crash service' | 138 assert not self._crash_service, 'Already running a crash service' |
139 if self._crash_service_available == None: | 139 if self._crash_service_available is None: |
140 self._crash_service_available = self._check_crash_service_availa
ble() | 140 self._crash_service_available = self._check_crash_service_availa
ble() |
141 if not self._crash_service_available: | 141 if not self._crash_service_available: |
142 return | 142 return |
143 service = crash_service.CrashService(self, self._dump_reader.crash_d
umps_directory()) | 143 service = crash_service.CrashService(self, self._dump_reader.crash_d
umps_directory()) |
144 service.start() | 144 service.start() |
145 self._crash_service = service | 145 self._crash_service = service |
146 | 146 |
147 def clean_up_test_run(self): | 147 def clean_up_test_run(self): |
148 super(WinPort, self).clean_up_test_run() | 148 super(WinPort, self).clean_up_test_run() |
149 | 149 |
150 if self._crash_service: | 150 if self._crash_service: |
151 self._crash_service.stop() | 151 self._crash_service.stop() |
152 self._crash_service = None | 152 self._crash_service = None |
153 | 153 |
154 def setup_environ_for_server(self, server_name=None): | 154 def setup_environ_for_server(self, server_name=None): |
155 env = super(WinPort, self).setup_environ_for_server(server_name) | 155 env = super(WinPort, self).setup_environ_for_server(server_name) |
156 | 156 |
157 # FIXME: This is a temporary hack to get the cr-win bot online until | 157 # FIXME: This is a temporary hack to get the cr-win bot online until |
158 # someone from the cr-win port can take a look. | 158 # someone from the cr-win port can take a look. |
159 apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP'] | 159 apache_envvars = ['SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'TMP'] |
160 for key, value in os.environ.items(): | 160 for key, value in os.environ.items(): |
161 if key not in env and key in apache_envvars: | 161 if key not in env and key in apache_envvars: |
162 env[key] = value | 162 env[key] = value |
163 | 163 |
164 # Put the cygwin directory first in the path to find cygwin1.dll. | 164 # Put the cygwin directory first in the path to find cygwin1.dll. |
165 env["PATH"] = "%s;%s" % (self.path_from_chromium_base("third_party", "cy
gwin", "bin"), env["PATH"]) | 165 env['PATH'] = '%s;%s' % (self.path_from_chromium_base('third_party', 'cy
gwin', 'bin'), env['PATH']) |
166 # Configure the cygwin directory so that pywebsocket finds proper | 166 # Configure the cygwin directory so that pywebsocket finds proper |
167 # python executable to run cgi program. | 167 # python executable to run cgi program. |
168 env["CYGWIN_PATH"] = self.path_from_chromium_base("third_party", "cygwin
", "bin") | 168 env['CYGWIN_PATH'] = self.path_from_chromium_base('third_party', 'cygwin
', 'bin') |
169 if self.get_option('register_cygwin'): | 169 if self.get_option('register_cygwin'): |
170 setup_mount = self.path_from_chromium_base("third_party", "cygwin",
"setup_mount.bat") | 170 setup_mount = self.path_from_chromium_base('third_party', 'cygwin',
'setup_mount.bat') |
171 self._executive.run_command([setup_mount]) # Paths are all absolute
, so this does not require a cwd. | 171 self._executive.run_command([setup_mount]) # Paths are all absolute
, so this does not require a cwd. |
172 return env | 172 return env |
173 | 173 |
174 def _modules_to_search_for_symbols(self): | 174 def _modules_to_search_for_symbols(self): |
175 # FIXME: we should return the path to the ffmpeg equivalents to detect i
f we have the mp3 and aac codecs installed. | 175 # FIXME: we should return the path to the ffmpeg equivalents to detect i
f we have the mp3 and aac codecs installed. |
176 # See https://bugs.webkit.org/show_bug.cgi?id=89706. | 176 # See https://bugs.webkit.org/show_bug.cgi?id=89706. |
177 return [] | 177 return [] |
178 | 178 |
179 def check_build(self, needs_http, printer): | 179 def check_build(self, needs_http, printer): |
180 result = super(WinPort, self).check_build(needs_http, printer) | 180 result = super(WinPort, self).check_build(needs_http, printer) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 def _path_to_image_diff(self): | 223 def _path_to_image_diff(self): |
224 binary_name = 'image_diff.exe' | 224 binary_name = 'image_diff.exe' |
225 return self._build_path(binary_name) | 225 return self._build_path(binary_name) |
226 | 226 |
227 def _path_to_wdiff(self): | 227 def _path_to_wdiff(self): |
228 return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdi
ff.exe') | 228 return self.path_from_chromium_base('third_party', 'cygwin', 'bin', 'wdi
ff.exe') |
229 | 229 |
230 def _check_crash_service_available(self): | 230 def _check_crash_service_available(self): |
231 """Checks whether the crash service binary is present.""" | 231 """Checks whether the crash service binary is present.""" |
232 result = self._check_file_exists(self._path_to_crash_service(), "content
_shell_crash_service.exe") | 232 result = self._check_file_exists(self._path_to_crash_service(), 'content
_shell_crash_service.exe') |
233 if not result: | 233 if not result: |
234 _log.error(" Could not find crash service, unexpected crashes won
't be symbolized.") | 234 _log.error(" Could not find crash service, unexpected crashes won
't be symbolized.") |
235 _log.error(' Did you build the target blink_tests?') | 235 _log.error(' Did you build the target blink_tests?') |
236 _log.error('') | 236 _log.error('') |
237 return result | 237 return result |
238 | 238 |
239 def look_for_new_crash_logs(self, crashed_processes, start_time): | 239 def look_for_new_crash_logs(self, crashed_processes, start_time): |
240 if self.get_option('disable_breakpad'): | 240 if self.get_option('disable_breakpad'): |
241 return None | 241 return None |
242 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star
t_time) | 242 return self._dump_reader.look_for_new_crash_logs(crashed_processes, star
t_time) |
243 | 243 |
244 def clobber_old_port_specific_results(self): | 244 def clobber_old_port_specific_results(self): |
245 if not self.get_option('disable_breakpad'): | 245 if not self.get_option('disable_breakpad'): |
246 self._dump_reader.clobber_old_results() | 246 self._dump_reader.clobber_old_results() |
OLD | NEW |