Diff
Modified: trunk/Tools/ChangeLog (217945 => 217946)
--- trunk/Tools/ChangeLog 2017-06-08 20:37:49 UTC (rev 217945)
+++ trunk/Tools/ChangeLog 2017-06-08 20:39:00 UTC (rev 217946)
@@ -1,3 +1,25 @@
+2017-06-08 Jonathan Bedard <[email protected]>
+
+ webkitpy: Run sample/spindump on iOS devices
+ https://bugs.webkit.org/show_bug.cgi?id=171881
+ <rdar://problem/32084602>
+
+ Reviewed by Daniel Bates.
+
+ * Scripts/webkitpy/port/darwin.py:
+ (DarwinPort.sample_process): Only add sudo prefix if the platform is Mac, which
+ requires sudo to run spindump.
+ * Scripts/webkitpy/port/ios_device.py:
+ (IOSDevicePort.look_for_new_samples): Deleted.
+ (IOSDevicePort.sample_process): Deleted.
+ * Scripts/webkitpy/port/ios_device_unittest.py:
+ (IOSDeviceTest): iOS devices use 'ios' and their os_name.
+ (IOSDeviceTest.test_spindump):
+ (IOSDeviceTest.test_sample_process):
+ (IOSDeviceTest.test_sample_process_exception):
+ * Scripts/webkitpy/port/ios_simulator_unittest.py:
+ (IOSSimulatorTest): iOS Simulators run on Mac and use 'mac' as their os_name.
+
2017-06-08 Keith Miller <[email protected]>
WebAssembly: We should only create wrappers for functions that can be exported
Modified: trunk/Tools/Scripts/webkitpy/port/darwin.py (217945 => 217946)
--- trunk/Tools/Scripts/webkitpy/port/darwin.py 2017-06-08 20:37:49 UTC (rev 217945)
+++ trunk/Tools/Scripts/webkitpy/port/darwin.py 2017-06-08 20:39:00 UTC (rev 217946)
@@ -154,24 +154,25 @@
def sample_process(self, name, pid, target_host=None):
host = target_host or self.host
tempdir = host.filesystem.mkdtemp()
- exit_status = host.executive.run_command([
- "/usr/bin/sudo",
- "-n",
- "/usr/sbin/spindump",
+ command = [
+ '/usr/sbin/spindump',
pid,
10,
10,
- "-file",
+ '-file',
DarwinPort.spindump_file_path(host, name, pid, str(tempdir)),
- ], return_exit_code=True)
+ ]
+ if self.host.platform.is_mac():
+ command = ['/usr/bin/sudo', '-n'] + command
+ exit_status = host.executive.run_command(command, return_exit_code=True)
if exit_status:
try:
host.executive.run_command([
- "/usr/bin/sample",
+ '/usr/bin/sample',
pid,
10,
10,
- "-file",
+ '-file',
DarwinPort.sample_file_path(host, name, pid, str(tempdir)),
])
host.filesystem.move_to_base_host(DarwinPort.sample_file_path(host, name, pid, str(tempdir)),
Modified: trunk/Tools/Scripts/webkitpy/port/ios_device.py (217945 => 217946)
--- trunk/Tools/Scripts/webkitpy/port/ios_device.py 2017-06-08 20:37:49 UTC (rev 217945)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device.py 2017-06-08 20:39:00 UTC (rev 217946)
@@ -95,12 +95,6 @@
def check_for_leaks(self, process_name, process_pid):
pass
- def look_for_new_samples(self, unresponsive_processes, start_time):
- return {}
-
- def sample_process(self, name, pid, target_host=None):
- pass
-
# Despite their names, these flags do not actually get passed all the way down to webkit-build.
def _build_driver_flags(self):
return ['--sdk', self.SDK] + (['ARCHS=%s' % self.architecture()] if self.architecture() else [])
Modified: trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py (217945 => 217946)
--- trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py 2017-06-08 20:37:49 UTC (rev 217945)
+++ trunk/Tools/Scripts/webkitpy/port/ios_device_unittest.py 2017-06-08 20:39:00 UTC (rev 217946)
@@ -22,12 +22,14 @@
import time
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
from webkitpy.port.ios_device import IOSDevicePort
from webkitpy.port import ios_testcase
class IOSDeviceTest(ios_testcase.IOSTest):
- os_name = 'ios-device'
+ os_name = 'ios'
os_version = ''
port_name = 'ios-device'
port_maker = IOSDevicePort
@@ -44,17 +46,44 @@
with self.assertRaises(RuntimeError):
port.path_to_crash_logs()
- def test_get_crash_log(self):
- port = self.make_port(port_name=self.port_name)
- with self.assertRaises(RuntimeError):
- port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
-
- # FIXME: Update tests when <rdar://problem/30497991> is completed.
def test_spindump(self):
- pass
+ 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.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"
+ 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'])
+
def test_sample_process(self):
- pass
+ def logging_run_command(args):
+ if args[0] == '/usr/sbin/spindump':
+ return 1
+ print args
+ return 0
+ port = self.make_port()
+ port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-sample.txt'] = 'Sample file'
+ port.host.executive = MockExecutive2(run_command_fn=logging_run_command)
+ expected_stdout = "['/usr/bin/sample', 42, 10, 10, '-file', '/__im_tmp/tmp_0_/test-42-sample.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-sample.txt'], 'Sample file')
+ self.assertIsNone(port.host.filesystem.files['/__im_tmp/tmp_0_/test-42-sample.txt'])
+
def test_sample_process_exception(self):
- pass
+ def throwing_run_command(args):
+ if args[0] == '/usr/sbin/spindump':
+ return 1
+ raise ScriptError('MOCK script error')
+
+ port = self.make_port()
+ port.host.executive = MockExecutive2(run_command_fn=throwing_run_command)
+ OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42])
+
+ def test_get_crash_log(self):
+ port = self.make_port(port_name=self.port_name)
+ with self.assertRaises(RuntimeError):
+ port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
Modified: trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py (217945 => 217946)
--- trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py 2017-06-08 20:37:49 UTC (rev 217945)
+++ trunk/Tools/Scripts/webkitpy/port/ios_simulator_unittest.py 2017-06-08 20:39:00 UTC (rev 217946)
@@ -30,7 +30,8 @@
class IOSSimulatorTest(ios_testcase.IOSTest):
- os_name = 'ios-simulator'
+ # FIXME: https://bugs.webkit.org/show_bug.cgi?id=173107
+ os_name = 'mac'
os_version = ''
port_name = 'ios-simulator'
port_maker = IOSSimulatorPort