Title: [107284] trunk/Tools
Revision
107284
Author
[email protected]
Date
2012-02-09 13:26:34 -0800 (Thu, 09 Feb 2012)

Log Message

run-perf-tests should have an option to pause before running tests so we can attach Instruments
https://bugs.webkit.org/show_bug.cgi?id=78271

Reviewed by Ryosuke Niwa.

This lets me attach instruments to profile the performance of the test.

* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumDriver.start):
* Scripts/webkitpy/layout_tests/port/driver.py:
(Driver.start):
(DriverProxy.start):
* Scripts/webkitpy/layout_tests/port/server_process.py:
(ServerProcess.start):
* Scripts/webkitpy/layout_tests/port/test.py:
(TestDriver.start):
* Scripts/webkitpy/layout_tests/port/webkit.py:
(WebKitDriver.start):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(get_tests_run.RecordingTestDriver.start):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._parse_args):
(PerfTestsRunner._run_tests_set):
* Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
(start):
(test_run_test_set_kills_drt_per_run.TestDriverWithStopCount):
(test_run_test_set_kills_drt_per_run):
(test_run_test_set_kills_drt_per_run.TestDriverWithStartCount):
(test_run_test_set_kills_drt_per_run.TestDriverWithStartCount.start):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (107283 => 107284)


--- trunk/Tools/ChangeLog	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/ChangeLog	2012-02-09 21:26:34 UTC (rev 107284)
@@ -1,5 +1,37 @@
 2012-02-09  Adam Barth  <[email protected]>
 
+        run-perf-tests should have an option to pause before running tests so we can attach Instruments
+        https://bugs.webkit.org/show_bug.cgi?id=78271
+
+        Reviewed by Ryosuke Niwa.
+
+        This lets me attach instruments to profile the performance of the test.
+
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        (ChromiumDriver.start):
+        * Scripts/webkitpy/layout_tests/port/driver.py:
+        (Driver.start):
+        (DriverProxy.start):
+        * Scripts/webkitpy/layout_tests/port/server_process.py:
+        (ServerProcess.start):
+        * Scripts/webkitpy/layout_tests/port/test.py:
+        (TestDriver.start):
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        (WebKitDriver.start):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (get_tests_run.RecordingTestDriver.start):
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner._parse_args):
+        (PerfTestsRunner._run_tests_set):
+        * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
+        (start):
+        (test_run_test_set_kills_drt_per_run.TestDriverWithStopCount):
+        (test_run_test_set_kills_drt_per_run):
+        (test_run_test_set_kills_drt_per_run.TestDriverWithStartCount):
+        (test_run_test_set_kills_drt_per_run.TestDriverWithStartCount.start):
+
+2012-02-09  Adam Barth  <[email protected]>
+
         run-perf-tests --chromium should run the chromium port
         https://bugs.webkit.org/show_bug.cgi?id=78266
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -592,6 +592,10 @@
         return DriverOutput(text, output_image, actual_checksum, audio=audio_bytes,
             crash=crash, crashed_process_name=crashed_process_name, test_time=run_time, timeout=timeout, error=error)
 
+    def start(self):
+        if not self._proc:
+            self._start()
+
     def stop(self):
         if not self._proc:
             return

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -156,6 +156,9 @@
     def has_crashed(self):
         return False
 
+    def start(self):
+        raise NotImplementedError('Driver.start')
+
     def stop(self):
         raise NotImplementedError('Driver.stop')
 
@@ -192,6 +195,10 @@
     def has_crashed(self):
         return self._driver.has_crashed() or self._reftest_driver.has_crashed()
 
+    def start(self):
+        self._driver.start()
+        self._reftest_driver.start()
+
     def stop(self):
         self._driver.stop()
         self._reftest_driver.stop()

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/server_process.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -260,6 +260,10 @@
 
             self._wait_for_data_and_update_buffers(deadline)
 
