2011-02-03 Hayato Ito <hayato@chromium.org>
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 06:26:26 +0000 (06:26 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 06:26:26 +0000 (06:26 +0000)
        Reviewed by Eric Seidel.

        [NRWT] Remove TestArgs class, which is wrongly used.

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

        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.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/test_type_base_unittest.py:
        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:

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

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
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/test_type_base_unittest.py
Tools/Scripts/webkitpy/layout_tests/test_types/text_diff.py

index cce80cbf8b48d4949557d5e1265bf345dc965b51..45dbc1ae3a711242601b5bc6b3b1384b2a13e7b7 100644 (file)
@@ -1,3 +1,18 @@
+2011-02-03  Hayato Ito  <hayato@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        [NRWT] Remove TestArgs class, which is wrongly used.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53063
+
+        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py:
+        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.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/test_type_base_unittest.py:
+        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
 2011-02-03  Andrew Wason  <rectalogic@rectalogic.com>
 
         Reviewed by Kenneth Russell.
index 340bce1ac3d323128a6bfbbe95d7861431db84a8..1d1ab97169a71c83ae5cc458ce395f50b7c69736 100644 (file)
@@ -82,7 +82,7 @@ class SingleTestThread(threading.Thread):
     """Thread wrapper for running a single test file."""
 
     def __init__(self, port, options, worker_number, worker_name,
-                 test_input, test_types, test_args):
+                 test_input, test_types):
         """
         Args:
           port: object implementing port-specific hooks
@@ -92,7 +92,6 @@ class SingleTestThread(threading.Thread):
           test_input: Object containing the test filename and timeout
           test_types: A list of TestType objects to run the test output
               against.
-          test_args: A TestArguments object to pass to each TestType.
         """
 
         threading.Thread.__init__(self)
@@ -100,7 +99,6 @@ class SingleTestThread(threading.Thread):
         self._options = options
         self._test_input = test_input
         self._test_types = test_types
-        self._test_args = test_args
         self._driver = None
         self._worker_number = worker_number
         self._name = worker_name
@@ -115,7 +113,7 @@ class SingleTestThread(threading.Thread):
         self._driver.start()
         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._name, self._test_type)
         self._driver.stop()
 
     def get_test_result(self):
@@ -194,7 +192,6 @@ class TestShellThread(WatchableThread):
         for cls in self._get_test_type_classes():
             self._test_types.append(cls(self._port,
                                         self._options.results_directory))
-        self._test_args = self._get_test_args(worker_number)
 
         # Current group of tests we're running.
         self._current_group = None
@@ -203,14 +200,6 @@ class TestShellThread(WatchableThread):
         # Time at which we started running tests from self._current_group.
         self._current_group_start_time = None
 
-    def _get_test_args(self, worker_number):
-        """Returns the tuple of arguments for tests and for DumpRenderTree."""
-        test_args = test_type_base.TestArguments()
-        test_args.new_baseline = self._options.new_baseline
-        test_args.reset_results = self._options.reset_results
-
-        return test_args
-
     def _get_test_type_classes(self):
         classes = [text_diff.TestTextDiff]
         if self._options.pixel_tests:
@@ -389,8 +378,7 @@ class TestShellThread(WatchableThread):
                                   self._worker_number,
                                   self._name,
                                   test_input,
-                                  self._test_types,
-                                  self._test_args)
+                                  self._test_types)
 
         worker.start()
 
@@ -435,7 +423,7 @@ class TestShellThread(WatchableThread):
         self._next_timeout = time.time() + thread_timeout
         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_types)
         self._test_results.append(test_result)
         return test_result
 
index 8592f1958bc12ddffebc7f788aa0a0dd22ec121c..d8463d9a4e832adce9a57e23005d8aaa8642c2cd 100644 (file)
@@ -39,9 +39,9 @@ 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):
+def run_single_test(port, options, test_input, driver, worker_name, test_types):
     # FIXME: Pull this into TestShellThread._run().
-    runner = SingleTestRunner(options, port, driver, test_input, worker_name, test_types, test_args)
+    runner = SingleTestRunner(options, port, driver, test_input, worker_name, test_types)
     return runner.run()
 
 
@@ -55,7 +55,7 @@ class ExpectedDriverOutput:
 
 class SingleTestRunner:
 
