2011-02-03 Hayato Ito <hayato@chromium.org>
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 05:36:15 +0000 (05:36 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 05:36:15 +0000 (05:36 +0000)
        Reviewed by Tony Chang.

        [NRWT] Introduces Input/Output class used by base.Driver into port/base.py and
        move _run_single_test() and _process_output() functions from
        dump_render_tree_thread.py to a single_test_runner.py as an individual module.

        This is clean up and acts as a preparation for elimination of test_types/*
        classes. These classes will move to the single_test_runner module introduced
        in this patch.

        https://bugs.webkit.org/show_bug.cgi?id=53004

        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py: Added.
        * Scripts/webkitpy/layout_tests/layout_package/test_input.py:
        * Scripts/webkitpy/layout_tests/layout_package/test_output.py: Removed.
        * Scripts/webkitpy/layout_tests/port/base.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/test_types/image_diff.py:
        * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77603 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py [new file with mode: 0644]
Tools/Scripts/webkitpy/layout_tests/layout_package/test_input.py
Tools/Scripts/webkitpy/layout_tests/layout_package/test_output.py [deleted file]
Tools/Scripts/webkitpy/layout_tests/port/base.py
Tools/Scripts/webkitpy/layout_tests/port/chromium.py
Tools/Scripts/webkitpy/layout_tests/port/dryrun.py
Tools/Scripts/webkitpy/layout_tests/port/test.py
Tools/Scripts/webkitpy/layout_tests/port/webkit.py
Tools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
Tools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
Tools/Scripts/webkitpy/layout_tests/test_types/text_diff.py

index 9be7f1de613c2e8cd5652d605da16b2453996d49..a6d8d5677d4a0c1216d5f5ae4e6f699412d6731e 100644 (file)
@@ -1,3 +1,30 @@
+2011-02-03  Hayato Ito  <hayato@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [NRWT] Introduces Input/Output class used by base.Driver into port/base.py and
+        move _run_single_test() and _process_output() functions from
+        dump_render_tree_thread.py to a single_test_runner.py as an individual module.
+
+        This is clean up and acts as a preparation for elimination of test_types/*
+        classes. These classes will move to the single_test_runner module introduced
+        in this patch.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53004
+
+        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
+        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py: Added.
+        * Scripts/webkitpy/layout_tests/layout_package/test_input.py:
+        * Scripts/webkitpy/layout_tests/layout_package/test_output.py: Removed.
+        * Scripts/webkitpy/layout_tests/port/base.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/test_types/image_diff.py:
+        * Scripts/webkitpy/layout_tests/test_types/test_type_base.py:
+        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
 2011-02-03  Dirk Pranke  <dpranke@chromium.org>
 
         Unreviewed, build fix.
index 050eefae1b18ec2b1628da75f261488d0f2ac3a5..340bce1ac3d323128a6bfbbe95d7861431db84a8 100644 (file)
@@ -51,80 +51,14 @@ from webkitpy.layout_tests.test_types import image_diff
 from webkitpy.layout_tests.test_types import test_type_base
 from webkitpy.layout_tests.test_types import text_diff
 
+import single_test_runner
 import test_failures
-import test_output
 import test_results
 
 _log = logging.getLogger("webkitpy.layout_tests.layout_package."
                          "dump_render_tree_thread")
 
 
-def _expected_test_output(port, filename):
-    """Returns an expected TestOutput object."""
-    return test_output.TestOutput(port.expected_text(filename),
-                                  port.expected_image(filename),
-                                  port.expected_checksum(filename))
-
-def _process_output(port, options, test_input, test_types, test_args,
-                    test_output, worker_name):
-    """Receives the output from a DumpRenderTree process, subjects it to a
-    number of tests, and returns a list of failure types the test produced.
-
-    Args:
-      port: port-specific hooks
-      options: command line options argument from optparse
-      proc: an active DumpRenderTree process
-      test_input: Object containing the test filename and timeout
-      test_types: list of test types to subject the output to
-      test_args: arguments to be passed to each test
-      test_output: a TestOutput object containing the output of the test
-      worker_name: worker name for logging
-
-    Returns: a TestResult object
-    """
-    failures = []
-    fs = port._filesystem
-
-    if test_output.crash:
-        failures.append(test_failures.FailureCrash())
-    if test_output.timeout:
-        failures.append(test_failures.FailureTimeout())
-
-    test_name = port.relative_test_filename(test_input.filename)
-    if test_output.crash:
-        _log.debug("%s Stacktrace for %s:\n%s" % (worker_name, test_name,
-                                                  test_output.error))
-        filename = fs.join(options.results_directory, test_name)
-        filename = fs.splitext(filename)[0] + "-stack.txt"
-        fs.maybe_make_directory(fs.dirname(filename))
-        fs.write_text_file(filename, test_output.error)
-    elif test_output.error:
-        _log.debug("%s %s output stderr lines:\n%s" % (worker_name, test_name,
-                                                       test_output.error))
-
-    expected_test_output = _expected_test_output(port, test_input.filename)
-
-    # Check the output and save the results.
-    start_time = time.time()
-    time_for_diffs = {}
-    for test_type in test_types:
-        start_diff_time = time.time()
-        new_failures = test_type.compare_output(port, test_input.filename,
-                                                test_args, test_output,
-                                                expected_test_output)
-        # Don't add any more failures if we already have a crash, so we don't
-        # double-report those tests. We do double-report for timeouts since
-        # we still want to see the text and image output.
-        if not test_output.crash:
-            failures.extend(new_failures)
-        time_for_diffs[test_type.__class__.__name__] = (
-            time.time() - start_diff_time)
-
-    total_time_for_all_diffs = time.time() - start_diff_time
-    return test_results.TestResult(test_input.filename, failures, test_output.test_time,
-                                   total_time_for_all_diffs, time_for_diffs)
-
-
 def _pad_timeout(timeout):
     """Returns a safe multiple of the per-test timeout value to use
     to detect hung test threads.
@@ -144,20 +78,6 @@ def _should_fetch_expected_checksum(options):
     return options.pixel_tests and not (options.new_baseline or options.reset_results)
 
 
-def _run_single_test(port, options, test_input, test_types, test_args, driver, worker_name):
-    # FIXME: Pull this into TestShellThread._run().
-
-    # The image hash is used to avoid doing an image dump if the
-    # checksums match, so it should be set to a blank value if we
-    # are generating a new baseline.  (Otherwise, an image from a
-    # previous run will be copied into the baseline."""
-    if _should_fetch_expected_checksum(options):
-        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)
-
-
 class SingleTestThread(threading.Thread):
     """Thread wrapper for running a single test file."""
 
@@ -193,10 +113,9 @@ class SingleTestThread(threading.Thread):
         # in coverage: see http://bitbucket.org/ned/coveragepy/issue/85.
         self._driver = self._port.create_driver(self._worker_number)
         self._driver.start()
-        self._test_result = _run_single_test(self._port, self._options,
-                                             self._test_input, self._test_types,
-                                             self._test_args, self._driver,
-                                             self._name)
+        self._test_result = single_test_runner.run_single_test(
+            self._port, self._options, self._test_input, self._driver,
+            self._name, self._test_types, self._test_args)
         self._driver.stop()
 
     def get_test_result(self):
@@ -514,9 +433,9 @@ class TestShellThread(WatchableThread):
         thread_timeout = _milliseconds_to_seconds(
              _pad_timeout(int(test_input.timeout)))
         self._next_timeout = time.time() + thread_timeout
-        test_result = _run_single_test(self._port, self._options, test_input,
-                                       self._test_types, self._test_args,
-                                       self._driver, self._name)
+        test_result = single_test_runner.run_single_test(
+            self._port, self._options, test_input, self._driver, self._name,
+            self._test_types, self._test_args)
         self._test_results.append(test_result)
         return test_result
 
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py
new file mode 100644 (file)
index 0000000..8592f19
--- /dev/null
@@ -0,0 +1,139 @@
+# Copyright (C) 2011 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.
+
+
+import logging
+import os
+import time
+
+from webkitpy.layout_tests.port import base
+from webkitpy.layout_tests.layout_package import test_failures
+from webkitpy.layout_tests.layout_package.test_results import TestResult
+
+
+_log = logging.getLogger(__name__)
+
+
+def run_single_test(port, options, test_input, driver, worker_name, test_types, test_args):
+    # FIXME: Pull this into TestShellThread._run().
+    runner = SingleTestRunner(options, port, driver, test_input, worker_name, test_types, test_args)
+    return runner.run()
+
+
+class ExpectedDriverOutput:
+    """Groups information about an expected driver output."""
+    def __init__(self, text, image, image_hash):
+        self.text = text
+        self.image = image
+        self.image_hash = image_hash
+
+
+class SingleTestRunner:
+
+    def __init__(self, options, port, driver, test_input, worker_name, test_types, test_args):
+        self._options = options
+        self._port = port
+        self._driver = driver
+        self._filename = test_input.filename
+        self._timeout = test_input.timeout
+        self._worker_name = worker_name
+        self._test_types = test_types
+        self._test_args = test_args
+        self._testname = port.relative_test_filename(test_input.filename)
+
+    def _expected_driver_output(self):
+        return ExpectedDriverOutput(self._port.expected_text(self._filename),
+                                    self._port.expected_image(self._filename),
+                                    self._port.expected_checksum(self._filename))
+
+    def _should_fetch_expected_checksum(self):
+        return (self._options.pixel_tests and
+                not (self._options.new_baseline or self._options.reset_results))
+
+    def _driver_input(self):
+        # The image hash is used to avoid doing an image dump if the
+        # checksums match, so it should be set to a blank value if we
+        # are generating a new baseline.  (Otherwise, an image from a
+        # previous run will be copied into the baseline."""
+        image_hash = None
+        if self._should_fetch_expected_checksum():
+            image_hash = self._port.expected_checksum(self._filename)
+        return base.DriverInput(self._filename, self._timeout, image_hash)
+
+    def run(self):
+        driver_output = self._driver.run_test(self._driver_input())
+        return self._process_output(driver_output)
+
+    def _process_output(self, driver_output):
+        """Receives the output from a DumpRenderTree process, subjects it to a
+        number of tests, and returns a list of failure types the test produced.
+        Args:
+          driver_output: a DriverOutput object containing the output from the driver
+
+        Returns: a TestResult object
+        """
+        failures = []
+        fs = self._port._filesystem
+
+        if driver_output.crash:
+            failures.append(test_failures.FailureCrash())
+        if driver_output.timeout:
+            failures.append(test_failures.FailureTimeout())
+
+        if driver_output.crash:
+            _log.debug("%s Stacktrace for %s:\n%s" % (self._worker_name, self._testname,
+                                                      driver_output.error))
+            stack_filename = fs.join(self._options.results_directory, self._testname)
+            stack_filename = fs.splitext(stack_filename)[0] + "-stack.txt"
+            fs.maybe_make_directory(fs.dirname(stack_filename))
+            fs.write_text_file(stack_filename, driver_output.error)
+        elif driver_output.error:
+            _log.debug("%s %s output stderr lines:\n%s" % (self._worker_name, self._testname,
+                                                           driver_output.error))
+
+        expected_driver_output = self._expected_driver_output()
+
+        # Check the output and save the results.
+        start_time = time.time()
+        time_for_diffs = {}
+        for test_type in self._test_types:
+            start_diff_time = time.time()
+            new_failures = test_type.compare_output(self._port, self._filename,
+                                                    self._test_args, driver_output,
+                                                    expected_driver_output)
+            # Don't add any more failures if we already have a crash, so we don't
+            # double-report those tests. We do double-report for timeouts since
+            # we still want to see the text and image output.
+            if not driver_output.crash:
+                failures.extend(new_failures)
+            time_for_diffs[test_type.__class__.__name__] = (
+                time.time() - start_diff_time)
+
+        total_time_for_all_diffs = time.time() - start_diff_time
+        return TestResult(self._filename, failures, driver_output.test_time,
+                          total_time_for_all_diffs, time_for_diffs)
index 4b027c04d220f5ea964f993f4a28bd3b0940c6c1..0aed1dd0904d71b41c2ae6981235e2bde56f320f 100644 (file)
@@ -41,7 +41,3 @@ 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
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_output.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_output.py
deleted file mode 100644 (file)
index e809be6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# 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.
-
-
-class TestOutput(object):
-    """Groups information about a test output for easy passing of data.
-
-    This is used not only for a actual test output, but also for grouping
-    expected test output.
-    """
-
-    def __init__(self, text, image, image_hash,
-                 crash=None, test_time=None, timeout=None, error=None):
-        """Initializes a TestOutput object.
-
-        Args:
-          text: a text output
-          image: an image output
-          image_hash: a string containing the checksum of the image
-          crash: a boolean indicating whether the driver crashed on the test
-          test_time: a time which the test has taken
-          timeout: a boolean indicating whehter the test timed out
-          error: any unexpected or additional (or error) text output
-        """
-        self.text = text
-        self.image = image
-        self.image_hash = image_hash
-        self.crash = crash
-        self.test_time = test_time
-        self.timeout = timeout
-        self.error = error
index ad1cd7afd511a8c607900f891800cea220ce2311..1f6936f2ed9cc0cf24c86d1e9cf06a7072f3943b 100644 (file)
@@ -821,6 +821,48 @@ class Port(object):
                                      platform)
 
 
+class DriverInput(object):
+    """Holds the input parameters for a driver."""
+
+    def __init__(self, filename, timeout, image_hash):
+        """Initializes a DriverInput object.
+
+        Args:
+          filename: Full path to the test.
+          timeout: Timeout in msecs the driver should use while running the test
+          image_hash: A image checksum which is used to avoid doing an image dump if
+                     the checksums match.
+        """
+        self.filename = filename
+        self.timeout = timeout
+        self.image_hash = image_hash
+
+
+class DriverOutput(object):
+    """Groups information about a output from driver for easy passing of data."""
+
+    def __init__(self, text, image, image_hash,
+                 crash=False, test_time=None, timeout=False, error=''):
+        """Initializes a TestOutput object.
+
+        Args:
+          text: a text output
+          image: an image output
+          image_hash: a string containing the checksum of the image
+          crash: a boolean indicating whether the driver crashed on the test
+          test_time: a time which the test has taken
+          timeout: a boolean indicating whehter the test timed out
+          error: any unexpected or additional (or error) text output
+        """
+        self.text = text
+        self.image = image
+        self.image_hash = image_hash
+        self.crash = crash
+        self.test_time = test_time
+        self.timeout = timeout
+        self.error = error
+
+
 class Driver:
     """Abstract interface for the DumpRenderTree interface."""
 
@@ -835,7 +877,7 @@ class Driver:
         """
         raise NotImplementedError('Driver.__init__')
 
-    def run_test(self, test_input):
+    def run_test(self, driver_input):
         """Run a single test and return the results.
 
         Note that it is okay if a test times out or crashes and leaves
@@ -843,9 +885,9 @@ class Driver:
         are responsible for cleaning up and ensuring things are okay.
 
         Args:
-          test_input: a TestInput object
+          driver_input: a DriverInput object
 
-        Returns a TestOutput object.
+        Returns a DriverOutput object.
         """
         raise NotImplementedError('Driver.run_test')
 
index e15a035cdf4834bb800ae47469b1e3169f1afec1..51e1b93c7911f0679062c1ce368479aab64f8938 100644 (file)
@@ -41,7 +41,6 @@ import webbrowser
 from webkitpy.common.system import executive
 from webkitpy.common.system.path import cygpath
 from webkitpy.layout_tests.layout_package import test_expectations
-from webkitpy.layout_tests.layout_package import test_output
 
 import base
 import http_server
@@ -445,7 +444,7 @@ class ChromiumDriver(base.Driver):
                     raise e
         return self._output_image()
 
-    def run_test(self, test_input):
+    def run_test(self, driver_input):
         output = []
         error = []
         crash = False
@@ -455,9 +454,9 @@ class ChromiumDriver(base.Driver):
 
         start_time = time.time()
 
-        uri = self._port.filename_to_uri(test_input.filename)
-        cmd = self._test_shell_command(uri, test_input.timeout,
-                                       test_input.image_hash)
+        uri = self._port.filename_to_uri(driver_input.filename)
+        cmd = self._test_shell_command(uri, driver_input.timeout,
+                                       driver_input.image_hash)
         (line, crash) = self._write_command_and_read_line(input=cmd)
 
         while not crash and line.rstrip() != "#EOF":
@@ -499,7 +498,7 @@ class ChromiumDriver(base.Driver):
             (line, crash) = self._write_command_and_read_line(input=None)
 
         run_time = time.time() - start_time
-        return test_output.TestOutput(
+        return base.DriverOutput(
             ''.join(output), self._output_image_with_retry(), actual_checksum,
             crash, run_time, timeout, ''.join(error))
 
index 01dea8e5ba32c34c358bb4c66fe9dc487b187be7..6b3bd51c7ddec9b3d0243dbe9b97d40bd32c9571 100644 (file)
@@ -50,8 +50,6 @@ import os
 import sys
 import time
 
-from webkitpy.layout_tests.layout_package import test_output
-
 import base
 import factory
 
@@ -118,18 +116,18 @@ class DryrunDriver(base.Driver):
     def poll(self):
         return None
 
-    def run_test(self, test_input):
+    def run_test(self, driver_input):
         start_time = time.time()
-        text_output = self._port.expected_text(test_input.filename)
+        text_output = self._port.expected_text(driver_input.filename)
 
-        if test_input.image_hash is not None:
-            image = self._port.expected_image(test_input.filename)
-            hash = self._port.expected_checksum(test_input.filename)
+        if driver_input.image_hash is not None:
+            image = self._port.expected_image(driver_input.filename)
+            hash = self._port.expected_checksum(driver_input.filename)
         else:
             image = None
             hash = None
-        return test_output.TestOutput(text_output, image, hash, False,
-                                      time.time() - start_time, False, None)
+        return base.DriverOutput(text_output, image, hash, False,
+                                 time.time() - start_time, False, '')
 
     def start(self):
         pass
index 94ebb5b7d912d028c7664bcd2259d0250093b429..b94c378eb3a3bb086e946fb15dae88e277fc2170 100644 (file)
@@ -35,8 +35,6 @@ import time
 from webkitpy.common.system import filesystem_mock
 from webkitpy.tool import mocktool
 
-from webkitpy.layout_tests.layout_package import test_output
-
 import base
 
 
@@ -384,10 +382,10 @@ class TestDriver(base.Driver):
             raise ValueError('exception from ' + test_name)
         if test.hang:
             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,
-                                      test.error)
+        return base.DriverOutput(test.actual_text, test.actual_image,
+                                 test.actual_checksum, test.crash,
+                                 time.time() - start_time, test.timeout,
+                                 test.error)
 
     def start(self):
         pass
index 0ade755f2037b9390e92cd7ce31542dbd0e44095..446be79f7d6c691ebd87d638966461654d6fc666 100644 (file)
@@ -41,7 +41,6 @@ import time
 import webbrowser
 
 import webkitpy.common.system.ospath as ospath
-import webkitpy.layout_tests.layout_package.test_output as test_output
 import webkitpy.layout_tests.port.base as base
 import webkitpy.layout_tests.port.server_process as server_process
 
@@ -405,15 +404,15 @@ class WebKitDriver(base.Driver):
         return
 
     # FIXME: This function is huge.
-    def run_test(self, test_input):
-        uri = self._port.filename_to_uri(test_input.filename)
+    def run_test(self, driver_input):
+        uri = self._port.filename_to_uri(driver_input.filename)
         if uri.startswith("file:///"):
             command = uri[7:]
         else:
             command = uri
 
-        if test_input.image_hash:
-            command += "'" + test_input.image_hash
+        if driver_input.image_hash:
+            command += "'" + driver_input.image_hash
         command += "\n"
 
         start_time = time.time()
@@ -424,7 +423,7 @@ class WebKitDriver(base.Driver):
         output = str()  # Use a byte array for output, even though it should be UTF-8.
         image = str()
 
-        timeout = int(test_input.timeout) / 1000.0
+        timeout = int(driver_input.timeout) / 1000.0
         deadline = time.time() + timeout
         line = self._server_process.read_line(timeout)
         while (not self._server_process.timed_out
@@ -471,11 +470,11 @@ class WebKitDriver(base.Driver):
         # FIXME: This seems like the wrong section of code to be doing
         # this reset in.
         self._server_process.error = ""
-        return test_output.TestOutput(output, image, actual_image_hash,
-                                      self._server_process.crashed,
-                                      time.time() - start_time,
-                                      self._server_process.timed_out,
-                                      error)
+        return base.DriverOutput(output, image, actual_image_hash,
+                                 self._server_process.crashed,
+                                 time.time() - start_time,
+                                 self._server_process.timed_out,
+                                 error)
 
     def stop(self):
         if self._server_process:
index 44605d2ee81b7b0421415d1acbd2274e5ae0a87b..3494e2160e1139c64e9f9ed87fdaa1aac71c7ce0 100644 (file)
@@ -85,54 +85,54 @@ class ImageDiff(test_type_base.TestTypeBase):
                                              self.FILENAME_SUFFIX_COMPARE)
         return port.diff_image(actual_image, expected_image, diff_filename)
 
-    def compare_output(self, port, filename, test_args, actual_test_output,
-                       expected_test_output):
+    def compare_output(self, port, filename, test_args, actual_driver_output,
+                       expected_driver_output):
         """Implementation of CompareOutput that checks the output image and
         checksum against the expected files from the LayoutTest directory.
         """
         failures = []
 
         # If we didn't produce a hash file, this test must be text-only.
-        if actual_test_output.image_hash is None:
+        if actual_driver_output.image_hash is None:
             return failures
 
         # If we're generating a new baseline, we pass.
         if test_args.new_baseline or test_args.reset_results:
-            self._save_baseline_files(filename, actual_test_output.image,
-                                      actual_test_output.image_hash,
+            self._save_baseline_files(filename, actual_driver_output.image,
+                                      actual_driver_output.image_hash,
                                       test_args.new_baseline)
             return failures
 
-        if not expected_test_output.image:
+        if not expected_driver_output.image:
             # Report a missing expected PNG file.
-            self._copy_image(filename, actual_test_output.image, expected_image=None)
-            self._copy_image_hash(filename, actual_test_output.image_hash,
-                                  expected_test_output.image_hash)
+            self._copy_image(filename, actual_driver_output.image, expected_image=None)
+            self._copy_image_hash(filename, actual_driver_output.image_hash,
+                                  expected_driver_output.image_hash)
             failures.append(test_failures.FailureMissingImage())
             return failures
-        if not expected_test_output.image_hash:
+        if not expected_driver_output.image_hash:
             # Report a missing expected checksum file.
-            self._copy_image(filename, actual_test_output.image,
-                             expected_test_output.image)
-            self._copy_image_hash(filename, actual_test_output.image_hash,
+            self._copy_image(filename, actual_driver_output.image,
+                             expected_driver_output.image)
+            self._copy_image_hash(filename, actual_driver_output.image_hash,
                                   expected_image_hash=None)
             failures.append(test_failures.FailureMissingImageHash())
             return failures
 
-        if actual_test_output.image_hash == expected_test_output.image_hash:
+        if actual_driver_output.image_hash == expected_driver_output.image_hash:
             # Hash matched (no diff needed, okay to return).
             return failures
 
-        self._copy_image(filename, actual_test_output.image,
-                         expected_test_output.image)
-        self._copy_image_hash(filename, actual_test_output.image_hash,
-                              expected_test_output.image_hash)
+        self._copy_image(filename, actual_driver_output.image,
+                         expected_driver_output.image)
+        self._copy_image_hash(filename, actual_driver_output.image_hash,
+                              expected_driver_output.image_hash)
 
         # Even though we only use the result in one codepath below but we
         # still need to call CreateImageDiff for other codepaths.
         images_are_different = self._create_diff_image(port, filename,
-                                                       actual_test_output.image,
-                                                       expected_test_output.image)
+                                                       actual_driver_output.image,
+                                                       expected_driver_output.image)
         if not images_are_different:
             failures.append(test_failures.FailureImageHashIncorrect())
         else:
index ad65016ef254435e54dca19a26cef1609120fe90..33ada5b3b9287c49414e562ac2198ad0fbc9a361 100644 (file)
@@ -139,8 +139,8 @@ class TestTypeBase(object):
             self._port.relative_test_filename(filename))
         return fs.splitext(output_filename)[0] + modifier
 
-    def compare_output(self, port, filename, test_args, actual_test_output,
-                        expected_test_output):
+    def compare_output(self, port, filename, test_args, actual_driver_output,
+                        expected_driver_output):
         """Method that compares the output from the test with the
         expected value.
 
@@ -151,10 +151,10 @@ class TestTypeBase(object):
           filename: absolute filename to test file
           test_args: a TestArguments object holding optional additional
               arguments
-          actual_test_output: a TestOutput object which represents actual test
+          actual_driver_output: a DriverOutput object which represents actual test
               output
-          expected_test_output: a TestOutput object which represents a expected
-              test output
+          expected_driver_output: a ExpectedDriverOutput object which represents a
+              expected test output
 
         Return:
           a list of TestFailure objects, empty if the test passes
index 6debcb7a89f75b746d54ba6876475854b493ec6e..cee5386461101fb929ef34edbb04fdb4c5af210e 100644 (file)
@@ -53,8 +53,8 @@ class TestTextDiff(test_type_base.TestTypeBase):
         # the normalized text expectation files.
         return output.replace("\r\r\n", "\r\n").replace("\r\n", "\n")
 
-    def compare_output(self, port, filename, test_args, actual_test_output,
-                        expected_test_output):
+    def compare_output(self, port, filename, test_args, actual_driver_output,
+                        expected_driver_output):
         """Implementation of CompareOutput that checks the output text against
         the expected text from the LayoutTest directory."""
         failures = []
@@ -64,15 +64,15 @@ class TestTextDiff(test_type_base.TestTypeBase):
             # Although all DumpRenderTree output should be utf-8, we do not
             # ever decode it inside run-webkit-tests.  For some tests
             # DumpRenderTree may not output utf-8 text (e.g.  webarchives).
-            self._save_baseline_data(filename, actual_test_output.text,
+            self._save_baseline_data(filename, actual_driver_output.text,
                                      ".txt", encoding=None,
                                      generate_new_baseline=test_args.new_baseline)
             return failures
 
         # Normalize text to diff
-        actual_text = self._get_normalized_output_text(actual_test_output.text)
+        actual_text = self._get_normalized_output_text(actual_driver_output.text)
         # Assuming expected_text is already normalized.
-        expected_text = expected_test_output.text
+        expected_text = expected_driver_output.text
 
         # Write output files for new tests, too.
         if port.compare_text(actual_text, expected_text):