+    def start(self):
+        if not self._proc:
+            self._start()
+
     def stop(self):
         if not self._proc:
             return

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -499,5 +499,8 @@
             crashed_process_name=crashed_process_name,
             test_time=time.time() - start_time, timeout=test.timeout, error=test.error)
 
+    def start(self):
+        pass
+
     def stop(self):
         pass

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -645,6 +645,10 @@
         block.decode_content()
         return block
 
+    def start(self):
+        if not self._server_process:
+            self._start()
+
     def stop(self):
         if self._server_process:
             self._server_process.stop()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -140,6 +140,9 @@
             TestDriver.__init__(self, port, worker_number, pixel_tests=port.get_option('pixel_test'), no_timeout=False)
             self._current_test_batch = None
 
+        def start(self):
+            pass
+
         def stop(self):
             self._current_test_batch = None
 

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -91,6 +91,8 @@
                 help="Path to the directory under which build files are kept (should not include configuration)"),
             optparse.make_option("--time-out-ms", default=600 * 1000,
                 help="Set the timeout for each test"),
+            optparse.make_option("--pause-before-testing", dest="pause_before_testing", action="" default=False,
+                help="Pause before running the tests to let user attach a performance monitor."),
             optparse.make_option("--output-json-path",
                 help="Filename of the JSON file that summaries the results"),
             optparse.make_option("--source-json-path",
@@ -217,6 +219,12 @@
         for test in tests:
             driver = port.create_driver(worker_number=1, no_timeout=True)
 
+            if self._options.pause_before_testing:
+                driver.start()
+                if not self._host.user.confirm("Ready to run test?"):
+                    driver.stop()
+                    return unexpected
+
             relative_test_path = self._host.filesystem.relpath(test, self._base_path)
             self._printer.write('Running %s (%d of %d)' % (relative_test_path, expected + unexpected + 1, len(tests)))
 

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py (107283 => 107284)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py	2012-02-09 21:23:48 UTC (rev 107283)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py	2012-02-09 21:26:34 UTC (rev 107284)
@@ -101,6 +101,9 @@
 """
             return DriverOutput(text, '', '', '', crash=crash, timeout=timeout)
 
+        def start(self):
+            """do nothing"""
+
         def stop(self):
             """do nothing"""
 
@@ -157,9 +160,6 @@
         class TestDriverWithStopCount(MainTest.TestDriver):
             stop_count = 0
 
-            def __init__(self):
-                TestDriverWithStopCount.sotp_count = 0
-
             def stop(self):
                 TestDriverWithStopCount.stop_count += 1
 
@@ -173,6 +173,29 @@
         unexpected_result_count = runner._run_tests_set(tests, runner._port)
         self.assertEqual(TestDriverWithStopCount.stop_count, 6)
 
+    def test_run_test_set_kills_drt_per_run(self):
+        class TestDriverWithStartCount(MainTest.TestDriver):
+            start_count = 0
+
+            def start(self):
+                TestDriverWithStartCount.start_count += 1
+
+        buildbot_output = array_stream.ArrayStream()
+        runner = self.create_runner(buildbot_output, args=["--pause-before-testing"], driver_class=TestDriverWithStartCount)
+
+        dirname = runner._base_path + '/inspector/'
+        tests = [dirname + 'pass.html']
+
+        try:
+            output = OutputCapture()
+            output.capture_output()
+            unexpected_result_count = runner._run_tests_set(tests, runner._port)
+            self.assertEqual(TestDriverWithStartCount.start_count, 1)
+        finally:
+            _, stderr, logs = output.restore_output()
+            self.assertEqual(stderr, "Ready to run test?\n")
+            self.assertEqual(logs, "Running inspector/pass.html (1 of 1)\n\n")
+
     def test_run_test_set_for_parser_tests(self):
         buildbot_output = array_stream.ArrayStream()
         runner = self.create_runner(buildbot_output)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to