Title: [145916] trunk
Revision
145916
Author
[email protected]
Date
2013-03-15 10:59:44 -0700 (Fri, 15 Mar 2013)

Log Message

Collect samples for unresponsive web processes
https://bugs.webkit.org/show_bug.cgi?id=112409

Tools:

Reviewed by Tim Horton.

When we detect that a subprocess was unresponsive, run the 'sample'
tool on that process, for the Mac port.

The sample will be linked to from the results.html page, next
to the crash log link.

* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._look_for_new_crash_logs): Before looking for crash logs,
look for samples on disk.
* Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
(TestResultWriter):
(TestResultWriter.copy_sample_file): Teach TestResultWriter about
-sample.txt files, and have it copy their contents to a new file
next to the test that spawned them (as we do for crash logs).
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.look_for_new_samples): Base class does nothing for sampling.
* Scripts/webkitpy/layout_tests/port/driver.py:
(Driver._check_for_driver_crash): Kick off a sample if we detected
that the subprocess was unresponsive.
* Scripts/webkitpy/layout_tests/port/mac.py:
(MacPort.sample_file_path): Utility to generate the file path
to the generated sample files at the top level of layout-test-results.
(MacPort.look_for_new_crash_logs): Fix typo
(MacPort.look_for_new_samples): New function to find sample files.
(MacPort.sample_process): Use the utility function to get the file path.

LayoutTests:

Reviewed by Tim Horton.

Add links for samples, which some platforms will show for unresponsive WebProcess timeouts.

* fast/harness/results.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145915 => 145916)


--- trunk/LayoutTests/ChangeLog	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/LayoutTests/ChangeLog	2013-03-15 17:59:44 UTC (rev 145916)
@@ -1,3 +1,14 @@
+2013-03-14  Simon Fraser  <[email protected]>
+
+        Collect samples for unresponsive web processes
+        https://bugs.webkit.org/show_bug.cgi?id=112409
+
+        Reviewed by Tim Horton.
+        
+        Add links for samples, which some platforms will show for unresponsive WebProcess timeouts.
+
+        * fast/harness/results.html:
+
 2013-03-14  Jer Noble  <[email protected]>
 
         REGRESSION: -webkit-box-reflect does not show on video elements

Modified: trunk/LayoutTests/fast/harness/results.html (145915 => 145916)


--- trunk/LayoutTests/fast/harness/results.html	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/LayoutTests/fast/harness/results.html	2013-03-15 17:59:44 UTC (rev 145916)
@@ -713,9 +713,10 @@
             html += resultLink(stripExtension(test), '-stderr.txt', 'stderr');
         else if (tableId == 'passes-table')
             html += testObject.expected;
-        else if (tableId == 'crash-tests-table')
+        else if (tableId == 'crash-tests-table') {
             html += resultLink(stripExtension(test), '-crash-log.txt', 'crash log');
-        else if (tableId == 'timeout-tests-table') {
+            html += resultLink(stripExtension(test), '-sample.txt', 'sample');
+        } else if (tableId == 'timeout-tests-table') {
             // FIXME: only include timeout actual/diff results here if we actually spit out results for timeout tests.
             html += textResultLinks(stripExtension(test));
         }

Modified: trunk/Tools/ChangeLog (145915 => 145916)


--- trunk/Tools/ChangeLog	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/ChangeLog	2013-03-15 17:59:44 UTC (rev 145916)
@@ -1,3 +1,36 @@
+2013-03-14  Simon Fraser  <[email protected]>
+
+        Collect samples for unresponsive web processes
+        https://bugs.webkit.org/show_bug.cgi?id=112409
+
+        Reviewed by Tim Horton.
+        
+        When we detect that a subprocess was unresponsive, run the 'sample'
+        tool on that process, for the Mac port.
+        
+        The sample will be linked to from the results.html page, next
+        to the crash log link.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._look_for_new_crash_logs): Before looking for crash logs,
+        look for samples on disk.
+        * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+        (TestResultWriter):
+        (TestResultWriter.copy_sample_file): Teach TestResultWriter about
+        -sample.txt files, and have it copy their contents to a new file
+        next to the test that spawned them (as we do for crash logs).
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.look_for_new_samples): Base class does nothing for sampling.
+        * Scripts/webkitpy/layout_tests/port/driver.py:
+        (Driver._check_for_driver_crash): Kick off a sample if we detected
+        that the subprocess was unresponsive.
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        (MacPort.sample_file_path): Utility to generate the file path
+        to the generated sample files at the top level of layout-test-results.
+        (MacPort.look_for_new_crash_logs): Fix typo
+        (MacPort.look_for_new_samples): New function to find sample files.
+        (MacPort.sample_process): Use the utility function to get the file path.
+
 2013-03-15  Zeno Albisser  <[email protected]>
 
         [Qt] Remove simple getters and setters from TestRunnerQt

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (145915 => 145916)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py	2013-03-15 17:59:44 UTC (rev 145916)
@@ -274,6 +274,12 @@
                     continue
                 crashed_processes.append([test, failure.process_name, failure.pid])
 
