[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hayato at chromium.org hayato at chromium.org
Wed Dec 22 16:22:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5024ba462ac0a8e2909fe0539fd32b669f7a7972
Author: hayato at chromium.org <hayato at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 22 21:00:41 2010 +0000

    2010-11-19  Hayato Ito  <hayato at chromium.org>
    
            Reviewed by Shinichiro Hamaji.
    
            Simplify Driver.run_test() so that it takes only one parameter, TestInput.
    
            https://bugs.webkit.org/show_bug.cgi?id=49812
    
            * Scripts/webkitpy/layout_tests/driver_test.py:
            * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
            * Scripts/webkitpy/layout_tests/port/base.py:
            * Scripts/webkitpy/layout_tests/port/base_unittest.py:
            * Scripts/webkitpy/layout_tests/port/chromium.py:
            * Scripts/webkitpy/layout_tests/port/dryrun.py:
            * Scripts/webkitpy/layout_tests/port/test.py:
            * Scripts/webkitpy/layout_tests/port/webkit.py:
            * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
            * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72551 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c62ca2d..bf2e4d0 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-11-19  Hayato Ito  <hayato at chromium.org>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Simplify Driver.run_test() so that it takes only one parameter, TestInput.
+
+        https://bugs.webkit.org/show_bug.cgi?id=49812
+
+        * Scripts/webkitpy/layout_tests/driver_test.py:
+        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        * Scripts/webkitpy/layout_tests/port/dryrun.py:
+        * Scripts/webkitpy/layout_tests/port/test.py:
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+
 2010-11-22  Hayato Ito  <hayato at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py b/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
deleted file mode 100644
index 633dfe8..0000000
--- a/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# FIXME: this is a poor attempt at a unit tests driver. We should replace
-# this with something that actually uses a unit testing framework or
-# at least produces output that could be useful.
-
-"""Simple test client for the port/Driver interface."""
-
-import os
-import optparse
-import port
-
-
-def run_tests(port, options, tests):
-    # |image_path| is a path to the image capture from the driver.
-    image_path = 'image_result.png'
-    driver = port.create_driver(image_path, None)
-    driver.start()
-    for t in tests:
-        uri = port.filename_to_uri(os.path.join(port.layout_tests_dir(), t))
-        print "uri: " + uri
-        crash, timeout, checksum, output, err = \
-            driver.run_test(uri, int(options.timeout), None)
-        print "crash:         " + str(crash)
-        print "timeout:       " + str(timeout)
-        print "checksum:      " + str(checksum)
-        print 'stdout: """'
-        print ''.join(output)
-        print '"""'
-        print 'stderr: """'
-        print ''.join(err)
-        print '"""'
-        print
-    driver.stop()
-
-
-if __name__ == '__main__':
-    # FIXME: configuration_options belong in a shared location.
-    configuration_options = [
-        optparse.make_option('--debug', action='store_const', const='Debug', dest="configuration", help='Set the configuration to Debug'),
-        optparse.make_option('--release', action='store_const', const='Release', dest="configuration", help='Set the configuration to Release'),
-    ]
-    misc_options = [
-        optparse.make_option('-p', '--platform', action='store', default='mac', help='Platform to test (e.g., "mac", "chromium-mac", etc.'),
-        optparse.make_option('--timeout', action='store', default='2000', help='test timeout in milliseconds (2000 by default)'),
-        optparse.make_option('--wrapper', action='store'),
-        optparse.make_option('--no-pixel-tests', action='store_true', default=False, help='disable pixel-to-pixel PNG comparisons'),
-    ]
-    option_list = configuration_options + misc_options
-    optparser = optparse.OptionParser(option_list=option_list)
-    options, args = optparser.parse_args()
-    p = port.get(options.platform, options)
-    run_tests(p, options, args)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
index af15a82..1bac7ef 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
@@ -155,11 +155,8 @@ def _run_single_test(port, options, test_input, test_types, test_args, driver, w
     # are generating a new baseline.  (Otherwise, an image from a
     # previous run will be copied into the baseline."""
     if _should_fetch_expected_checksum(options):
-        image_hash_to_driver = port.expected_checksum(test_input.filename)
-    else:
-        image_hash_to_driver = None
-    uri = port.filename_to_uri(test_input.filename)
-    test_output = driver.run_test(uri, test_input.timeout, image_hash_to_driver)
+        test_input.image_hash = port.expected_checksum(test_input.filename)
+    test_output = driver.run_test(test_input)
     return _process_output(port, options, test_input, test_types, test_args,
                            test_output, worker_name)
 
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
index 632806f..3fb0d8e 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -820,17 +820,15 @@ class Driver:
         """
         raise NotImplementedError('Driver.__init__')
 
-    def run_test(self, uri, timeout, checksum):
+    def run_test(self, test_input):
         """Run a single test and return the results.
 
         Note that it is okay if a test times out or crashes and leaves
         the driver in an indeterminate state. The upper layers of the program
         are responsible for cleaning up and ensuring things are okay.
 
-        uri - a full URI for the given test
-        timeout - number of milliseconds to wait before aborting this test.
-        checksum - if present, the expected checksum for the image for this
-            test
+        Args:
+          test_input: a TestInput object
 
         Returns a TestOutput object.
         """
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
index 1e9c2b7..22709ea 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
@@ -290,7 +290,7 @@ class VirtualTest(unittest.TestCase):
                 pass
 
         driver = VirtualDriver()
-        self.assertVirtual(driver.run_test, None, None, None)
+        self.assertVirtual(driver.run_test, None)
         self.assertVirtual(driver.poll)
         self.assertVirtual(driver.stop)
 
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index 5bfb8ff..25c18cb 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -470,7 +470,7 @@ class ChromiumDriver(base.Driver):
                     raise e
         return self._output_image()
 
-    def run_test(self, uri, timeoutms, checksum):
+    def run_test(self, test_input):
         output = []
         error = []
         crash = False
@@ -480,7 +480,9 @@ class ChromiumDriver(base.Driver):
 
         start_time = time.time()
 
-        cmd = self._test_shell_command(uri, timeoutms, checksum)
+        uri = self._port.filename_to_uri(test_input.filename)
+        cmd = self._test_shell_command(uri, test_input.timeout,
+                                       test_input.image_hash)
         (line, crash) = self._write_command_and_read_line(input=cmd)
 
         while not crash and line.rstrip() != "#EOF":
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
index 96d0d55..d444dab 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
@@ -111,15 +111,13 @@ class DryrunDriver(base.Driver):
     def poll(self):
         return None
 
-    def run_test(self, uri, timeoutms, image_hash):
+    def run_test(self, test_input):
         start_time = time.time()
-        test_name = self._port.uri_to_test_name(uri)
-        path = os.path.join(self._port.layout_tests_dir(), test_name)
-        text_output = self._port.expected_text(path)
+        text_output = self._port.expected_text(test_input.filename)
 
-        if image_hash is not None:
-            image = self._port.expected_image(path)
-            hash = self._port.expected_checksum(path)
+        if test_input.image_hash is not None:
+            image = self._port.expected_image(test_input.filename)
+            hash = self._port.expected_checksum(test_input.filename)
         else:
             image = None
             hash = None
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
index 0a27821..dd8f618 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
@@ -290,16 +290,16 @@ class TestDriver(base.Driver):
     def poll(self):
         return True
 
-    def run_test(self, uri, timeoutms, image_hash):
+    def run_test(self, test_input):
         start_time = time.time()
-        test_name = self._port.uri_to_test_name(uri)
+        test_name = self._port.relative_test_filename(test_input.filename)
         test = self._port._tests[test_name]
         if test.keyboard:
             raise KeyboardInterrupt
         if test.exception:
             raise ValueError('exception from ' + test_name)
         if test.hang:
-            time.sleep((float(timeoutms) * 4) / 1000.0)
+            time.sleep((float(test_input.timeout) * 4) / 1000.0)
         return test_output.TestOutput(test.actual_text, test.actual_image,
                                       test.actual_checksum, test.crash,
                                       time.time() - start_time, test.timeout,
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
index 06797c6..f5f9252 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
@@ -433,14 +433,15 @@ class WebKitDriver(base.Driver):
         return
 
     # FIXME: This function is huge.
-    def run_test(self, uri, timeoutms, image_hash):
+    def run_test(self, test_input):
+        uri = self._port.filename_to_uri(test_input.filename)
         if uri.startswith("file:///"):
             command = uri[7:]
         else:
             command = uri
 
-        if image_hash:
-            command += "'" + image_hash
+        if test_input.image_hash:
+            command += "'" + test_input.image_hash
         command += "\n"
 
         start_time = time.time()
@@ -451,7 +452,7 @@ class WebKitDriver(base.Driver):
         output = str()  # Use a byte array for output, even though it should be UTF-8.
         image = str()
 
-        timeout = int(timeoutms) / 1000.0
+        timeout = int(test_input.timeout) / 1000.0
         deadline = time.time() + timeout
         line = self._server_process.read_line(timeout)
         while (not self._server_process.timed_out
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index 9128ae8..9bb7604 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -100,6 +100,10 @@ class TestInput:
         # FIXME: filename should really be test_name as a relative path.
         self.filename = filename
         self.timeout = timeout
+        # The image_hash is used to avoid doing an image dump if the
+        # checksums match. The image_hash is set later, and only if it is needed
+        # for the test.
+        self.image_hash = None
 
 
 class ResultSummary(object):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index 3dfc3e6..bf1f0aa 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -139,12 +139,13 @@ def get_tests_run(extra_args=None, tests_included=False, flatten_batches=False):
         def stop(self):
             self._current_test_batch = None
 
-        def run_test(self, uri, timeoutms, image_hash):
+        def run_test(self, test_input):
             if self._current_test_batch is None:
                 self._current_test_batch = []
                 test_batches.append(self._current_test_batch)
-            self._current_test_batch.append(self._port.uri_to_test_name(uri))
-            return TestDriver.run_test(self, uri, timeoutms, image_hash)
+            test_name = self._port.relative_test_filename(test_input.filename)
+            self._current_test_batch.append(test_name)
+            return TestDriver.run_test(self, test_input)
 
     class RecordingTestPort(TestPort):
         def create_driver(self, image_path, options):

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list