<!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>[245824] 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/245824">245824</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2019-05-28 14:04:44 -0700 (Tue, 28 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>webkitpy: Switch run-webkit-tests to tailspin
https://bugs.webkit.org/show_bug.cgi?id=198144
<rdar://problem/32463212>

Patch by David Xiong <w_xiong@apple.com> on 2019-05-28
Reviewed by Jonathan Bedard.

Changes run-webkit-tests to run tailspin on test time out
rather than spindump, and edited tests to look for tailspin logs
instead.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.sample_process): Replaced spindump with tailspin (+ symbolication)
(DarwinPort):
(DarwinPort.tailspin_file_path):
(DarwinTest.spindump_file_path): Deleted.
* Scripts/webkitpy/port/darwin_testcase.py:
(DarwinTest.test_tailspin): Changed spindump test (below) to test for tailspin instead
(DarwinTest.test_spindump): Deleted.
(DarwinTest.test_spindump.logging_run_command): Deleted.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_tailspin): Changed spindump tests (inc. below) to test for tailspin instead
(IOSDeviceTest.test_sample_process.logging_run_command):
(IOSDeviceTest.test_sample_process_exception.throwing_run_command):
(IOSDeviceTest.test_spindump): Deleted.
(IOSDeviceTest.test_spindump.logging_run_command): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdarwinpy">trunk/Tools/Scripts/webkitpy/port/darwin.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdarwin_testcasepy">trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportios_device_unittestpy">trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (245823 => 245824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-05-28 21:02:38 UTC (rev 245823)
+++ trunk/Tools/ChangeLog       2019-05-28 21:04:44 UTC (rev 245824)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2019-05-28  David Xiong  <w_xiong@apple.com>
</span><span class="cx"> 
</span><ins>+        webkitpy: Switch run-webkit-tests to tailspin
+        https://bugs.webkit.org/show_bug.cgi?id=198144
+        <rdar://problem/32463212>
+
+        Reviewed by Jonathan Bedard.
+
+        Changes run-webkit-tests to run tailspin on test time out
+        rather than spindump, and edited tests to look for tailspin logs
+        instead.
+
+        * Scripts/webkitpy/port/darwin.py:
+        (DarwinPort.sample_process): Replaced spindump with tailspin (+ symbolication)
+        (DarwinPort):
+        (DarwinPort.tailspin_file_path):
+        (DarwinTest.spindump_file_path): Deleted.
+        * Scripts/webkitpy/port/darwin_testcase.py:
+        (DarwinTest.test_tailspin): Changed spindump test (below) to test for tailspin instead
+        (DarwinTest.test_spindump): Deleted.
+        (DarwinTest.test_spindump.logging_run_command): Deleted.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest.test_tailspin): Changed spindump tests (inc. below) to test for tailspin instead
+        (IOSDeviceTest.test_sample_process.logging_run_command):
+        (IOSDeviceTest.test_sample_process_exception.throwing_run_command):
+        (IOSDeviceTest.test_spindump): Deleted.
+        (IOSDeviceTest.test_spindump.logging_run_command): Deleted.
+
+2019-05-28  David Xiong  <w_xiong@apple.com>
+
</ins><span class="cx">         webkitpy: Using sudo on iOS device during timeout spindumps 
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=198142
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdarwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/darwin.py (245823 => 245824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/darwin.py      2019-05-28 21:02:38 UTC (rev 245823)
+++ trunk/Tools/Scripts/webkitpy/port/darwin.py 2019-05-28 21:04:44 UTC (rev 245824)
</span><span class="lines">@@ -160,20 +160,33 @@
</span><span class="cx">     def sample_process(self, name, pid, target_host=None):
</span><span class="cx">         host = target_host or self.host
</span><span class="cx">         tempdir = host.filesystem.mkdtemp()
</span><ins>+        temp_tailspin_file_path = host.filesystem.join(str(tempdir), "{0}-{1}-tailspin-temp.txt".format(name, pid))
</ins><span class="cx">         command = [
</span><del>-            '/usr/sbin/spindump',
-            pid,
-            10,
-            10,
-            '-file',
-            DarwinPort.spindump_file_path(host, name, pid, str(tempdir)),
</del><ins>+            '/usr/bin/tailspin',
+            'save',
+            '-n',
+            temp_tailspin_file_path,
</ins><span class="cx">         ]
</span><span class="cx">         if host.platform.is_mac():
</span><span class="cx">             command = ['/usr/bin/sudo', '-n'] + command
</span><ins>+
</ins><span class="cx">         exit_status = host.executive.run_command(command, return_exit_code=True)
</span><del>-        if exit_status:
</del><ins>+        if not exit_status:  # Symbolicate tailspin log using spindump
</ins><span class="cx">             try:
</span><span class="cx">                 host.executive.run_command([
</span><ins>+                    '/usr/sbin/spindump',
+                    '-i',
+                    temp_tailspin_file_path,
+                    '-file',
+                    DarwinPort.tailspin_file_path(host, name, pid, str(tempdir)),
+                ])
+                host.filesystem.move_to_base_host(DarwinPort.tailspin_file_path(host, name, pid, str(tempdir)),
+                                                  DarwinPort.tailspin_file_path(self.host, name, pid, self.results_directory()))
+            except IOError as e:
+                _log.warning('Unable to symbolicate tailspin log of process:' + str(e))
+        else:  # Tailspin failed, run sample instead
+            try:
+                host.executive.run_command([
</ins><span class="cx">                     '/usr/bin/sample',
</span><span class="cx">                     pid,
</span><span class="cx">                     10,
</span><span class="lines">@@ -185,9 +198,6 @@
</span><span class="cx">                                                   DarwinPort.sample_file_path(self.host, name, pid, self.results_directory()))
</span><span class="cx">             except ScriptError as e:
</span><span class="cx">                 _log.warning('Unable to sample process:' + str(e))
</span><del>-        else:
-            host.filesystem.move_to_base_host(DarwinPort.spindump_file_path(host, name, pid, str(tempdir)),
-                                              DarwinPort.spindump_file_path(self.host, name, pid, self.results_directory()))
</del><span class="cx">         host.filesystem.rmtree(str(tempdir))
</span><span class="cx"> 
</span><span class="cx">     @staticmethod
</span><span class="lines">@@ -195,8 +205,8 @@
</span><span class="cx">         return host.filesystem.join(directory, "{0}-{1}-sample.txt".format(name, pid))
</span><span class="cx"> 
</span><span class="cx">     @staticmethod
</span><del>-    def spindump_file_path(host, name, pid, directory):
-        return host.filesystem.join(directory, "{0}-{1}-spindump.txt".format(name, pid))
</del><ins>+    def tailspin_file_path(host, name, pid, directory):
+        return host.filesystem.join(directory, "{0}-{1}-tailspin.txt".format(name, pid))
</ins><span class="cx"> 
</span><span class="cx">     def look_for_new_samples(self, unresponsive_processes, start_time):
</span><span class="cx">         sample_files = {}
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdarwin_testcasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py (245823 => 245824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py     2019-05-28 21:02:38 UTC (rev 245823)
+++ trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py        2019-05-28 21:04:44 UTC (rev 245824)
</span><span class="lines">@@ -98,18 +98,20 @@
</span><span class="cx">         port = self.make_port(host)
</span><span class="cx">         self.assertEqual(port.path_to_crash_logs(), '/Users/mock/Library/Logs/DiagnosticReports')
</span><span class="cx"> 
</span><del>-    def test_spindump(self):
</del><ins>+    def test_tailspin(self):
</ins><span class="cx"> 
</span><span class="cx">         def logging_run_command(args):
</span><span class="cx">             print(args)
</span><span class="cx"> 
</span><span class="cx">         port = self.make_port()
</span><del>-        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
</del><ins>+        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin-temp.txt'] = 'Temporary tailspin output file'
+        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin.txt'] = 'Symbolocated tailspin file'
</ins><span class="cx">         port.host.executive = MockExecutive2(run_command_fn=logging_run_command)
</span><del>-        expected_stdout = "['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/__im_tmp/tmp_0_/test-42-spindump.txt']\n"
</del><ins>+        expected_stdout = "['/usr/bin/sudo', '-n', '/usr/bin/tailspin', 'save', '-n', '/__im_tmp/tmp_0_/test-42-tailspin-temp.txt']\n['/usr/sbin/spindump', '-i', '/__im_tmp/tmp_0_/test-42-tailspin-temp.txt', '-file', '/__im_tmp/tmp_0_/test-42-tailspin.txt']\n"
</ins><span class="cx">         OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
</span><del>-        self.assertEqual(port.host.filesystem.files['/mock-build/layout-test-results/test-42-spindump.txt'], 'Spindump file')
-        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'])
</del><ins>+        self.assertEqual(port.host.filesystem.files['/mock-build/layout-test-results/test-42-tailspin.txt'], 'Symbolocated tailspin file')
+        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin-temp.txt'])
+        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin.txt'])
</ins><span class="cx"> 
</span><span class="cx">     def test_sample_process(self):
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportios_device_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py (245823 => 245824)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py 2019-05-28 21:02:38 UTC (rev 245823)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py    2019-05-28 21:04:44 UTC (rev 245824)
</span><span class="lines">@@ -45,21 +45,23 @@
</span><span class="cx">         with self.assertRaises(RuntimeError):
</span><span class="cx">             port.path_to_crash_logs()
</span><span class="cx"> 
</span><del>-    def test_spindump(self):
</del><ins>+    def test_tailspin(self):
</ins><span class="cx">         def logging_run_command(args):
</span><span class="cx">             print(args)
</span><span class="cx"> 
</span><span class="cx">         port = self.make_port()
</span><del>-        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
</del><ins>+        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin-temp.txt'] = 'Temporary tailspin output file'
+        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin.txt'] = 'Symbolocated tailspin file'
</ins><span class="cx">         port.host.executive = MockExecutive2(run_command_fn=logging_run_command)
</span><del>-        expected_stdout = "['/usr/sbin/spindump', 42, 10, 10, '-file', '/__im_tmp/tmp_0_/test-42-spindump.txt']\n"
</del><ins>+        expected_stdout = "['/usr/bin/tailspin', 'save', '-n', '/__im_tmp/tmp_0_/test-42-tailspin-temp.txt']\n['/usr/sbin/spindump', '-i', '/__im_tmp/tmp_0_/test-42-tailspin-temp.txt', '-file', '/__im_tmp/tmp_0_/test-42-tailspin.txt']\n"
</ins><span class="cx">         OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
</span><del>-        self.assertEqual(port.host.filesystem.files['/mock-build/layout-test-results/test-42-spindump.txt'], 'Spindump file')
-        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'])
</del><ins>+        self.assertEqual(port.host.filesystem.files['/mock-build/layout-test-results/test-42-tailspin.txt'], 'Symbolocated tailspin file')
+        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin-temp.txt'])
+        self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-tailspin.txt'])
</ins><span class="cx"> 
</span><span class="cx">     def test_sample_process(self):
</span><span class="cx">         def logging_run_command(args):
</span><del>-            if args[0] == '/usr/sbin/spindump':
</del><ins>+            if args[0] == '/usr/bin/tailspin':
</ins><span class="cx">                 return 1
</span><span class="cx">             print(args)
</span><span class="cx">             return 0
</span><span class="lines">@@ -74,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx">     def test_sample_process_exception(self):
</span><span class="cx">         def throwing_run_command(args):
</span><del>-            if args[0] == '/usr/sbin/spindump':
</del><ins>+            if args[0] == '/usr/bin/tailspin':
</ins><span class="cx">                 return 1
</span><span class="cx">             raise ScriptError('MOCK script error')
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>