-    def __init__(self, options, port, driver, test_input, worker_name, test_types, test_args):
+    def __init__(self, options, port, driver, test_input, worker_name, test_types):
         self._options = options
         self._port = port
         self._driver = driver
@@ -63,7 +63,6 @@ class SingleTestRunner:
         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):
@@ -123,9 +122,9 @@ class SingleTestRunner:
         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)
+            new_failures = test_type.compare_output(
+                self._port, self._filename, self._options, 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.
index 3494e2160e1139c64e9f9ed87fdaa1aac71c7ce0..0e6bc1fb4eb1f2ad7f6150145ed83e0fcad90e35 100644 (file)
@@ -85,7 +85,7 @@ 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_driver_output,
+    def compare_output(self, port, filename, options, actual_driver_output,
                        expected_driver_output):
         """Implementation of CompareOutput that checks the output image and
         checksum against the expected files from the LayoutTest directory.
@@ -97,10 +97,10 @@ class ImageDiff(test_type_base.TestTypeBase):
             return failures
 
         # If we're generating a new baseline, we pass.
-        if test_args.new_baseline or test_args.reset_results:
+        if options.new_baseline or options.reset_results:
             self._save_baseline_files(filename, actual_driver_output.image,
                                       actual_driver_output.image_hash,
-                                      test_args.new_baseline)
+                                      options.new_baseline)
             return failures
 
         if not expected_driver_output.image:
index 33ada5b3b9287c49414e562ac2198ad0fbc9a361..3224ff3cd8ecf2213861de8b5215b9cab2884901 100644 (file)
@@ -28,8 +28,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 """Defines the interface TestTypeBase which other test types inherit from.
-
-Also defines the TestArguments "struct" to pass them additional arguments.
 """
 
 import cgi
@@ -39,21 +37,6 @@ import logging
 _log = logging.getLogger("webkitpy.layout_tests.test_types.test_type_base")
 
 
-class TestArguments(object):
-    """Struct-like wrapper for additional arguments needed by
-    specific tests."""
-    # Whether to save new baseline results.
-    new_baseline = False
-
-    # Path to the actual PNG file generated by pixel tests
-    png_path = None
-
-    # Value of checksum generated by pixel tests.
-    hash = None
-
-    # Whether to use wdiff to generate by-word diffs.
-    wdiff = False
-
 # Python bug workaround.  See the wdiff code in WriteOutputFiles for an
 # explanation.
 _wdiff_available = True
@@ -139,7 +122,7 @@ 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_driver_output,
+    def compare_output(self, port, filename, options, actual_driver_output,
                         expected_driver_output):
         """Method that compares the output from the test with the
         expected value.
@@ -149,8 +132,7 @@ class TestTypeBase(object):
         Args:
           port: object implementing port-specific information and methods
           filename: absolute filename to test file
-          test_args: a TestArguments object holding optional additional
-              arguments
+          options: command line argument object from optparse
           actual_driver_output: a DriverOutput object which represents actual test
               output
           expected_driver_output: a ExpectedDriverOutput object which represents a
index 5dbfcb68c068ae3c6acc0424900f1b4f62c92cf3..7af4d9c73c1971a9e927daa505c93ea8f1a1f8f6 100644 (file)
@@ -40,7 +40,7 @@ class Test(unittest.TestCase):
         test_type = test_type_base.TestTypeBase(None, None)
         self.assertRaises(NotImplementedError, test_type.compare_output,
                           None, "foo.txt", '',
-                          test_type_base.TestArguments(), 'Debug')
+                          {}, 'Debug')
 
 
 if __name__ == '__main__':
index cee5386461101fb929ef34edbb04fdb4c5af210e..8f61de435f9d68055677979f19fadbb4e2eeac62 100644 (file)
@@ -53,20 +53,20 @@ 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_driver_output,
+    def compare_output(self, port, filename, options, actual_driver_output,
                         expected_driver_output):
         """Implementation of CompareOutput that checks the output text against
         the expected text from the LayoutTest directory."""
         failures = []
 
         # If we're generating a new baseline, we pass.
-        if test_args.new_baseline or test_args.reset_results:
+        if options.new_baseline or options.reset_results:
             # 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_driver_output.text,
                                      ".txt", encoding=None,
-                                     generate_new_baseline=test_args.new_baseline)
+                                     generate_new_baseline=options.new_baseline)
             return failures
 
         # Normalize text to diff