<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192944] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192944">192944</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-12-02 08:53:12 -0800 (Wed, 02 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Win] Run non-http tests without Cygwin
https://bugs.webkit.org/show_bug.cgi?id=151721

Reviewed by Andy Estes.

Support native 32-bit and 64-bit Python (and Perl) builds
for running tests:

1. Use &quot;startswith('win')&quot;, rather than &quot;== 'win32'&quot; to support
various Windows build types.
2. Supply full path for some native Windows utilities, since the
path environment does not always have the specified, and they are
guaranteed to exist in those specific locations.
3. Make sure native Windows Python test runs pass proper environment
variables to run programs.
4. Append 'exe' suffix when running Windows executables.
5. Use the _winreg Python module on Windows, since the Cygwin 'regtool'
command doesn't exist.
        
* Scripts/update-webkit: Use Perl $^X command to refer to the path of
the current Perl executable, rather than requiring a new path search.
* Scripts/webkitpy/common/find_files_unittest.py:
(TestWinNormalize.test_win): Use startswith('win').
* Scripts/webkitpy/common/prettypatch_unittest.py:
(test_pretty_diff_encodings): Ditto.
* Scripts/webkitpy/common/system/executive.py:
(Executive._should_close_fds): Ditto.
(Executive.shell_command_for_script): Use startswith('win').
(Executive.kill_process): Use full path to killall executable.
(Executive.check_running_pid): Use startswith('win').
(Executive.running_pids): Ditto.
(Executive.kill_all): Ditto. Also use path to 'killall' executable when
running under native Windows Python.
(Executive._child_process_encoding): Use startswith('win').
(Executive._should_encode_child_process_arguments): Ditto.
(Executive.popen): Recognize proper script engine on Windows, since it
does not support the shebang syntax.
(Executive.run_in_parallel): Use startswith('win').
* Scripts/webkitpy/common/system/executive_unittest.py:
(never_ending_command): Ditto.
(ExecutiveTest.test_run_command_with_unicode): Ditto.
(ExecutiveTest.serial_test_kill_process): Ditto.
(ExecutiveTest.serial_test_kill_all): Ditto.
(ExecutiveTest.serial_test_check_running_pid): Ditto.
(ExecutiveTest.serial_test_run_in_parallel): Ditto.
(main): Ditto.
* Scripts/webkitpy/common/system/file_lock.py:
(FileLock._create_lock): Ditto.
(FileLock._remove_lock): Ditto.
* Scripts/webkitpy/common/system/filesystem_unittest.py:
(RealFileSystemTest.test_chdir): Ditto.
(RealFileSystemTest.test_chdir__notexists): Ditto.
(RealFileSystemTest.test_maybe_make_directory__failure): Ditto.
* Scripts/webkitpy/common/system/path_unittest.py:
(AbspathTest.test_abspath_to_uri_win): Ditto.
* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._determine_os_name): Ditto.
* Scripts/webkitpy/common/system/user.py: Ditto.
* Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
(ManagerTest.integration_test_needs_servers): Ditto.
* Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
(LayoutTestApacheHttpd.__init__): Handle upper and lower-case
driver letters.
(LayoutTestApacheHttpd._get_apache_config_file_path): Ditto.
* Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py:
(TestLayoutTestApacheHttpd.test_start_cmd): Ditto.
* Scripts/webkitpy/layout_tests/servers/http_server_base.py:
(HttpServerBase._check_that_all_ports_are_available): Ditto.
* Scripts/webkitpy/layout_tests/servers/http_server_unittest.py:
(TestHttpServer.test_start_cmd): Ditto.
* Scripts/webkitpy/port/base.py:
(Port.to.setup_environ_for_server): Include 'COMSPEC', 'SYSTEMDRIVE',
and 'SYSTEMROOT' in environment passed to test runners.
(Port._apache_config_file_name_for_platform): Use startswith('win').
(Port._build_path): Ditto.
(Port._path_to_driver): Include 'exe' suffix when running under native
Windows.
* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver): Explicitly make some environment
variables strings.
* Scripts/webkitpy/port/server_process.py:
(ServerProcess.__init__): Use startswith('win').
* Scripts/webkitpy/port/win.py:
(WinPort): Use the win32 registry utilities on Windows, and appropriate
registry key formats.
(WinPort._ntsd_location): Revise tool search paths for Windows 10.
(WinPort.read_registry_value): Revise to use _winreg library on Windows,
and regtool on Cygwin.
(WinPort.write_registry_value): Ditto.
(WinPort.setup_crash_log_saving): Ditto.
(WinPort.restore_crash_log_saving): Ditto.
(WinPort.prevent_error_dialogs): Ditto.
(WinPort.allow_error_dialogs): Ditto.
(WinPort.find_system_pid): Revise to use Windows management
infrastructure on native Windows, continue using 'ps' on Cygwin.
(WinPort.read_registry_string): Deleted.
(WinPort.write_registry_string): Deleted.
* Scripts/webkitpy/test/main.py:
(main): Use startswith('win').
(Tester._parse_args): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsupdatewebkit">trunk/Tools/Scripts/update-webkit</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonfind_files_unittestpy">trunk/Tools/Scripts/webkitpy/common/find_files_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonprettypatch_unittestpy">trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemexecutivepy">trunk/Tools/Scripts/webkitpy/common/system/executive.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemexecutive_unittestpy">trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemfile_lockpy">trunk/Tools/Scripts/webkitpy/common/system/file_lock.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemfilesystem_unittestpy">trunk/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystempath_unittestpy">trunk/Tools/Scripts/webkitpy/common/system/path_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemplatforminfopy">trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemuserpy">trunk/Tools/Scripts/webkitpy/common/system/user.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollersmanager_unittestpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsserversapache_http_serverpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsserversapache_http_server_unittestpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsservershttp_server_basepy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsservershttp_server_unittestpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportbasepy">trunk/Tools/Scripts/webkitpy/port/base.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriver_unittestpy">trunk/Tools/Scripts/webkitpy/port/driver_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportlinux_get_crash_log_unittestpy">trunk/Tools/Scripts/webkitpy/port/linux_get_crash_log_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportport_testcasepy">trunk/Tools/Scripts/webkitpy/port/port_testcase.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportserver_processpy">trunk/Tools/Scripts/webkitpy/port/server_process.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportserver_process_unittestpy">trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportwinpy">trunk/Tools/Scripts/webkitpy/port/win.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytestmainpy">trunk/Tools/Scripts/webkitpy/test/main.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/ChangeLog        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -1,3 +1,106 @@
</span><ins>+2015-12-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [Win] Run non-http tests without Cygwin
+        https://bugs.webkit.org/show_bug.cgi?id=151721
+
+        Reviewed by Andy Estes.
+
+        Support native 32-bit and 64-bit Python (and Perl) builds
+        for running tests:
+
+        1. Use &quot;startswith('win')&quot;, rather than &quot;== 'win32'&quot; to support
+        various Windows build types.
+        2. Supply full path for some native Windows utilities, since the
+        path environment does not always have the specified, and they are
+        guaranteed to exist in those specific locations.
+        3. Make sure native Windows Python test runs pass proper environment
+        variables to run programs.
+        4. Append 'exe' suffix when running Windows executables.
+        5. Use the _winreg Python module on Windows, since the Cygwin 'regtool'
+        command doesn't exist.
+        
+        * Scripts/update-webkit: Use Perl $^X command to refer to the path of
+        the current Perl executable, rather than requiring a new path search.
+        * Scripts/webkitpy/common/find_files_unittest.py:
+        (TestWinNormalize.test_win): Use startswith('win').
+        * Scripts/webkitpy/common/prettypatch_unittest.py:
+        (test_pretty_diff_encodings): Ditto.
+        * Scripts/webkitpy/common/system/executive.py:
+        (Executive._should_close_fds): Ditto.
+        (Executive.shell_command_for_script): Use startswith('win').
+        (Executive.kill_process): Use full path to killall executable.
+        (Executive.check_running_pid): Use startswith('win').
+        (Executive.running_pids): Ditto.
+        (Executive.kill_all): Ditto. Also use path to 'killall' executable when
+        running under native Windows Python.
+        (Executive._child_process_encoding): Use startswith('win').
+        (Executive._should_encode_child_process_arguments): Ditto.
+        (Executive.popen): Recognize proper script engine on Windows, since it
+        does not support the shebang syntax.
+        (Executive.run_in_parallel): Use startswith('win').
+        * Scripts/webkitpy/common/system/executive_unittest.py:
+        (never_ending_command): Ditto.
+        (ExecutiveTest.test_run_command_with_unicode): Ditto.
+        (ExecutiveTest.serial_test_kill_process): Ditto.
+        (ExecutiveTest.serial_test_kill_all): Ditto.
+        (ExecutiveTest.serial_test_check_running_pid): Ditto.
+        (ExecutiveTest.serial_test_run_in_parallel): Ditto.
+        (main): Ditto.
+        * Scripts/webkitpy/common/system/file_lock.py:
+        (FileLock._create_lock): Ditto.
+        (FileLock._remove_lock): Ditto.
+        * Scripts/webkitpy/common/system/filesystem_unittest.py:
+        (RealFileSystemTest.test_chdir): Ditto.
+        (RealFileSystemTest.test_chdir__notexists): Ditto.
+        (RealFileSystemTest.test_maybe_make_directory__failure): Ditto.
+        * Scripts/webkitpy/common/system/path_unittest.py:
+        (AbspathTest.test_abspath_to_uri_win): Ditto.
+        * Scripts/webkitpy/common/system/platforminfo.py:
+        (PlatformInfo._determine_os_name): Ditto.
+        * Scripts/webkitpy/common/system/user.py: Ditto.
+        * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+        (ManagerTest.integration_test_needs_servers): Ditto.
+        * Scripts/webkitpy/layout_tests/servers/apache_http_server.py:
+        (LayoutTestApacheHttpd.__init__): Handle upper and lower-case
+        driver letters.
+        (LayoutTestApacheHttpd._get_apache_config_file_path): Ditto.
+        * Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py:
+        (TestLayoutTestApacheHttpd.test_start_cmd): Ditto.
+        * Scripts/webkitpy/layout_tests/servers/http_server_base.py:
+        (HttpServerBase._check_that_all_ports_are_available): Ditto.
+        * Scripts/webkitpy/layout_tests/servers/http_server_unittest.py:
+        (TestHttpServer.test_start_cmd): Ditto.
+        * Scripts/webkitpy/port/base.py:
+        (Port.to.setup_environ_for_server): Include 'COMSPEC', 'SYSTEMDRIVE',
+        and 'SYSTEMROOT' in environment passed to test runners.
+        (Port._apache_config_file_name_for_platform): Use startswith('win').
+        (Port._build_path): Ditto.
+        (Port._path_to_driver): Include 'exe' suffix when running under native
+        Windows.
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._setup_environ_for_driver): Explicitly make some environment
+        variables strings.
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess.__init__): Use startswith('win').
+        * Scripts/webkitpy/port/win.py:
+        (WinPort): Use the win32 registry utilities on Windows, and appropriate
+        registry key formats.
+        (WinPort._ntsd_location): Revise tool search paths for Windows 10.
+        (WinPort.read_registry_value): Revise to use _winreg library on Windows,
+        and regtool on Cygwin.
+        (WinPort.write_registry_value): Ditto.
+        (WinPort.setup_crash_log_saving): Ditto.
+        (WinPort.restore_crash_log_saving): Ditto.
+        (WinPort.prevent_error_dialogs): Ditto.
+        (WinPort.allow_error_dialogs): Ditto.
+        (WinPort.find_system_pid): Revise to use Windows management
+        infrastructure on native Windows, continue using 'ps' on Cygwin.
+        (WinPort.read_registry_string): Deleted.
+        (WinPort.write_registry_string): Deleted.
+        * Scripts/webkitpy/test/main.py:
+        (main): Use startswith('win').
+        (Tester._parse_args): Ditto.
+
</ins><span class="cx"> 2015-12-01  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Implement LLInt/Baseline Support for ES6 Generators and enable this feature
</span></span></pre></div>
<a id="trunkToolsScriptsupdatewebkit"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/update-webkit (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/update-webkit        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/update-webkit        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -76,10 +76,10 @@
</span><span class="cx"> runGitUpdate() if isGit();
</span><span class="cx"> 
</span><span class="cx"> if (isAppleWinWebKit() &amp;&amp; $auxiliaryLibs) {
</span><del>-    system(&quot;perl&quot;, &quot;Tools/Scripts/update-webkit-auxiliary-libs&quot;) == 0 or die;
</del><ins>+    system($^X, File::Spec-&gt;catfile(&quot;Tools&quot;, &quot;Scripts&quot;, &quot;update-webkit-auxiliary-libs&quot;)) == 0 or die;
</ins><span class="cx">     if (isWinCairo()) {
</span><span class="cx">         # WinCairo shares the auxiliary libs from the Apple port.
</span><del>-        system(&quot;perl&quot;, &quot;Tools/Scripts/update-webkit-wincairo-libs&quot;) == 0 or die;
</del><ins>+        system($^X, File::Spec-&gt;catfile(&quot;Tools&quot;, &quot;Scripts&quot;, &quot;update-webkit-wincairo-libs&quot;)) == 0 or die;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonfind_files_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/find_files_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/find_files_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/find_files_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -56,6 +56,6 @@
</span><span class="cx">     def test_win(self):
</span><span class="cx">         # This tests the actual windows platform, to ensure we get the same
</span><span class="cx">         # results that we get in test_mocked_win().
</span><del>-        if sys.platform != 'win32':
</del><ins>+        if not sys.platform.startswith('win'):
</ins><span class="cx">             return
</span><span class="cx">         self.assert_filesystem_normalizes(FileSystem())
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonprettypatch_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">         if not self.check_ruby():
</span><span class="cx">             return
</span><span class="cx"> 
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             # FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192
</span><span class="cx">             return
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemexecutivepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/executive.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/executive.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">         # multiple threads). See http://bugs.python.org/issue2320 .
</span><span class="cx">         # Note that close_fds isn't supported on Windows, but this bug only
</span><span class="cx">         # shows up on Mac and Linux.
</span><del>-        return sys.platform not in ('win32', 'cygwin')
</del><ins>+        return not (sys.platform == 'cygwin' or sys.platform.startswith('win'))
</ins><span class="cx"> 
</span><span class="cx">     def _run_command_with_teed_output(self, args, teed_output, **kwargs):
</span><span class="cx">         child_process = self.popen(args,
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">     def shell_command_for_script(script_path, fs=None):
</span><span class="cx">         fs = fs or FileSystem()
</span><span class="cx">         # Win32 does not support shebang. We need to detect the interpreter ourself.
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             interpreter = Executive.interpreter_for_script(script_path, fs)
</span><span class="cx">             if interpreter:
</span><span class="cx">                 return [interpreter, script_path]
</span><span class="lines">@@ -183,11 +183,12 @@
</span><span class="cx">     def kill_process(self, pid):
</span><span class="cx">         &quot;&quot;&quot;Attempts to kill the given pid.
</span><span class="cx">         Will fail silently if pid does not exist or insufficient permisssions.&quot;&quot;&quot;
</span><del>-        if sys.platform == &quot;win32&quot;:
</del><ins>+        if sys.platform.startswith('win32'):
</ins><span class="cx">             # We only use taskkill.exe on windows (not cygwin) because subprocess.pid
</span><span class="cx">             # is a CYGWIN pid and taskkill.exe expects a windows pid.
</span><span class="cx">             # Thankfully os.kill on CYGWIN handles either pid type.
</span><del>-            command = [&quot;taskkill.exe&quot;, &quot;/f&quot;, &quot;/t&quot;, &quot;/pid&quot;, pid]
</del><ins>+            task_kill_executable = os.path.join('C:', os.sep, 'WINDOWS', 'system32', 'taskkill.exe')
+            command = [task_kill_executable, &quot;/f&quot;, &quot;/t&quot;, &quot;/pid&quot;, pid]
</ins><span class="cx">             # taskkill will exit 128 if the process is not found.  We should log.
</span><span class="cx">             self.run_command(command, error_handler=self.ignore_error)
</span><span class="cx">             return
</span><span class="lines">@@ -264,7 +265,7 @@
</span><span class="cx"> 
</span><span class="cx">     def check_running_pid(self, pid):
</span><span class="cx">         &quot;&quot;&quot;Return True if pid is alive, otherwise return False.&quot;&quot;&quot;
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             return self._win32_check_running_pid(pid)
</span><span class="cx"> 
</span><span class="cx">         try:
</span><span class="lines">@@ -274,7 +275,7 @@
</span><span class="cx">             return False
</span><span class="cx"> 
</span><span class="cx">     def running_pids(self, process_name_filter=None):
</span><del>-        if sys.platform == &quot;win32&quot;:
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             # FIXME: running_pids isn't implemented on native Windows yet...
</span><span class="cx">             return []
</span><span class="cx"> 
</span><span class="lines">@@ -349,9 +350,12 @@
</span><span class="cx">     def kill_all(self, process_name):
</span><span class="cx">         &quot;&quot;&quot;Attempts to kill processes matching process_name.
</span><span class="cx">         Will fail silently if no process are found.&quot;&quot;&quot;
</span><del>-        if sys.platform in (&quot;win32&quot;, &quot;cygwin&quot;):
</del><ins>+        if sys.platform == 'cygwin' or sys.platform.startswith('win'):
</ins><span class="cx">             image_name = self._windows_image_name(process_name)
</span><del>-            command = [&quot;taskkill.exe&quot;, &quot;/f&quot;, &quot;/im&quot;, image_name]
</del><ins>+            killCommmand = 'taskkill.exe'
+            if sys.platform.startswith('win'):
+                killCommand = os.path.join('C:', os.sep, 'WINDOWS', 'system32', 'taskkill.exe')
+            command = [killCommmand, &quot;/f&quot;, &quot;/im&quot;, image_name]
</ins><span class="cx">             # taskkill will exit 128 if the process is not found.  We should log.
</span><span class="cx">             self.run_command(command, error_handler=self.ignore_error)
</span><span class="cx">             return
</span><span class="lines">@@ -460,7 +464,7 @@
</span><span class="cx">         # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW
</span><span class="cx">         # to launch subprocesses, so we have to encode arguments using the
</span><span class="cx">         # current code page.
</span><del>-        if sys.platform == 'win32' and sys.version &lt; '3':
</del><ins>+        if sys.platform.startswith('win') and sys.version &lt; '3':
</ins><span class="cx">             return 'mbcs'
</span><span class="cx">         # All other platforms use UTF-8.
</span><span class="cx">         # FIXME: Using UTF-8 on Cygwin will confuse Windows-native commands
</span><span class="lines">@@ -477,7 +481,7 @@
</span><span class="cx">         # Win32 Python 2.x uses CreateProcessA rather than CreateProcessW
</span><span class="cx">         # to launch subprocesses, so we have to encode arguments using the
</span><span class="cx">         # current code page.
</span><del>-        if sys.platform == 'win32' and sys.version &lt; '3':
</del><ins>+        if sys.platform.startswith('win') and sys.version &lt; '3':
</ins><span class="cx">             return True
</span><span class="cx"> 
</span><span class="cx">         return False
</span><span class="lines">@@ -493,8 +497,27 @@
</span><span class="cx">         # The Windows implementation of Popen cannot handle unicode strings. :(
</span><span class="cx">         return map(self._encode_argument_if_needed, string_args)
</span><span class="cx"> 
</span><del>-    # The only required arugment to popen is named &quot;args&quot;, the rest are optional keyword arguments.
</del><ins>+    def _needs_interpreter_check(self, argument):
+        return not argument.endswith(('perl', 'python', 'ruby', 'taskkill.exe', 'git', 'svn'))
+
+    # The only required argument to popen is named &quot;args&quot;, the rest are optional keyword arguments.
</ins><span class="cx">     def popen(self, args, **kwargs):
</span><ins>+        if sys.platform.startswith('win'):
+            _log.debug(&quot;Looking at {0}&quot;.format(args))
+            # Must include proper interpreter
+            if self._needs_interpreter_check(args[0]):
+                try:
+                    with open(args[0], 'r') as f:
+                        line = f.readline()
+                        if &quot;perl&quot; in line:
+                            args.insert(0, &quot;perl&quot;)
+                        elif &quot;python&quot; in line:
+                            args.insert(0, &quot;python&quot;)
+                        elif &quot;ruby&quot; in line:
+                            args.insert(0, &quot;ruby&quot;)
+                except IOError:
+                    pass
+
</ins><span class="cx">         # FIXME: We should always be stringifying the args, but callers who pass shell=True
</span><span class="cx">         # expect that the exact bytes passed will get passed to the shell (even if they're wrongly encoded).
</span><span class="cx">         # shell=True is wrong for many other reasons, and we should remove this
</span><span class="lines">@@ -509,7 +532,7 @@
</span><span class="cx">         &quot;&quot;&quot;Runs a list of (cmd_line list, cwd string) tuples in parallel and returns a list of (retcode, stdout, stderr) tuples.&quot;&quot;&quot;
</span><span class="cx">         assert len(command_lines_and_cwds)
</span><span class="cx"> 
</span><del>-        if sys.platform in ('cygwin', 'win32'):
</del><ins>+        if sys.platform == 'cygwin' or sys.platform.startswith('win'):
</ins><span class="cx">             return map(_run_command_thunk, command_lines_and_cwds)
</span><span class="cx">         pool = multiprocessing.Pool(processes=processes)
</span><span class="cx">         results = pool.map(_run_command_thunk, command_lines_and_cwds)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemexecutive_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">     &quot;&quot;&quot;Arguments for a command that will never end (useful for testing process
</span><span class="cx">     killing). It should be a process that is unlikely to already be running
</span><span class="cx">     because all instances will be killed.&quot;&quot;&quot;
</span><del>-    if sys.platform == 'win32':
</del><ins>+    if sys.platform.startswith('win'):
</ins><span class="cx">         return ['wmic']
</span><span class="cx">     return ['yes']
</span><span class="cx"> 
</span><span class="lines">@@ -130,14 +130,14 @@
</span><span class="cx">         to Executive.run* methods, and they will return unicode()
</span><span class="cx">         objects by default unless decode_output=False&quot;&quot;&quot;
</span><span class="cx">         unicode_tor_input = u&quot;WebKit \u2661 Tor Arne Vestb\u00F8!&quot;
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             encoding = 'mbcs'
</span><span class="cx">         else:
</span><span class="cx">             encoding = 'utf-8'
</span><span class="cx">         encoded_tor = unicode_tor_input.encode(encoding)
</span><span class="cx">         # On Windows, we expect the unicode-&gt;mbcs-&gt;unicode roundtrip to be
</span><span class="cx">         # lossy. On other platforms, we expect a lossless roundtrip.
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             unicode_tor_output = encoded_tor.decode(encoding)
</span><span class="cx">         else:
</span><span class="cx">             unicode_tor_output = unicode_tor_input
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx">         self.assertEqual(process.poll(), None)  # Process is running
</span><span class="cx">         executive.kill_process(process.pid)
</span><span class="cx">         # Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == &quot;win32&quot;
</span><del>-        if sys.platform == &quot;win32&quot;:
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
</span><span class="cx">             # We seem to get either 0 or 1 here for some reason.
</span><span class="cx">             self.assertIn(process.wait(), (0, 1))
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">         if sys.platform == &quot;cygwin&quot;:
</span><span class="cx">             expected_exit_code = 0  # os.kill results in exit(0) for this process.
</span><span class="cx">             self.assertEqual(process.wait(), expected_exit_code)
</span><del>-        elif sys.platform == &quot;win32&quot;:
</del><ins>+        elif sys.platform.startswith('win'):
</ins><span class="cx">             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
</span><span class="cx">             # We seem to get either 0 or 1 here for some reason.
</span><span class="cx">             self.assertIn(process.wait(), (0, 1))
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx">         self.assertFalse(executive.check_running_pid(100000))
</span><span class="cx"> 
</span><span class="cx">     def serial_test_running_pids(self):
</span><del>-        if sys.platform in (&quot;win32&quot;, &quot;cygwin&quot;):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == &quot;cygwin&quot;:
</ins><span class="cx">             return  # This function isn't implemented on Windows yet.
</span><span class="cx"> 
</span><span class="cx">         executive = Executive()
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     def serial_test_run_in_parallel(self):
</span><span class="cx">         # We run this test serially to avoid overloading the machine and throwing off the timing.
</span><span class="cx"> 
</span><del>-        if sys.platform in (&quot;win32&quot;, &quot;cygwin&quot;):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == &quot;cygwin&quot;:
</ins><span class="cx">             return  # This function isn't implemented properly on windows yet.
</span><span class="cx">         import multiprocessing
</span><span class="cx"> 
</span><span class="lines">@@ -257,7 +257,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> def main(platform, stdin, stdout, cmd, args):
</span><del>-    if platform == 'win32' and hasattr(stdout, 'fileno'):
</del><ins>+    if sys.platform.startswith('win') and hasattr(stdout, 'fileno'):
</ins><span class="cx">         import msvcrt
</span><span class="cx">         msvcrt.setmode(stdout.fileno(), os.O_BINARY)
</span><span class="cx">     if cmd == '--cat':
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemfile_lockpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/file_lock.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/file_lock.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/file_lock.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">         self._max_wait_time_sec = max_wait_time_sec
</span><span class="cx"> 
</span><span class="cx">     def _create_lock(self):
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             import msvcrt
</span><span class="cx">             msvcrt.locking(self._lock_file_descriptor, msvcrt.LK_NBLCK, 32)
</span><span class="cx">         else:
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">             fcntl.flock(self._lock_file_descriptor, fcntl.LOCK_EX | fcntl.LOCK_NB)
</span><span class="cx"> 
</span><span class="cx">     def _remove_lock(self):
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             import msvcrt
</span><span class="cx">             msvcrt.locking(self._lock_file_descriptor, msvcrt.LK_UNLCK, 32)
</span><span class="cx">         else:
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemfilesystem_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">         fs = FileSystem()
</span><span class="cx">         cwd = fs.getcwd()
</span><span class="cx">         newdir = '/'
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             newdir = 'c:\\'
</span><span class="cx">         fs.chdir(newdir)
</span><span class="cx">         self.assertEqual(fs.getcwd(), newdir)
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     def test_chdir__notexists(self):
</span><span class="cx">         fs = FileSystem()
</span><span class="cx">         newdir = '/dirdoesnotexist'
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             newdir = 'c:\\dirdoesnotexist'
</span><span class="cx">         self.assertRaises(OSError, fs.chdir, newdir)
</span><span class="cx"> 
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">     def test_maybe_make_directory__failure(self):
</span><span class="cx">         # FIXME: os.chmod() doesn't work on Windows to set directories
</span><span class="cx">         # as readonly, so we skip this test for now.
</span><del>-        if sys.platform in ('win32', 'cygwin'):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == 'cygwin':
</ins><span class="cx">             return
</span><span class="cx"> 
</span><span class="cx">         fs = FileSystem()
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystempath_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/path_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/path_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/path_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">                           'file:///foo/bar.html')
</span><span class="cx"> 
</span><span class="cx">     def test_abspath_to_uri_win(self):
</span><del>-        if sys.platform != 'win32':
</del><ins>+        if not sys.platform.startswith('win'):
</ins><span class="cx">             return
</span><span class="cx">         self.assertEqual(path.abspath_to_uri(self.platforminfo(), 'c:\\foo\\bar.html'),
</span><span class="cx">                          'file:///c:/foo/bar.html')
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemplatforminfopy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx">             return 'mac'
</span><span class="cx">         if sys_platform.startswith('linux'):
</span><span class="cx">             return 'linux'
</span><del>-        if sys_platform in ('win32', 'cygwin'):
</del><ins>+        if sys_platform.startswith('win') or sys_platform == 'cygwin':
</ins><span class="cx">             return 'win'
</span><span class="cx">         if sys_platform.startswith('freebsd'):
</span><span class="cx">             return 'freebsd'
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemuserpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/user.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/user.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/common/system/user.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> try:
</span><span class="cx">     import readline
</span><span class="cx"> except ImportError:
</span><del>-    if sys.platform != &quot;win32&quot;:
</del><ins>+    if not sys.platform.startswith('win32'):
</ins><span class="cx">         # There is no readline module for win32, not much to do except cry.
</span><span class="cx">         _log.warn(&quot;Unable to import readline.&quot;)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollersmanager_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">         manager = get_manager()
</span><span class="cx">         self.assertTrue(manager.needs_servers(['http/tests/mime']))
</span><span class="cx"> 
</span><del>-        if sys.platform == 'win32':
</del><ins>+        if sys.platform.startswith('win'):
</ins><span class="cx">             manager = get_manager()
</span><span class="cx">             self.assertFalse(manager.needs_servers(['fast\\html']))
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsserversapache_http_serverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">         if port_obj.host.platform.is_win():
</span><span class="cx">             # Convert to MSDOS file naming:
</span><span class="cx">             precompiledBuildbot = re.compile('^/home/buildbot')
</span><del>-            precompiledDrive = re.compile('^/cygdrive/c')
</del><ins>+            precompiledDrive = re.compile('^/cygdrive/[cC]')
</ins><span class="cx">             output_dir = precompiledBuildbot.sub(&quot;C:/cygwin/home/buildbot&quot;, output_dir)
</span><span class="cx">             output_dir = precompiledDrive.sub(&quot;C:&quot;, output_dir)
</span><span class="cx">             test_dir = precompiledBuildbot.sub(&quot;C:/cygwin/home/buildbot&quot;, test_dir)
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx"> 
</span><span class="cx">         if self._port_obj.host.platform.is_win():
</span><span class="cx">             # Convert to MSDOS file naming:
</span><del>-            precompiledDrive = re.compile('^/cygdrive/c')
</del><ins>+            precompiledDrive = re.compile('^/cygdrive/[cC]')
</ins><span class="cx">             httpd_config_copy = precompiledDrive.sub(&quot;C:&quot;, httpd_config_copy)
</span><span class="cx">             precompiledBuildbot = re.compile('^/home/buildbot')
</span><span class="cx">             httpd_config_copy = precompiledBuildbot.sub(&quot;C:/cygwin/home/buildbot&quot;, httpd_config_copy)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsserversapache_http_server_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> class TestLayoutTestApacheHttpd(unittest.TestCase):
</span><span class="cx">     def test_start_cmd(self):
</span><span class="cx">         # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726
</span><del>-        if sys.platform in ('cygwin', 'win32'):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == 'cygwin':
</ins><span class="cx">             return
</span><span class="cx"> 
</span><span class="cx">         def fake_pid(_):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsservershttp_server_basepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -208,7 +208,7 @@
</span><span class="cx">             except IOError, e:
</span><span class="cx">                 if e.errno in (errno.EALREADY, errno.EADDRINUSE):
</span><span class="cx">                     raise ServerError('Port %d is already in use.' % port)
</span><del>-                elif sys.platform == 'win32' and e.errno in (errno.WSAEACCES,):  # pylint: disable=E1101
</del><ins>+                elif sys.platform.startswith('win') and e.errno in (errno.WSAEACCES,):  # pylint: disable=E1101
</ins><span class="cx">                     raise ServerError('Port %d is already in use.' % port)
</span><span class="cx">                 else:
</span><span class="cx">                     raise
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsservershttp_server_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> class TestHttpServer(unittest.TestCase):
</span><span class="cx">     def test_start_cmd(self):
</span><span class="cx">         # Fails on win - see https://bugs.webkit.org/show_bug.cgi?id=84726
</span><del>-        if sys.platform in ('cygwin', 'win32'):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == 'cygwin':
</ins><span class="cx">             return
</span><span class="cx"> 
</span><span class="cx">         host = MockHost()
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportbasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/base.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/base.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/base.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -834,7 +834,10 @@
</span><span class="cx">             '_NT_SYMBOL_PATH',
</span><span class="cx"> 
</span><span class="cx">             # Windows:
</span><ins>+            'COMSPEC',
</ins><span class="cx">             'PATH',
</span><ins>+            'SYSTEMDRIVE',
+            'SYSTEMROOT',
</ins><span class="cx"> 
</span><span class="cx">             # Most ports (?):
</span><span class="cx">             'WEBKIT_TESTFONTS',
</span><span class="lines">@@ -1104,7 +1107,7 @@
</span><span class="cx"> 
</span><span class="cx">     # We pass sys_platform into this method to make it easy to unit test.
</span><span class="cx">     def _apache_config_file_name_for_platform(self, sys_platform):
</span><del>-        if sys_platform == 'cygwin' or sys_platform == 'win32':
</del><ins>+        if sys_platform == 'cygwin' or sys_platform.startswith('win'):
</ins><span class="cx">             return 'apache' + self._apache_version() + '-httpd-win.conf'
</span><span class="cx">         if sys_platform.startswith('linux'):
</span><span class="cx">             if self._is_redhat_based():
</span><span class="lines">@@ -1150,14 +1153,18 @@
</span><span class="cx">             # the options list.
</span><span class="cx">             self.set_option('_cached_root', root_directory)
</span><span class="cx"> 
</span><del>-        if sys.platform in ('cygwin', 'win32'):
</del><ins>+        if sys.platform.startswith('win') or sys.platform == 'cygwin':
</ins><span class="cx">             return self._filesystem.join(root_directory, *comps)
</span><span class="cx"> 
</span><span class="cx">         return self._filesystem.join(self._filesystem.abspath(root_directory), *comps)
</span><span class="cx"> 
</span><span class="cx">     def _path_to_driver(self, configuration=None):
</span><span class="cx">         &quot;&quot;&quot;Returns the full path to the test driver (DumpRenderTree).&quot;&quot;&quot;
</span><del>-        return self._build_path(self.driver_name())
</del><ins>+        local_driver_path = self._build_path(self.driver_name())
+        if sys.platform.startswith('win'):
+            base = os.path.splitext(local_driver_path)[0]
+            local_driver_path = base + &quot;.exe&quot;
+        return local_driver_path
</ins><span class="cx"> 
</span><span class="cx">     def _driver_tempdir(self):
</span><span class="cx">         return self._filesystem.mkdtemp(prefix='%s-' % self.driver_name())
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -312,15 +312,15 @@
</span><span class="cx">             self._run_post_start_tasks()
</span><span class="cx"> 
</span><span class="cx">     def _setup_environ_for_driver(self, environment):
</span><del>-        environment['DYLD_LIBRARY_PATH'] = self._port._build_path()
-        environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
</del><ins>+        environment['DYLD_LIBRARY_PATH'] = str(self._port._build_path())
+        environment['DYLD_FRAMEWORK_PATH'] = str(self._port._build_path())
</ins><span class="cx">         # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as
</span><span class="cx">         # CoreMedia disk cache is in the temp directory).
</span><span class="cx">         environment['TMPDIR'] = str(self._driver_tempdir)
</span><del>-        environment['DIRHELPER_USER_DIR_SUFFIX'] = os.path.basename(str(self._driver_tempdir))
</del><ins>+        environment['DIRHELPER_USER_DIR_SUFFIX'] = str(os.path.basename(str(self._driver_tempdir)))
</ins><span class="cx">         # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage).
</span><span class="cx">         environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
</span><del>-        environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
</del><ins>+        environment['LOCAL_RESOURCE_ROOT'] = str(self._port.layout_tests_dir())
</ins><span class="cx">         environment['ASAN_OPTIONS'] = &quot;allocator_may_return_null=1&quot;
</span><span class="cx">         if 'WEBKIT_OUTPUTDIR' in os.environ:
</span><span class="cx">             environment['WEBKIT_OUTPUTDIR'] = os.environ['WEBKIT_OUTPUTDIR']
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriver_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/driver_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.tool.mocktool import MockOptions
</span><span class="cx"> 
</span><ins>+import sys
</ins><span class="cx"> 
</span><span class="cx"> class DriverOutputTest(unittest.TestCase):
</span><span class="cx">     def test_strip_metrics(self):
</span><span class="lines">@@ -178,7 +179,10 @@
</span><span class="cx">         port = TestWebKitPort()
</span><span class="cx">         port._config.build_directory = lambda configuration: '/mock-build'
</span><span class="cx">         driver = Driver(port, 0, pixel_tests=True, no_timeout=True)
</span><del>-        self.assertEqual(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree', '--no-timeout', '-'])
</del><ins>+        if sys.platform.startswith('win'):
+            self.assertEqual(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree.exe', '--no-timeout', '-'])
+        else:
+            self.assertEqual(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree', '--no-timeout', '-'])
</ins><span class="cx"> 
</span><span class="cx">     def test_check_for_driver_crash(self):
</span><span class="cx">         port = TestWebKitPort()
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportlinux_get_crash_log_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/linux_get_crash_log_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/linux_get_crash_log_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/linux_get_crash_log_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><span class="cx"> import os
</span><ins>+import sys
</ins><span class="cx"> import unittest
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
</span><span class="lines">@@ -37,6 +38,9 @@
</span><span class="cx"> class GDBCrashLogGeneratorTest(unittest.TestCase):
</span><span class="cx"> 
</span><span class="cx">     def test_generate_crash_log(self):
</span><ins>+        if sys.platform.startswith('win'):
+            return
+
</ins><span class="cx">         generator = GDBCrashLogGenerator('DumpRenderTree', 28529, newer_than=None, filesystem=MockFileSystem({'/path/to/coredumps': ''}), path_to_driver=None)
</span><span class="cx"> 
</span><span class="cx">         core_directory = os.environ.get('WEBKIT_CORE_DUMPS_DIRECTORY', '/path/to/coredumps')
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportport_testcasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/port_testcase.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/port_testcase.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/port_testcase.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -475,7 +475,10 @@
</span><span class="cx">     def test_root_option(self):
</span><span class="cx">         port = TestWebKitPort()
</span><span class="cx">         port._options = MockOptions(root='/foo')
</span><del>-        self.assertEqual(port._path_to_driver(), &quot;/foo/DumpRenderTree&quot;)
</del><ins>+        if sys.platform.startswith('win'):
+            self.assertEqual(port._path_to_driver(), &quot;/foo/DumpRenderTree.exe&quot;)
+        else:
+            self.assertEqual(port._path_to_driver(), &quot;/foo/DumpRenderTree&quot;)
</ins><span class="cx"> 
</span><span class="cx">     def test_test_expectations(self):
</span><span class="cx">         # Check that we read the expectations file
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportserver_processpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/server_process.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/server_process.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/server_process.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> # Note that although win32 python does provide an implementation of
</span><span class="cx"> # the win32 select API, it only works on sockets, and not on the named pipes
</span><span class="cx"> # used by subprocess, so we have to use the native APIs directly.
</span><del>-if sys.platform == 'win32':
</del><ins>+if sys.platform.startswith('win'):
</ins><span class="cx">     import msvcrt
</span><span class="cx">     import win32pipe
</span><span class="cx">     import win32file
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">         # See comment in imports for why we need the win32 APIs and can't just use select.
</span><span class="cx">         # FIXME: there should be a way to get win32 vs. cygwin from platforminfo.
</span><del>-        self._use_win32_apis = sys.platform == 'win32'
</del><ins>+        self._use_win32_apis = sys.platform.startswith('win')
</ins><span class="cx"> 
</span><span class="cx">     def name(self):
</span><span class="cx">         return self._name
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportserver_process_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -108,7 +108,10 @@
</span><span class="cx">         proc = server_process.ServerProcess(port, 'python', cmd)
</span><span class="cx">         proc.write('')
</span><span class="cx"> 
</span><del>-        self.assertEqual(proc.poll(), None)
</del><ins>+        if sys.platform.startswith('win'):
+            self.assertEqual(proc.poll(), 0)
+        else:
+            self.assertEqual(proc.poll(), None)
</ins><span class="cx">         self.assertFalse(proc.has_crashed())
</span><span class="cx"> 
</span><span class="cx">         # check that doing a read after an expired deadline returns
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/win.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/win.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/port/win.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -44,6 +44,12 @@
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+try:
+    import _winreg
+    import win32com.client
+except ImportError:
+    _log.warn(&quot;Not running on native Windows.&quot;)
+
</ins><span class="cx"> class WinPort(ApplePort):
</span><span class="cx">     port_name = &quot;win&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -53,13 +59,30 @@
</span><span class="cx"> 
</span><span class="cx">     CRASH_LOG_PREFIX = &quot;CrashLog&quot;
</span><span class="cx"> 
</span><del>-    POST_MORTEM_DEBUGGER_KEY = &quot;/%s/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/%s&quot;
</del><ins>+    if sys.platform.startswith('win'):
+        POST_MORTEM_DEBUGGER_KEY = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug'
+        WOW64_POST_MORTEM_DEBUGGER_KEY = r'SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug'
+        WINDOWS_ERROR_REPORTING_KEY = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting'
+        WOW64_WINDOWS_ERROR_REPORTING_KEY = r'SOFTWARE\Wow6432Node\Microsoft\Windows\Windows Error Reporting'
+        _HKLM = _winreg.HKEY_LOCAL_MACHINE
+        _HKCU = _winreg.HKEY_CURRENT_USER
+        _REG_DWORD = _winreg.REG_DWORD
+        _REG_SZ = _winreg.REG_SZ
+    else:
+        POST_MORTEM_DEBUGGER_KEY = &quot;/%s/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug/%s&quot;
+        WOW64_POST_MORTEM_DEBUGGER_KEY = &quot;/%s/SOFTWARE/Wow6432Node/Microsoft/Windows NT/CurrentVersion/AeDebug/%s&quot;
+        WINDOWS_ERROR_REPORTING_KEY = &quot;/%s/SOFTWARE/Microsoft/Windows/Windows Error Reporting/%s&quot;
+        WOW64_WINDOWS_ERROR_REPORTING_KEY = &quot;/%s/SOFTWARE/Wow6432Node/Microsoft/Windows/Windows Error Reporting/%s&quot;
+        _HKLM = &quot;HKLM&quot;
+        _HKCU = &quot;HKCU&quot;
+        _REG_DWORD = &quot;-d&quot;
+        _REG_SZ = &quot;-s&quot;
</ins><span class="cx"> 
</span><del>-    WINDOWS_ERROR_REPORTING_KEY = &quot;/%s/SOFTWARE/Microsoft/Windows/Windows Error Reporting/%s&quot;
-
</del><span class="cx">     previous_debugger_values = {}
</span><ins>+    previous_wow64_debugger_values = {}
</ins><span class="cx"> 
</span><span class="cx">     previous_error_reporting_values = {}
</span><ins>+    previous_wow64_error_reporting_values = {}
</ins><span class="cx"> 
</span><span class="cx">     def do_text_results_differ(self, expected_text, actual_text):
</span><span class="cx">         # Sanity was restored in WK2, so we don't need this hack there.
</span><span class="lines">@@ -163,20 +186,25 @@
</span><span class="cx">     def _ntsd_location(self):
</span><span class="cx">         if 'PROGRAMFILES' not in os.environ:
</span><span class="cx">             return None
</span><ins>+        possible_paths = [self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;10&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;),
+            self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.1&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;),
+            self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;)]
</ins><span class="cx">         if self.get_option('architecture') == 'x86_64':
</span><del>-            possible_paths = [self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;10&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;),
-                self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.1&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;),
-                self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;)]
</del><ins>+            possible_paths.append(self._filesystem.join(&quot;{0} (x86)&quot;.format(os.environ['PROGRAMFILES']), &quot;Windows Kits&quot;, &quot;10&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
+            possible_paths.append(self._filesystem.join(&quot;{0} (x86)&quot;.format(os.environ['PROGRAMFILES']), &quot;Windows Kits&quot;, &quot;8.1&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
+            possible_paths.append(self._filesystem.join(&quot;{0} (x86)&quot;.format(os.environ['PROGRAMFILES']), &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
+            possible_paths.append(self._filesystem.join(&quot;{0} (x86)&quot;.format(os.environ['PROGRAMFILES']), &quot;Debugging Tools for Windows (x64)&quot;, &quot;ntsd.exe&quot;))
</ins><span class="cx">         else:
</span><del>-            possible_paths = [self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;10&quot;, &quot;Debuggers&quot;, &quot;x86&quot;, &quot;ntsd.exe&quot;),
-                self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.1&quot;, &quot;Debuggers&quot;, &quot;x86&quot;, &quot;ntsd.exe&quot;),
-                self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x86&quot;, &quot;ntsd.exe&quot;),
-                self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Debugging Tools for Windows (x86)&quot;, &quot;ntsd.exe&quot;)]
</del><ins>+            possible_paths.append(self._filesystem.join(os.environ['PROGRAMFILES'], &quot;Debugging Tools for Windows (x86)&quot;, &quot;ntsd.exe&quot;))
</ins><span class="cx">         possible_paths.append(self._filesystem.join(os.environ['SYSTEMROOT'], &quot;system32&quot;, &quot;ntsd.exe&quot;))
</span><span class="cx">         if 'ProgramW6432' in os.environ:
</span><ins>+            possible_paths.append(self._filesystem.join(os.environ['ProgramW6432'], &quot;Windows Kits&quot;, &quot;10&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
+            possible_paths.append(self._filesystem.join(os.environ['ProgramW6432'], &quot;Windows Kits&quot;, &quot;8.1&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
+            possible_paths.append(self._filesystem.join(os.environ['ProgramW6432'], &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;))
</ins><span class="cx">             possible_paths.append(self._filesystem.join(os.environ['ProgramW6432'], &quot;Debugging Tools for Windows (x64)&quot;, &quot;ntsd.exe&quot;))
</span><span class="cx">         for path in possible_paths:
</span><span class="cx">             expanded_path = self._filesystem.expanduser(path)
</span><ins>+            _log.debug(&quot;Considering '%s'&quot; % expanded_path)
</ins><span class="cx">             if self._filesystem.exists(expanded_path):
</span><span class="cx">                 _log.debug(&quot;Using ntsd located in '%s'&quot; % path)
</span><span class="cx">                 return expanded_path
</span><span class="lines">@@ -193,42 +221,79 @@
</span><span class="cx">         self._filesystem.write_text_file(command_file, commands)
</span><span class="cx">         return command_file
</span><span class="cx"> 
</span><del>-    def read_registry_string(self, reg_path, arch, root, key):
-        registry_key = reg_path % (root, key)
-        read_registry_command = [&quot;regtool&quot;, arch, &quot;get&quot;, registry_key]
-        value = self._executive.run_command(read_registry_command, error_handler=Executive.ignore_error)
-        return value.rstrip()
</del><ins>+    def read_registry_value(self, reg_path, arch, root, key):
+        if sys.platform.startswith('win'):
+            _log.debug(&quot;Trying to read %s\\%s&quot; % (reg_path, key))
+            try:
+                registry_key = _winreg.OpenKey(root, reg_path)
+                value = _winreg.QueryValueEx(registry_key, key)
+                _winreg.CloseKey(registry_key)
+            except WindowsError as ex:
+                _log.debug(&quot;Unable to read %s\\%s: %s&quot; % (reg_path, key, str(ex)))
+                return ['', self._REG_SZ]
+        else:
+            registry_key = reg_path % (root, key)
+            _log.debug(&quot;Reading %s&quot; % (registry_key))
+            read_registry_command = [&quot;regtool&quot;, arch, &quot;get&quot;, registry_key]
+            int_value = self._executive.run_command(read_registry_command, error_handler=Executive.ignore_error)
+            # regtool doesn't return the type of the entry, so need this ugly hack:
+            if reg_path in (self.WINDOWS_ERROR_REPORTING_KEY, self.WOW64_WINDOWS_ERROR_REPORTING_KEY):
+                _log.debug(&quot;I got {0}&quot;.format(int_value))
+                try:
+                    value = [int(int_value), self._REG_DWORD]
+                except:
+                    value = [0, self._REG_DWORD]
+            else:
+                value = [int_value.rstrip(), self._REG_SZ]
</ins><span class="cx"> 
</span><ins>+        _log.debug(&quot;I got back ({0}) of type ({1})&quot;.format(value[0], value[1]))
+        return value
+
</ins><span class="cx">     def write_registry_value(self, reg_path, arch, root, key, regType, value):
</span><del>-        registry_key = reg_path % (root, key)
</del><ins>+        if sys.platform.startswith('win'):
+            _log.debug(&quot;Trying to write %s\\%s = %s&quot; % (reg_path, key, value))
+            try:
+                registry_key = _winreg.OpenKey(root, reg_path, 0, _winreg.KEY_WRITE)
+            except WindowsError:
+                try:
+                    _log.debug(&quot;Key doesn't exist -- must create it.&quot;)
+                    registry_key = _winreg.CreateKeyEx(root, reg_path, 0, _winreg.KEY_WRITE)
+                except WindowsError as ex:
+                    _log.error(&quot;Error setting (%s) %s\key: %s to value: %s.  Error=%s.&quot; % (arch, root, key, value, str(ex)))
+                    _log.error(&quot;You many need to adjust permissions on the %s\\%s key.&quot; % (reg_path, key))
+                    return False
</ins><span class="cx"> 
</span><del>-        _log.debug(&quot;Writing to %s&quot; % registry_key)
</del><ins>+            _log.debug(&quot;Writing {0} of type {1} to {2}\\{3}&quot;.format(value, regType, registry_key, key))
+            _winreg.SetValueEx(registry_key, key, 0, regType, value)
+            _winreg.CloseKey(registry_key)
+        else:
+            registry_key = reg_path % (root, key)
+            _log.debug(&quot;Writing to %s&quot; % registry_key)
</ins><span class="cx"> 
</span><del>-        set_reg_value_command = [&quot;regtool&quot;, arch, &quot;set&quot;, regType, str(registry_key), str(value)]
-        rc = self._executive.run_command(set_reg_value_command, return_exit_code=True)
-        if rc == 2:
-            add_reg_value_command = [&quot;regtool&quot;, arch, &quot;add&quot;, regType, str(registry_key)]
-            rc = self._executive.run_command(add_reg_value_command, return_exit_code=True)
-            if rc == 0:
-                rc = self._executive.run_command(set_reg_value_command, return_exit_code=True)
-        if rc:
-            _log.warn(&quot;Error setting (%s) %s\key: %s to value: %s.  Error=%s.&quot; % (arch, root, key, value, str(rc)))
-            _log.warn(&quot;You many need to adjust permissions on the %s key.&quot; % registry_key)
-            return False
</del><ins>+            set_reg_value_command = [&quot;regtool&quot;, arch, &quot;set&quot;, regType, str(registry_key), str(value)]
+            rc = self._executive.run_command(set_reg_value_command, return_exit_code=True)
+            if rc == 2:
+                add_reg_value_command = [&quot;regtool&quot;, arch, &quot;add&quot;, regType, str(registry_key)]
+                rc = self._executive.run_command(add_reg_value_command, return_exit_code=True)
+                if rc == 0:
+                    rc = self._executive.run_command(set_reg_value_command, return_exit_code=True)
+            if rc:
+                _log.warn(&quot;Error setting (%s) %s\key: %s to value: %s.  Error=%s.&quot; % (arch, root, key, value, str(rc)))
+                _log.warn(&quot;You many need to adjust permissions on the %s key.&quot; % registry_key)
+                return False
</ins><span class="cx"> 
</span><span class="cx">         # On Windows Vista/7 with UAC enabled, regtool will fail to modify the registry, but will still
</span><span class="cx">         # return a successful exit code. So we double-check here that the value we tried to write to the
</span><span class="cx">         # registry was really written.
</span><del>-        if self.read_registry_string(reg_path, arch, root, key) != str(value):
-            _log.warn(&quot;Regtool reported success, but value of key %s did not change.&quot; % key)
-            _log.warn(&quot;You many need to adjust permissions on the %s key.&quot; % registry_key)
</del><ins>+        check_value = self.read_registry_value(reg_path, arch, root, key)
+        if check_value[0] != value or check_value[1] != regType:
+            _log.warn(&quot;Reg update reported success, but value of key %s did not change.&quot; % key)
+            _log.warn(&quot;Wanted to set it to ({0}, {1}), but got {2})&quot;.format(value, regType, check_value))
+            _log.warn(&quot;You many need to adjust permissions on the %s\\%s key.&quot; % (reg_path, key))
</ins><span class="cx">             return False
</span><span class="cx"> 
</span><span class="cx">         return True
</span><span class="cx"> 
</span><del>-    def write_registry_string(self, reg_path, arch, root, key, value):
-        return self.write_registry_value(reg_path, arch, root, key, &quot;-s&quot;, value)
-
</del><span class="cx">     def setup_crash_log_saving(self):
</span><span class="cx">         if '_NT_SYMBOL_PATH' not in os.environ:
</span><span class="cx">             _log.warning(&quot;The _NT_SYMBOL_PATH environment variable is not set. Using Microsoft Symbol Server.&quot;)
</span><span class="lines">@@ -246,27 +311,35 @@
</span><span class="cx">         if not command_file:
</span><span class="cx">             return None
</span><span class="cx">         debugger_options = '&quot;{0}&quot; -p %ld -e %ld -g -noio -lines -cf &quot;{1}&quot;'.format(cygpath(ntsd_path), cygpath(command_file))
</span><del>-        registry_settings = {'Debugger': debugger_options, 'Auto': &quot;1&quot;}
-        for key in registry_settings:
</del><ins>+        registry_settings = {'Debugger': [debugger_options, self._REG_SZ], 'Auto': [&quot;1&quot;, self._REG_SZ]}
+        for key, value in registry_settings.iteritems():
</ins><span class="cx">             for arch in [&quot;--wow32&quot;, &quot;--wow64&quot;]:
</span><del>-                self.previous_debugger_values[(arch, &quot;HKLM&quot;, key)] = self.read_registry_string(self.POST_MORTEM_DEBUGGER_KEY, arch, &quot;HKLM&quot;, key)
-                self.write_registry_string(self.POST_MORTEM_DEBUGGER_KEY, arch, &quot;HKLM&quot;, key, registry_settings[key])
</del><ins>+                self.previous_debugger_values[(arch, self._HKLM, key)] = self.read_registry_value(self.POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key)
+                self.previous_wow64_debugger_values[(arch, self._HKLM, key)] = self.read_registry_value(self.WOW64_POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key)
+                self.write_registry_value(self.POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key, value[1], value[0])
+                self.write_registry_value(self.WOW64_POST_MORTEM_DEBUGGER_KEY, arch, self._HKLM, key, value[1], value[0])
</ins><span class="cx"> 
</span><span class="cx">     def restore_crash_log_saving(self):
</span><del>-        for key in self.previous_debugger_values:
-            self.write_registry_string(self.POST_MORTEM_DEBUGGER_KEY, key[0], key[1], key[2], self.previous_debugger_values[key])
</del><ins>+        for key, value in self.previous_debugger_values.iteritems():
+            self.write_registry_value(self.POST_MORTEM_DEBUGGER_KEY, key[0], key[1], key[2], value[1], value[0])
+        for key, value in self.previous_wow64_debugger_values.iteritems():
+            self.write_registry_value(self.WOW64_POST_MORTEM_DEBUGGER_KEY, key[0], key[1], key[2], value[1], value[0])
</ins><span class="cx"> 
</span><span class="cx">     def prevent_error_dialogs(self):
</span><del>-        registry_settings = {'DontShowUI': 1, 'Disabled': 1}
-        for key in registry_settings:
-            for root in [&quot;HKLM&quot;, &quot;HKCU&quot;]:
</del><ins>+        registry_settings = {'DontShowUI': [1, self._REG_DWORD], 'Disabled': [1, self._REG_DWORD]}
+        for key, value in registry_settings.iteritems():
+            for root in [self._HKLM, self._HKCU]:
</ins><span class="cx">                 for arch in [&quot;--wow32&quot;, &quot;--wow64&quot;]:
</span><del>-                    self.previous_error_reporting_values[(arch, root, key)] = self.read_registry_string(self.WINDOWS_ERROR_REPORTING_KEY, arch, root, key)
-                    self.write_registry_value(self.WINDOWS_ERROR_REPORTING_KEY, arch, root, key, &quot;-d&quot;, registry_settings[key])
</del><ins>+                    self.previous_error_reporting_values[(arch, root, key)] = self.read_registry_value(self.WINDOWS_ERROR_REPORTING_KEY, arch, root, key)
+                    self.previous_wow64_error_reporting_values[(arch, root, key)] = self.read_registry_value(self.WOW64_WINDOWS_ERROR_REPORTING_KEY, arch, root, key)
+                    self.write_registry_value(self.WINDOWS_ERROR_REPORTING_KEY, arch, root, key, value[1], value[0])
+                    self.write_registry_value(self.WOW64_WINDOWS_ERROR_REPORTING_KEY, arch, root, key, value[1], value[0])
</ins><span class="cx"> 
</span><span class="cx">     def allow_error_dialogs(self):
</span><del>-        for key in self.previous_error_reporting_values:
-            self.write_registry_value(self.WINDOWS_ERROR_REPORTING_KEY, key[0], key[1], key[2], &quot;-d&quot;, self.previous_error_reporting_values[key])
</del><ins>+        for key, value in self.previous_error_reporting_values.iteritems():
+            self.write_registry_value(self.WINDOWS_ERROR_REPORTING_KEY, key[0], key[1], key[2], value[1], value[0])
+        for key, value in self.previous_wow64_error_reporting_values.iteritems():
+            self.write_registry_value(self.WOW64_WINDOWS_ERROR_REPORTING_KEY, key[0], key[1], key[2], value[1], value[0])
</ins><span class="cx"> 
</span><span class="cx">     def delete_sem_locks(self):
</span><span class="cx">         os.system(&quot;rm -rf /dev/shm/sem.*&quot;)
</span><span class="lines">@@ -331,22 +404,34 @@
</span><span class="cx"> 
</span><span class="cx">     def find_system_pid(self, name, pid):
</span><span class="cx">         system_pid = int(pid)
</span><del>-        # Windows and Cygwin PIDs are not the same.  We need to find the Windows
-        # PID for our Cygwin process so we can match it later to any crash
-        # files we end up creating (which will be tagged with the Windows PID)
-        ps_process = self._executive.run_command(['ps', '-e'], error_handler=Executive.ignore_error)
-        for line in ps_process.splitlines():
-            tokens = line.strip().split()
-            try:
-                cpid, ppid, pgid, winpid, tty, uid, stime, process_name = tokens
-                if process_name.endswith(name):
-                    self._executive.pid_to_system_pid[int(cpid)] = int(winpid)
-                    if int(pid) == int(cpid):
-                        system_pid = int(winpid)
-                    break
-            except ValueError, e:
-                pass
</del><span class="cx"> 
</span><ins>+        if sys.platform == &quot;cygwin&quot;:
+            # Windows and Cygwin PIDs are not the same.  We need to find the Windows
+            # PID for our Cygwin process so we can match it later to any crash
+            # files we end up creating (which will be tagged with the Windows PID)
+            ps_process = self._executive.run_command(['ps', '-e'], error_handler=Executive.ignore_error)
+            for line in ps_process.splitlines():
+                tokens = line.strip().split()
+                try:
+                    cpid, ppid, pgid, winpid, tty, uid, stime, process_name = tokens
+                    if process_name.endswith(name):
+                        self._executive.pid_to_system_pid[int(cpid)] = int(winpid)
+                        if int(pid) == int(cpid):
+                            system_pid = int(winpid)
+                        break
+                except ValueError, e:
+                    pass
+        else:
+            wmi = win32com.client.GetObject('winmgmts:')
+            _log.debug('Querying WMI with &quot;%{0}%&quot;'.format(name))
+            procs = wmi.ExecQuery('Select * from win32_process where name like &quot;%{0}%&quot;'.format(name))
+            for proc in procs:
+                self._executive.pid_to_system_pid[int(proc.ProcessId)] = int(proc.ProcessId)
+                _log.debug(&quot;I see {0}: {1}&quot;.format(proc.Name, proc.ProcessId))
+                if int(pid) == int(proc.ProcessId):
+                    system_pid = int(proc.ProcessId)
+                break
+
</ins><span class="cx">         return system_pid
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytestmainpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/test/main.py (192943 => 192944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/test/main.py        2015-12-02 12:08:36 UTC (rev 192943)
+++ trunk/Tools/Scripts/webkitpy/test/main.py        2015-12-02 16:53:12 UTC (rev 192944)
</span><span class="lines">@@ -52,11 +52,11 @@
</span><span class="cx">     tester.add_tree(os.path.join(webkit_root, 'Tools', 'Scripts'), 'webkitpy')
</span><span class="cx"> 
</span><span class="cx">     # There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it.
</span><del>-    if not sys.platform in ('cygwin', 'win32'):
</del><ins>+    if not (sys.platform.startswith('win') or sys.platform == 'cygwin'):
</ins><span class="cx">         tester.add_tree(os.path.join(webkit_root, 'Source', 'WebKit2', 'Scripts'), 'webkit2')
</span><span class="cx"> 
</span><span class="cx">     tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818)
</span><del>-    if sys.platform == 'win32':
</del><ins>+    if sys.platform.startswith('win'):
</ins><span class="cx">         tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526)
</span><span class="cx"> 
</span><span class="cx">     # This only needs to run on Unix, so don't worry about win32 for now.
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">                           help='generate code coverage info (requires http://pypi.python.org/pypi/coverage)')
</span><span class="cx">         parser.add_option('-i', '--integration-tests', action='store_true', default=False,
</span><span class="cx">                           help='run integration tests as well as unit tests'),
</span><del>-        parser.add_option('-j', '--child-processes', action='store', type='int', default=(1 if sys.platform == 'win32' else multiprocessing.cpu_count()),
</del><ins>+        parser.add_option('-j', '--child-processes', action='store', type='int', default=(1 if sys.platform.startswith('win') else multiprocessing.cpu_count()),
</ins><span class="cx">                           help='number of tests to run in parallel (default=%default)')
</span><span class="cx">         parser.add_option('-p', '--pass-through', action='store_true', default=False,
</span><span class="cx">                           help='be debugger friendly by passing captured output through to the system')
</span></span></pre>
</div>
</div>

</body>
</html>