webkitpy: Switch run-webkit-tests to tailspin
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 May 2019 21:04:44 +0000 (21:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 May 2019 21:04:44 +0000 (21:04 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245824 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/port/darwin.py
Tools/Scripts/webkitpy/port/darwin_testcase.py
Tools/Scripts/webkitpy/port/ios_device_unittest.py

index 0f4d030..2cadfad 100644 (file)
@@ -1,5 +1,33 @@
 2019-05-28  David Xiong  <w_xiong@apple.com>
 
+        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>
+
         webkitpy: Using sudo on iOS device during timeout spindumps 
         https://bugs.webkit.org/show_bug.cgi?id=198142
 
index c124998..e7045c0 100644 (file)
@@ -160,18 +160,31 @@ class DarwinPort(ApplePort):
     def sample_process(self, name, pid, target_host=None):
         host = target_host or self.host
         tempdir = host.filesystem.mkdtemp()
+        temp_tailspin_file_path = host.filesystem.join(str(tempdir), "{0}-{1}-tailspin-temp.txt".format(name, pid))
         command = [
-            '/usr/sbin/spindump',
-            pid,
-            10,
-            10,
-            '-file',
-            DarwinPort.spindump_file_path(host, name, pid, str(tempdir)),
+            '/usr/bin/tailspin',
+            'save',
+            '-n',
+            temp_tailspin_file_path,
         ]
         if host.platform.is_mac():
             command = ['/usr/bin/sudo', '-n'] + command
+
         exit_status = host.executive.run_command(command, return_exit_code=True)
-        if exit_status:
+        if not exit_status:  # Symbolicate tailspin log using spindump
+            try:
+                host.executive.run_command([
+                    '/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([
                     '/usr/bin/sample',
@@ -185,9 +198,6 @@ class DarwinPort(ApplePort):
                                                   DarwinPort.sample_file_path(self.host, name, pid, self.results_directory()))
             except ScriptError as e:
                 _log.warning('Unable to sample process:' + str(e))
-        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()))
         host.filesystem.rmtree(str(tempdir))
 
     @staticmethod
@@ -195,8 +205,8 @@ class DarwinPort(ApplePort):
         return host.filesystem.join(directory, "{0}-{1}-sample.txt".format(name, pid))
 
     @staticmethod
-    def spindump_file_path(host, name, pid, directory):
-        return host.filesystem.join(directory, "{0}-{1}-spindump.txt".format(name, pid))
+    def tailspin_file_path(host, name, pid, directory):
+        return host.filesystem.join(directory, "{0}-{1}-tailspin.txt".format(name, pid))
 
     def look_for_new_samples(self, unresponsive_processes, start_time):
         sample_files = {}
index bcb3469..a9c6493 100644 (file)
@@ -98,18 +98,20 @@ class DarwinTest(port_testcase.PortTestCase):
         port = self.make_port(host)
         self.assertEqual(port.path_to_crash_logs(), '/Users/mock/Library/Logs/DiagnosticReports')
 
-    def test_spindump(self):
+    def test_tailspin(self):
 
         def logging_run_command(args):
             print(args)
 
         port = self.make_port()
-        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
+        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'
         port.host.executive = MockExecutive2(run_command_fn=logging_run_command)
-        expected_stdout = "['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/__im_tmp/tmp_0_/test-42-spindump.txt']\n"
+        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"
         OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
-        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'])
+        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'])
 
     def test_sample_process(self):
 
index 4f61282..16e0de1 100644 (file)
@@ -45,21 +45,23 @@ class IOSDeviceTest(ios_testcase.IOSTest):
         with self.assertRaises(RuntimeError):
             port.path_to_crash_logs()
 
-    def test_spindump(self):
+    def test_tailspin(self):
         def logging_run_command(args):
             print(args)
 
         port = self.make_port()
-        port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-spindump.txt'] = 'Spindump file'
+        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'
         port.host.executive = MockExecutive2(run_command_fn=logging_run_command)
-        expected_stdout = "['/usr/sbin/spindump', 42, 10, 10, '-file', '/__im_tmp/tmp_0_/test-42-spindump.txt']\n"
+        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"
         OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
-        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'])
+        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'])
 
     def test_sample_process(self):
         def logging_run_command(args):
-            if args[0] == '/usr/sbin/spindump':
+            if args[0] == '/usr/bin/tailspin':
                 return 1
             print(args)
             return 0
@@ -74,7 +76,7 @@ class IOSDeviceTest(ios_testcase.IOSTest):
 
     def test_sample_process_exception(self):
         def throwing_run_command(args):
-            if args[0] == '/usr/sbin/spindump':
+            if args[0] == '/usr/bin/tailspin':
                 return 1
             raise ScriptError('MOCK script error')