2010-12-02 Hayato Ito <hayato@chromium.org>
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Dec 2010 02:29:13 +0000 (02:29 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Dec 2010 02:29:13 +0000 (02:29 +0000)
        Reviewed by Eric Seidel.

        Refactor test_types's compare_output() method so that it takes a
        TestInput object.

        compare_output() will need additional information included in a TestInput
        object to support reftests. This change is a pre-requirement of that.

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

        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.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@73228 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base_unittest.py
WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py

index 42fc713c52c798f94bb38c851ec55bed0ca046ac..d675077c06c3788381463061f46d3dd5278fc7b4 100644 (file)
@@ -1,3 +1,21 @@
+2010-12-02  Hayato Ito  <hayato@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Refactor test_types's compare_output() method so that it takes a
+        TestInput object.
+
+        compare_output() will need additional information included in a TestInput
+        object to support reftests. This change is a pre-requirement of that.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50362
+
+        * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.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:
+
 2010-12-02  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Anders Carlsson.
index 880cc60a882ccbf6325c212ef4900c5d9ec14fd3..8c5bc11bce3fe449ca1dd7a1cd905997095fd54e 100644 (file)
@@ -386,19 +386,20 @@ class TestShellThread(WatchableThread):
             test_input.image_hash = self._port.expected_checksum(
                 test_input.filename)
         test_output = driver.run_test(test_input)
-        return self._process_output(test_input.filename, test_output)
+        return self._process_output(test_input, test_output)
 
-    def _process_output(self, test_filename, test_output):
+    def _process_output(self, test_input, test_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:
-        test_filename: full path to the test in question.
+        test_input: a TestInput object
         test_output: a TestOutput object containing the output of the test
 
         Returns: a TestResult object
         """
         failures = []
+        test_filename = test_input.filename
 
         if test_output.crash:
             failures.append(test_failures.FailureCrash())
@@ -426,7 +427,7 @@ class TestShellThread(WatchableThread):
         for test_type in self._test_types:
             start_diff_time = time.time()
             new_failures = test_type.compare_output(self._port,
-                                                    test_filename,
+                                                    test_input,
                                                     self._test_args,
                                                     test_output,
                                                     expected_test_output)
index da466c8a17cd1ce27ecfbf95b102f8f578e3518b..f1855f59930afa9d18fdce1520f8ba9638672709 100644 (file)
@@ -90,12 +90,13 @@ 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,
+    def compare_output(self, port, test_input, test_args, actual_test_output,
                        expected_test_output):
         """Implementation of CompareOutput that checks the output image and
         checksum against the expected files from the LayoutTest directory.
         """
         failures = []
+        filename = test_input.filename
 
         # If we didn't produce a hash file, this test must be text-only.
         if actual_test_output.image_hash is None:
index 4b96b3abfe1b59512281150fd6feea0603544a93..ada6e61cf5bf9d014ab6880bbf06acdc9268bf05 100644 (file)
@@ -140,7 +140,7 @@ class TestTypeBase(object):
             self._port.relative_test_filename(filename))
         return os.path.splitext(output_filename)[0] + modifier
 
-    def compare_output(self, port, filename, test_args, actual_test_output,
+    def compare_output(self, port, test_input, test_args, actual_test_output,
                         expected_test_output):
         """Method that compares the output from the test with the
         expected value.
@@ -149,7 +149,7 @@ class TestTypeBase(object):
 
         Args:
           port: object implementing port-specific information and methods
-          filename: absolute filename to test file
+          test_input: a TestInput object
           test_args: a TestArguments object holding optional additional
               arguments
           actual_test_output: a TestOutput object which represents actual test
index 5dbfcb68c068ae3c6acc0424900f1b4f62c92cf3..2e94f0e16f3e1fb9efff116d3999f10959fc87a2 100644 (file)
@@ -39,8 +39,7 @@ class Test(unittest.TestCase):
     def test_compare_output_notimplemented(self):
         test_type = test_type_base.TestTypeBase(None, None)
         self.assertRaises(NotImplementedError, test_type.compare_output,
-                          None, "foo.txt", '',
-                          test_type_base.TestArguments(), 'Debug')
+                          None, None, test_type_base.TestArguments(), None, None)
 
 
 if __name__ == '__main__':
index ca4b17d7e1a39fcb0a86eac02707ee01cbf95766..f463c74b2a3f5e806f4b9470f826cac17505154b 100644 (file)
@@ -55,7 +55,7 @@ class TestTextDiff(test_type_base.TestTypeBase):
              "\r\n", "\n")
         return norm + "\n"
 
-    def compare_output(self, port, filename, test_args, actual_test_output,
+    def compare_output(self, port, test_input, test_args, actual_test_output,
                         expected_test_output):
         """Implementation of CompareOutput that checks the output text against
         the expected text from the LayoutTest directory."""
@@ -66,7 +66,7 @@ class TestTextDiff(test_type_base.TestTypeBase):
             # Although all test_shell/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(test_input.filename, actual_test_output.text,
                                      ".txt", encoding=None,
                                      generate_new_baseline=test_args.new_baseline)
             return failures
@@ -79,7 +79,7 @@ class TestTextDiff(test_type_base.TestTypeBase):
         # Write output files for new tests, too.
         if port.compare_text(actual_text, expected_text):
             # Text doesn't match, write output files.
-            self.write_output_files(filename, ".txt", actual_text,
+            self.write_output_files(test_input.filename, ".txt", actual_text,
                                     expected_text, encoding=None,
                                     print_text_diffs=True)