+        sample_files = self._port.look_for_new_samples(crashed_processes, start_time)
+        if sample_files:
+            for test, sample_file in sample_files.iteritems():
+                writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test)
+                writer.copy_sample_file(sample_file)
+
         crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time)
         if crash_logs:
             for test, crash_log in crash_logs.iteritems():

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py (145915 => 145916)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2013-03-15 17:59:44 UTC (rev 145916)
@@ -92,6 +92,7 @@
     FILENAME_SUFFIX_DIFF = "-diff"
     FILENAME_SUFFIX_STDERR = "-stderr"
     FILENAME_SUFFIX_CRASH_LOG = "-crash-log"
+    FILENAME_SUFFIX_SAMPLE = "-sample"
     FILENAME_SUFFIX_WDIFF = "-wdiff.html"
     FILENAME_SUFFIX_PRETTY_PATCH = "-pretty-diff.html"
     FILENAME_SUFFIX_IMAGE_DIFF = "-diff.png"
@@ -166,6 +167,10 @@
         filename = self.output_filename(self.FILENAME_SUFFIX_CRASH_LOG + ".txt")
         self._write_text_file(filename, crash_log)
 
+    def copy_sample_file(self, sample_file):
+        filename = self.output_filename(self.FILENAME_SUFFIX_SAMPLE + ".txt")
+        self._filesystem.copyfile(sample_file, filename)
+
     def write_text_files(self, actual_text, expected_text):
         self.write_output_files(".txt", actual_text, expected_text)
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (145915 => 145916)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2013-03-15 17:59:44 UTC (rev 145916)
@@ -1343,6 +1343,9 @@
     def look_for_new_crash_logs(self, crashed_processes, start_time):
         pass
 
+    def look_for_new_samples(self, unresponsive_processes, start_time):
+        pass
+
     def sample_process(self, name, pid):
         pass
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py (145915 => 145916)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2013-03-15 17:59:44 UTC (rev 145916)
@@ -362,6 +362,7 @@
             _log.debug('%s crash, pid = %s, error_line = %s' % (self._crashed_process_name, str(pid), error_line))
             if error_line.startswith("#PROCESS UNRESPONSIVE - "):
                 self._subprocess_was_unresponsive = True
+                self._port.sample_process(self._crashed_process_name, self._crashed_pid)
                 # We want to show this since it's not a regular crash and probably we don't have a crash log.
                 self.error_from_test += error_line
             return True

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py (145915 => 145916)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2013-03-15 17:58:07 UTC (rev 145915)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2013-03-15 17:59:44 UTC (rev 145916)
@@ -186,6 +186,9 @@
     def release_http_lock(self):
         pass
 
+    def sample_file_path(self, name, pid):
+        return self._filesystem.join(self.results_directory(), "{0}-{1}-sample.txt".format(name, pid))
+
     def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None, wait_for_log=True):
         # Note that we do slow-spin here and wait, since it appears the time
         # ReportCrash takes to actually write and flush the file varies when there are
@@ -222,16 +225,25 @@
         crash_logs = {}
         for (test_name, process_name, pid) in crashed_processes:
             # Passing None for output.  This is a second pass after the test finished so
-            # if the output had any loggine we would have already collected it.
+            # if the output had any logging we would have already collected it.
             crash_log = self._get_crash_log(process_name, pid, None, None, start_time, wait_for_log=False)[1]
             if not crash_log:
                 continue
             crash_logs[test_name] = crash_log
         return crash_logs
 
+    def look_for_new_samples(self, unresponsive_processes, start_time):
+        sample_files = {}
+        for (test_name, process_name, pid) in unresponsive_processes:
+            sample_file = self.sample_file_path(process_name, pid)
+            if not self._filesystem.isfile(sample_file):
+                continue
+            sample_files[test_name] = sample_file
+        return sample_files
+
     def sample_process(self, name, pid):
         try:
-            hang_report = self._filesystem.join(self.results_directory(), "%s-%s.sample.txt" % (name, pid))
+            hang_report = self.sample_file_path(name, pid)
             self._executive.run_command([
                 "/usr/bin/sample",
                 pid,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to