<!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>[245544] 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/245544">245544</a></dd>
<dt>Author</dt> <dd>Hironori.Fujii@sony.com</dd>
<dt>Date</dt> <dd>2019-05-20 18:52:52 -0700 (Mon, 20 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>run-webkit-tests not gathering crash logs on Cygwin Python and Windows Python
https://bugs.webkit.org/show_bug.cgi?id=179828

Reviewed by Jonathan Bedard.

ServerProcess should store its Windows PID for Cygwin before
process crashing because the Windows PID is required to get a
correct CrashLog.

CrashLog format has been changed. CrashLogs.GLOBAL_PID_REGEX
should accept the new format.

* Scripts/webkitpy/common/system/crashlogs.py:
(CrashLogs.GLOBAL_PID_REGEX): Accept any words between 'Global' and 'PID:'.

* Scripts/webkitpy/port/driver.py:
(Driver.has_crashed):
(Driver._check_for_driver_crash_or_unresponsiveness):
(Driver._read_block):
Store server_process.system_pid() to self._crashed_pid instead of server_process.pid().

* Scripts/webkitpy/port/server_process.py:
(ServerProcess.__init__):
(ServerProcess.system_pid): Added.
(ServerProcess._find_system_pid): Added.
(ServerProcess._start): Set self._system_pid.
* Scripts/webkitpy/port/win.py:
(WinPort._get_crash_log): Removed broken old code converting Cygwin pid to Windows pid.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemcrashlogspy">trunk/Tools/Scripts/webkitpy/common/system/crashlogs.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="#trunkToolsScriptswebkitpyportserver_processpy">trunk/Tools/Scripts/webkitpy/port/server_process.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportwinpy">trunk/Tools/Scripts/webkitpy/port/win.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/ChangeLog       2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2019-05-20  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        run-webkit-tests not gathering crash logs on Cygwin Python and Windows Python
+        https://bugs.webkit.org/show_bug.cgi?id=179828
+
+        Reviewed by Jonathan Bedard.
+
+        ServerProcess should store its Windows PID for Cygwin before
+        process crashing because the Windows PID is required to get a
+        correct CrashLog.
+
+        CrashLog format has been changed. CrashLogs.GLOBAL_PID_REGEX
+        should accept the new format.
+
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        (CrashLogs.GLOBAL_PID_REGEX): Accept any words between 'Global' and 'PID:'.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver.has_crashed):
+        (Driver._check_for_driver_crash_or_unresponsiveness):
+        (Driver._read_block):
+        Store server_process.system_pid() to self._crashed_pid instead of server_process.pid().
+
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess.__init__):
+        (ServerProcess.system_pid): Added.
+        (ServerProcess._find_system_pid): Added.
+        (ServerProcess._start): Set self._system_pid.
+        * Scripts/webkitpy/port/win.py:
+        (WinPort._get_crash_log): Removed broken old code converting Cygwin pid to Windows pid.
+
</ins><span class="cx"> 2019-05-20  Aakash Jain  <aakash_jain@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Windows 10 test results missing on flakiness dashboard
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemcrashlogspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py  2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py     2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -37,7 +37,8 @@
</span><span class="cx"> 
</span><span class="cx"> class CrashLogs(object):
</span><span class="cx"> 
</span><del>-    GLOBAL_PID_REGEX = re.compile(r'\s+Global\s+PID:\s+\[(?P<pid>\d+)\]')
</del><ins>+    # Matches a string like '    Global    D1    PID: [14516]'
+    GLOBAL_PID_REGEX = re.compile(r'\s+Global\b.+\bPID:\s+\[(?P<pid>\d+)\]')
</ins><span class="cx">     EXIT_PROCESS_PID_REGEX = re.compile(r'Exit process \d+:(?P<pid>\w+), code')
</span><span class="cx">     DARWIN_PROCESS_REGEX = re.compile(r'^Process:\s+(?P<process_name>.*) \[(?P<pid>\d+)\]$')
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py      2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py 2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -387,7 +387,7 @@
</span><span class="cx">             return True
</span><span class="cx">         if self._server_process.has_crashed():
</span><span class="cx">             self._crashed_process_name = self._server_process.process_name()
</span><del>-            self._crashed_pid = self._server_process.pid()
</del><ins>+            self._crashed_pid = self._server_process.system_pid()
</ins><span class="cx">             return True
</span><span class="cx">         return False
</span><span class="cx"> 
</span><span class="lines">@@ -535,7 +535,7 @@
</span><span class="cx">         crashed_check = error_line.rstrip('\r\n')
</span><span class="cx">         if crashed_check == "#CRASHED":
</span><span class="cx">             self._crashed_process_name = self._server_process.process_name()
</span><del>-            self._crashed_pid = self._server_process.pid()
</del><ins>+            self._crashed_pid = self._server_process.system_pid()
</ins><span class="cx">             return True
</span><span class="cx">         elif error_line.startswith("#CRASHED - "):
</span><span class="cx">             match = re.match('#CRASHED - (\S+)', error_line)
</span><span class="lines">@@ -693,7 +693,7 @@
</span><span class="cx"> 
</span><span class="cx">         if asan_violation_detected and not self._crashed_process_name:
</span><span class="cx">             self._crashed_process_name = self._server_process.process_name()
</span><del>-            self._crashed_pid = self._server_process.pid()
</del><ins>+            self._crashed_pid = self._server_process.system_pid()
</ins><span class="cx"> 
</span><span class="cx">         block.decode_content()
</span><span class="cx">         return block
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriver_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver_unittest.py (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver_unittest.py     2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/Scripts/webkitpy/port/driver_unittest.py        2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -224,6 +224,9 @@
</span><span class="cx">             def pid(self):
</span><span class="cx">                 return 1234
</span><span class="cx"> 
</span><ins>+            def system_pid(self):
+                return self.pid()
+
</ins><span class="cx">             def process_name(self):
</span><span class="cx">                 return 'FakeServerProcess'
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportserver_processpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/server_process.py (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/server_process.py      2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/Scripts/webkitpy/port/server_process.py 2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx">         self._treat_no_data_as_crash = treat_no_data_as_crash
</span><span class="cx">         self._target_host = target_host or port_obj.host
</span><span class="cx">         self._pid = None
</span><ins>+        self._system_pid = None
</ins><span class="cx">         self._child_processes = {}
</span><span class="cx">         self._reset()
</span><span class="cx"> 
</span><span class="lines">@@ -93,6 +94,9 @@
</span><span class="cx">     def pid(self):
</span><span class="cx">         return self._pid
</span><span class="cx"> 
</span><ins>+    def system_pid(self):
+        return self._system_pid
+
</ins><span class="cx">     def _reset(self):
</span><span class="cx">         if getattr(self, '_proc', None):
</span><span class="cx">             if self._proc.stdin:
</span><span class="lines">@@ -130,6 +134,7 @@
</span><span class="cx">             env=self._env,
</span><span class="cx">             universal_newlines=self._universal_newlines)
</span><span class="cx">         self._pid = self._proc.pid
</span><ins>+        self._system_pid = int(self._port._filesystem.read_text_file('/proc/%d/winpid' % self._pid)) if self._port.host.platform.is_cygwin() else self._pid
</ins><span class="cx">         self._child_processes = {}
</span><span class="cx">         if not self._use_win32_apis:
</span><span class="cx">             self._set_file_nonblocking(self._proc.stdout)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/win.py (245543 => 245544)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/win.py 2019-05-21 01:36:11 UTC (rev 245543)
+++ trunk/Tools/Scripts/webkitpy/port/win.py    2019-05-21 01:52:52 UTC (rev 245544)
</span><span class="lines">@@ -425,11 +425,7 @@
</span><span class="cx">         _log.debug('looking for crash log for %s:%s' % (name, str(pid)))
</span><span class="cx">         deadline = now + 5 * int(self.get_option('child_processes', 1))
</span><span class="cx">         while not crash_log and now <= deadline:
</span><del>-            # If the system_pid hasn't been determined yet, just try with the passed in pid.  We'll be checking again later
-            system_pid = self._executive.pid_to_system_pid.get(pid)
-            if system_pid == None:
-                break  # We haven't mapped cygwin pid->win pid yet
-            crash_log = crash_logs.find_newest_log(name, system_pid, include_errors=True, newer_than=newer_than)
</del><ins>+            crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than)
</ins><span class="cx">             if not wait_for_log:
</span><span class="cx">                 break
</span><span class="cx">             if not crash_log or not [line for line in crash_log.splitlines() if line.startswith('quit:')]:
</span></span></pre>
</div>
</div>

</body>
</html>