Title: [123250] trunk/Tools
Revision
123250
Author
dpra...@chromium.org
Date
2012-07-20 12:59:08 -0700 (Fri, 20 Jul 2012)

Log Message

REGRESSION: run-perf-tests --pause-before-testing is broken
https://bugs.webkit.org/show_bug.cgi?id=91789

Reviewed by Ryosuke Niwa.

Turns out start() wasn't actually starting things :(. Fixed, and
added tests.

* Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
(ChromiumAndroidDriverTest.test_read_prompt):
* Scripts/webkitpy/layout_tests/port/driver.py:
(Driver.__init__):
(Driver._start):
* Scripts/webkitpy/layout_tests/port/driver_unittest.py:
(DriverTest.test_read_block):
(DriverTest.test_read_binary_block):
(DriverTest.test_read_base64_block):
(DriverTest.test_stop_cleans_up_properly):
(DriverTest.test_two_starts_cleans_up_properly):
(DriverTest.test_start_actually_starts):
(MockServerProcess.__init__):
(MockServerProcess.start):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123249 => 123250)


--- trunk/Tools/ChangeLog	2012-07-20 19:43:34 UTC (rev 123249)
+++ trunk/Tools/ChangeLog	2012-07-20 19:59:08 UTC (rev 123250)
@@ -1,3 +1,28 @@
+2012-07-20  Dirk Pranke  <dpra...@chromium.org>
+
+        REGRESSION: run-perf-tests --pause-before-testing is broken
+        https://bugs.webkit.org/show_bug.cgi?id=91789
+
+        Reviewed by Ryosuke Niwa.
+
+        Turns out start() wasn't actually starting things :(. Fixed, and
+        added tests.
+
+        * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
+        (ChromiumAndroidDriverTest.test_read_prompt):
+        * Scripts/webkitpy/layout_tests/port/driver.py:
+        (Driver.__init__):
+        (Driver._start):
+        * Scripts/webkitpy/layout_tests/port/driver_unittest.py:
+        (DriverTest.test_read_block):
+        (DriverTest.test_read_binary_block):
+        (DriverTest.test_read_base64_block):
+        (DriverTest.test_stop_cleans_up_properly):
+        (DriverTest.test_two_starts_cleans_up_properly):
+        (DriverTest.test_start_actually_starts):
+        (MockServerProcess.__init__):
+        (MockServerProcess.start):
+
 2012-07-20  Jochen Eisinger  <joc...@chromium.org>
 
         [chromium] Don't include WebCore headers in TestInterfaces so it's safe to include from outside of WebCore

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py (123249 => 123250)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-07-20 19:43:34 UTC (rev 123249)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py	2012-07-20 19:59:08 UTC (rev 123250)
@@ -147,9 +147,9 @@
         self.assertTrue('--err-fifo=' + chromium_android.DRT_APP_FILES_DIR + 'DumpRenderTree.err' in cmd_line)
 
     def test_read_prompt(self):
-        self.driver._server_process = driver_unittest.MockServerProcess(['root@android:/ # '])
+        self.driver._server_process = driver_unittest.MockServerProcess(lines=['root@android:/ # '])
         self.assertEquals(self.driver._read_prompt(time.time() + 1), None)
-        self.driver._server_process = driver_unittest.MockServerProcess(['$ '])
+        self.driver._server_process = driver_unittest.MockServerProcess(lines=['$ '])
         self.assertRaises(AssertionError, self.driver._read_prompt, time.time() + 1)
 
     def test_command_from_driver_input(self):

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-07-20 19:43:34 UTC (rev 123249)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py	2012-07-20 19:59:08 UTC (rev 123250)
@@ -115,6 +115,9 @@
         self._worker_number = worker_number
         self._no_timeout = no_timeout
 
+        # overridable for testing.
+        self._server_process_constructor = server_process.ServerProcess
+
         self._driver_tempdir = None
         # WebKitTestRunner can report back subprocess crashes by printing
         # "#CRASHED - PROCESSNAME".  Since those can happen at any time
@@ -268,9 +271,9 @@
         environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
         self._crashed_process_name = None
         self._crashed_pid = None
-        self._server_process = server_process.ServerProcess(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), environment)
+        self._server_process = self._server_process_constructor(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), environment)
+        self._server_process.start()
 
-
     def stop(self):
         if self._server_process:
             self._server_process.stop()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py (123249 => 123250)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py	2012-07-20 19:43:34 UTC (rev 123249)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py	2012-07-20 19:59:08 UTC (rev 123250)
@@ -26,7 +26,6 @@
 # (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.common.system.systemhost_mock import MockSystemHost
@@ -112,7 +111,7 @@
     def test_read_block(self):
         port = TestWebKitPort()
         driver = Driver(port, 0, pixel_tests=False)
-        driver._server_process = MockServerProcess([
+        driver._server_process = MockServerProcess(lines=[
             'ActualHash: foobar',
             'Content-Type: my_type',
             'Content-Transfer-Encoding: none',
@@ -127,7 +126,7 @@
     def test_read_binary_block(self):
         port = TestWebKitPort()
         driver = Driver(port, 0, pixel_tests=True)
-        driver._server_process = MockServerProcess([
+        driver._server_process = MockServerProcess(lines=[
             'ActualHash: actual',
             'ExpectedHash: expected',
             'Content-Type: image/png',
@@ -145,7 +144,7 @@
     def test_read_base64_block(self):
         port = TestWebKitPort()
         driver = Driver(port, 0, pixel_tests=True)
-        driver._server_process = MockServerProcess([
+        driver._server_process = MockServerProcess(lines=[
             'ActualHash: actual',
             'ExpectedHash: expected',
             'Content-Type: image/png',
@@ -234,6 +233,7 @@
     def test_stop_cleans_up_properly(self):
         port = TestWebKitPort()
         driver = Driver(port, 0, pixel_tests=True)
+        driver._server_process_constructor = MockServerProcess
         driver.start(True, [])
         last_tmpdir = port._filesystem.last_tmpdir
         self.assertNotEquals(last_tmpdir, None)
@@ -243,17 +243,26 @@
     def test_two_starts_cleans_up_properly(self):
         port = TestWebKitPort()
         driver = Driver(port, 0, pixel_tests=True)
+        driver._server_process_constructor = MockServerProcess
         driver.start(True, [])
         last_tmpdir = port._filesystem.last_tmpdir
         driver._start(True, [])
         self.assertFalse(port._filesystem.isdir(last_tmpdir))
 
+    def test_start_actually_starts(self):
+        port = TestWebKitPort()
+        driver = Driver(port, 0, pixel_tests=True)
+        driver._server_process_constructor = MockServerProcess
+        driver.start(True, [])
+        self.assertTrue(driver._server_process.started)
 
+
 class MockServerProcess(object):
-    def __init__(self, lines=None):
+    def __init__(self, port_obj=None, name=None, cmd=None, env=None, universal_newlines=False, lines=None):
         self.timed_out = False
         self.lines = lines or []
         self.crashed = False
+        self.started = False
 
     def has_crashed(self):
         return self.crashed
@@ -278,7 +287,7 @@
         return self.read_stdout_line(deadline), None
 
     def start(self):
-        return
+        self.started = True
 
     def stop(self, kill_directly=False):
         return
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to