Fix --no-sample-on-timeout command line argument
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 17:59:18 +0000 (17:59 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 17:59:18 +0000 (17:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161507

Reviewed by Alexey Proskuryakov.

This patch fixes the —no-sample-on-timeout flag and correctly names spindumps as spindump.txt.

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args): Fixed —-no-sample-on-timeout.
* Scripts/webkitpy/port/apple.py:
(ApplePort.sample_process): Use correct file name.
(ApplePort.spindump_file_path): Spindump and sample file names are different.
* Scripts/webkitpy/port/driver.py:
(Driver._check_for_driver_timeout): Check “sample_on_timeout” flag.
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest.test_spindump): Modified for correct filename.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/port/apple.py
Tools/Scripts/webkitpy/port/driver.py
Tools/Scripts/webkitpy/port/mac_unittest.py

index b5d22e3..5ee887b 100644 (file)
@@ -1,5 +1,24 @@
 2016-09-02  Jonathan Bedard  <jbedard@apple.com>
 
+        Fix --no-sample-on-timeout command line argument
+        https://bugs.webkit.org/show_bug.cgi?id=161507
+
+        Reviewed by Alexey Proskuryakov.
+
+        This patch fixes the —no-sample-on-timeout flag and correctly names spindumps as spindump.txt.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args): Fixed —-no-sample-on-timeout.
+        * Scripts/webkitpy/port/apple.py:
+        (ApplePort.sample_process): Use correct file name.
+        (ApplePort.spindump_file_path): Spindump and sample file names are different.
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._check_for_driver_timeout): Check “sample_on_timeout” flag.
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest.test_spindump): Modified for correct filename.
+
+2016-09-02  Jonathan Bedard  <jbedard@apple.com>
+
         Unreviewed: moved myself to the reviewers list.
 
         * Scripts/webkitpy/common/config/contributors.json:
index 6a76605..8254333 100755 (executable)
@@ -139,7 +139,7 @@ def parse_args(args):
             dest="pixel_tests", help="Enable pixel-to-pixel PNG comparisons"),
         optparse.make_option("--no-pixel", "--no-pixel-tests", action="store_false",
             dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"),
-        optparse.make_option("--no-sample-on-timeout", action="store_false",
+        optparse.make_option("--no-sample-on-timeout", action="store_false", default=True,
             dest="sample_on_timeout", help="Don't run sample on timeout (OS X only)"),
         optparse.make_option("--no-ref-tests", action="store_true",
             dest="no_ref_tests", help="Skip all ref tests"),
index f6f1275..3abb6c4 100644 (file)
@@ -198,7 +198,6 @@ class ApplePort(Port):
         return self._merge_crash_logs(crash_logs, all_crash_log, crashed_processes)
 
     def sample_process(self, name, pid):
-        hang_report = self.sample_file_path(name, pid)
         exit_status = self._executive.run_command([
             "/usr/bin/sudo",
             "-n",
@@ -207,7 +206,7 @@ class ApplePort(Port):
             10,
             10,
             "-file",
-            hang_report,
+            self.spindump_file_path(name, pid),
         ], return_exit_code=True)
         if exit_status:
             try:
@@ -217,7 +216,7 @@ class ApplePort(Port):
                     10,
                     10,
                     "-file",
-                    hang_report,
+                    self.sample_file_path(name, pid),
                 ])
             except ScriptError as e:
                 _log.warning('Unable to sample process:' + str(e))
@@ -225,6 +224,9 @@ class ApplePort(Port):
     def sample_file_path(self, name, pid):
         return self._filesystem.join(self.results_directory(), "{0}-{1}-sample.txt".format(name, pid))
 
+    def spindump_file_path(self, name, pid):
+        return self._filesystem.join(self.results_directory(), "{0}-{1}-spindump.txt".format(name, pid))
+
     def look_for_new_samples(self, unresponsive_processes, start_time):
         sample_files = {}
         for (test_name, process_name, pid) in unresponsive_processes:
index 40df91e..2ae2a5c 100644 (file)
@@ -430,7 +430,8 @@ class Driver(object):
             err_line = 'Wait on notifyDone timed out, process ' + child_process_name + ' pid = ' + str(child_process_pid)
             self.error_from_test += err_line
             _log.debug(err_line)
-            self._port.sample_process(child_process_name, child_process_pid)
+            if self._port.get_option("sample_on_timeout"):
+                self._port.sample_process(child_process_name, child_process_pid)
         if out_line == "FAIL: Timed out waiting for notifyDone to be called\n":
             self._driver_timed_out = True
 
index 3db7321..1738a23 100644 (file)
@@ -204,7 +204,7 @@ class MacTest(port_testcase.PortTestCase):
 
         port = self.make_port()
         port._executive = MockExecutive2(run_command_fn=logging_run_command)
-        expected_stdout = "['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-sample.txt']\n"
+        expected_stdout = "['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-spindump.txt']\n"
         OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
 
     def test_sample_process(self):