Title: [90074] trunk/Tools
Revision
90074
Author
[email protected]
Date
2011-06-29 17:42:39 -0700 (Wed, 29 Jun 2011)

Log Message

2011-06-29  Adam Barth  <[email protected]>

        Reviewed by Eric Seidel.

        new-run-webkit-tests doesn't support sample-on-timeout
        https://bugs.webkit.org/show_bug.cgi?id=56731

        * Scripts/webkitpy/layout_tests/port/server_process.py:
        * Scripts/webkitpy/layout_tests/port/server_process_unittest.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90073 => 90074)


--- trunk/Tools/ChangeLog	2011-06-30 00:30:49 UTC (rev 90073)
+++ trunk/Tools/ChangeLog	2011-06-30 00:42:39 UTC (rev 90074)
@@ -1,3 +1,14 @@
+2011-06-29  Adam Barth  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        new-run-webkit-tests doesn't support sample-on-timeout
+        https://bugs.webkit.org/show_bug.cgi?id=56731
+
+        * Scripts/webkitpy/layout_tests/port/server_process.py:
+        * Scripts/webkitpy/layout_tests/port/server_process_unittest.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+
 2011-06-29  Eric Seidel  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py (90073 => 90074)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2011-06-30 00:30:49 UTC (rev 90073)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2011-06-30 00:42:39 UTC (rev 90074)
@@ -41,7 +41,7 @@
 
 from webkitpy.common.system.executive import Executive
 
-_log = logging.getLogger("webkitpy.layout_tests.port.server_process")
+_log = logging.getLogger(__file__)
 
 
 class ServerProcess:
@@ -166,6 +166,20 @@
             self.crashed = True
             self.handle_interrupt()
 
+    def _sample(self):
+        if sys.platform != "darwin":
+            return
+        _log.warning('Sampling process... (use --no-sample-on-timeout to skip this step)')
+        hang_report = os.path.join(self._port.results_directory(), "%s-%s.sample.txt" % (self._name, self._proc.pid))
+        self._executive.run_command([
+            "/usr/bin/sample",
+            self._proc.pid,
+            10,
+            10,
+            "-file",
+            hang_report,
+        ])
+
     def _read(self, timeout, size):
         """Internal routine that actually does the read."""
         index = -1
@@ -184,6 +198,8 @@
                     if not self.crashed:
                         self._check_for_crash()
                 self.timed_out = True
+                if not self.crashed:
+                    self._sample()
 
             # Check to see if we have any output we can return.
             if size and len(self._output) >= size:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py (90073 => 90074)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py	2011-06-30 00:30:49 UTC (rev 90073)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py	2011-06-30 00:42:39 UTC (rev 90074)
@@ -26,11 +26,23 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import sys
 import unittest
 
 from webkitpy.layout_tests.port import server_process
+from webkitpy.common.system.executive_mock import MockExecutive2
+from webkitpy.common.system.outputcapture import OutputCapture
 
 
+def _logging_run_command(args):
+    print args
+
+
+class TrivialMockPort(object):
+    def results_directory(self):
+        return "/mock/results"
+
+
 class MockFile(object):
     def __init__(self, server_process):
         self._server_process = server_process
@@ -72,6 +84,11 @@
         self.assertEquals(server_process._proc, None)
         self.assertEquals(server_process.broken_pipes, [server_process.stdin])
 
-
-if __name__ == '__main__':
-    unittest.main()
+    def test_sample_process(self):
+        # Currently, sample-on-timeout only works on Darwin.
+        if sys.platform != "darwin":
+            return
+        server_process = FakeServerProcess(port_obj=TrivialMockPort(), name="test", cmd=["test"], executive=MockExecutive2(run_command_fn=_logging_run_command))
+        server_process._proc = MockProc(server_process)
+        expected_stdout = "['/usr/bin/sample', 1, 10, 10, '-file', '/mock/results/test-1.sample.txt']\n"
+        OutputCapture().assert_outputs(self, server_process._sample, expected_stdout=expected_stdout)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (90073 => 90074)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-06-30 00:30:49 UTC (rev 90073)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2011-06-30 00:42:39 UTC (rev 90074)
@@ -276,11 +276,8 @@
     # Missing Mac-specific old-run-webkit-tests options:
     # FIXME: Need: -g, --guard for guard malloc support on Mac.
     # FIXME: Need: -l --leaks    Enable leaks checking.
-    # FIXME: Need: --sample-on-timeout Run sample on timeout
 
     old_run_webkit_tests_compat = [
-        # NRWT doesn't sample on timeout yet anyway.
-        _compat_shim_option("--no-sample-on-timeout"),
         # FIXME: NRWT needs to support remote links eventually.
         _compat_shim_option("--use-remote-links-to-tests"),
     ]
@@ -292,6 +289,8 @@
             dest="pixel_tests", help="Enable pixel-to-pixel PNG comparisons"),
         optparse.make_option("--no-pixel-tests", action=""
             dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"),
+        optparse.make_option("--no-sample-on-timeout", action=""
+            dest="sample_on_timeout", help="Don't run sample on timeout (Mac OS X only)"),
         optparse.make_option("--tolerance",
             help="Ignore image differences less than this percentage (some "
                 "ports may ignore this option)", type="float"),
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to