diff options
9 files changed, 15 insertions, 215 deletions
diff --git a/webkit/tools/layout_tests/layout_package/failure.py b/webkit/tools/layout_tests/layout_package/failure.py index f089478..80b1cbe 100644 --- a/webkit/tools/layout_tests/layout_package/failure.py +++ b/webkit/tools/layout_tests/layout_package/failure.py @@ -50,7 +50,6 @@ class Failure(object): self.platform = "" self.test_path = "" self.text_diff_mismatch = False - self.simplified_text_diff_mismatch = False self.image_mismatch = False self.timeout = False self.crashed = False diff --git a/webkit/tools/layout_tests/layout_package/failure_finder.py b/webkit/tools/layout_tests/layout_package/failure_finder.py index 95dee43..62b6ce1 100644 --- a/webkit/tools/layout_tests/layout_package/failure_finder.py +++ b/webkit/tools/layout_tests/layout_package/failure_finder.py @@ -43,7 +43,6 @@ TEST_EXPECTATIONS_URL = (CHROMIUM_SRC_HOME + # Failure types as found in builder stdio. TEXT_DIFF_MISMATCH = "Text diff mismatch" -SIMPLIFIED_TEXT_DIFF_MISMATCH = "Simplified text diff mismatch" IMAGE_MISMATCH = "Image mismatch" TEST_TIMED_OUT = "Test timed out" TEST_SHELL_CRASHED = "Test shell crashed" @@ -72,7 +71,6 @@ CHROMIUM_FILE_AGE_REGEX = '<br />\s*Modified\s*<em>.*</em> \((.*)\) by' TEST_PATH_REGEX = "[^\s]+?" FAILED_REGEX = ("ERROR (" + TEST_PATH_REGEX + ") failed:\s*" "(" + TEXT_DIFF_MISMATCH + ")?\s*" - "(" + SIMPLIFIED_TEXT_DIFF_MISMATCH +")?\s*" "(" + IMAGE_MISMATCH + ")?\s*" "(" + TEST_TIMED_OUT + ")?\s*" "(" + TEST_SHELL_CRASHED + ")?") @@ -347,10 +345,9 @@ class FailureFinder(object): def _CreateFailureFromMatch(self, match): failure = Failure() failure.text_diff_mismatch = match[1] != '' - failure.simplified_text_diff_mismatch = match[2] != '' - failure.image_mismatch = match[3] != '' - failure.crashed = match[5] != '' - failure.timeout = match[4] != '' + failure.image_mismatch = match[2] != '' + failure.crashed = match[4] != '' + failure.timeout = match[3] != '' failure.test_path = match[0] failure.platform = self.platform return failure @@ -415,7 +412,7 @@ class FailureFinder(object): if self.exclude_wontfix and failure.IsWontFix(): self.failures.remove(failure) continue - if failure.text_diff_mismatch or failure.simplified_text_diff_mismatch: + if failure.text_diff_mismatch: self._PopulateTextFailure(failure, directory, zip) if failure.image_mismatch: self._PopulateImageFailure(failure, directory, zip) diff --git a/webkit/tools/layout_tests/layout_package/failure_finder_test.py b/webkit/tools/layout_tests/layout_package/failure_finder_test.py index 61f5460..72436f3 100644 --- a/webkit/tools/layout_tests/layout_package/failure_finder_test.py +++ b/webkit/tools/layout_tests/layout_package/failure_finder_test.py @@ -11,15 +11,12 @@ from failure_finder import FailureFinder TEST_BUILDER_OUTPUT = """090723 10:38:22 test_shell_thread.py:289 ERROR chrome/fast/forms/textarea-metrics.html failed: Text diff mismatch - Simplified text diff mismatch 090723 10:38:21 test_shell_thread.py:289 ERROR chrome/fast/dom/xss-DENIED-javascript-variations.html failed: Text diff mismatch - Simplified text diff mismatch 090723 10:37:58 test_shell_thread.py:289 ERROR LayoutTests/plugins/bindings-test.html failed: Text diff mismatch - Simplified text diff mismatch ------------------------------------------------------------------------------ Expected to crash, but passed (1): diff --git a/webkit/tools/layout_tests/layout_package/html_generator.py b/webkit/tools/layout_tests/layout_package/html_generator.py index 81e0679..0ccd2ce 100644 --- a/webkit/tools/layout_tests/layout_package/html_generator.py +++ b/webkit/tools/layout_tests/layout_package/html_generator.py @@ -104,11 +104,11 @@ class HTMLGenerator(object): </tr> """ - if failure.text_diff_mismatch or failure.simplified_text_diff_mismatch: - html += self._GenerateTextFailureHTML(failure) + if failure.text_diff_mismatch: + html += self._GenerateTextFailureHTML(failure) if failure.image_mismatch: - html += self._GenerateImageFailureHTML(failure) + html += self._GenerateImageFailureHTML(failure) html += "</table>" html += "</div></td></tr></table><br>" diff --git a/webkit/tools/layout_tests/layout_package/json_results_generator.py b/webkit/tools/layout_tests/layout_package/json_results_generator.py index a9508cc..89c74cf 100644 --- a/webkit/tools/layout_tests/layout_package/json_results_generator.py +++ b/webkit/tools/layout_tests/layout_package/json_results_generator.py @@ -379,8 +379,7 @@ class JSONResultsGenerator: """Returns the worst failure from the list of failures since we can only show one failure per run for each test on the dashboard. """ - has_text_failure = (test_failures.FailureTextMismatch in failures or - test_failures.FailureSimplifiedTextMismatch in failures) + has_text_failure = test_failures.FailureTextMismatch in failures if test_failures.FailureCrash in failures: return "C" diff --git a/webkit/tools/layout_tests/layout_package/test_failures.py b/webkit/tools/layout_tests/layout_package/test_failures.py index 831aa3d..981b1dd 100644 --- a/webkit/tools/layout_tests/layout_package/test_failures.py +++ b/webkit/tools/layout_tests/layout_package/test_failures.py @@ -12,14 +12,13 @@ class FailureSort(object): # order will be sorted alphabetically by Message(). SORT_ORDERS = { 'FailureTextMismatch': 1, - 'FailureSimplifiedTextMismatch': 2, - 'FailureImageHashMismatch': 3, - 'FailureTimeout': 4, - 'FailureCrash': 5, - 'FailureMissingImageHash': 6, - 'FailureMissingImage': 7, - 'FailureMissingResult': 8, - 'FailureImageHashIncorrect': 9, + 'FailureImageHashMismatch': 2, + 'FailureTimeout': 3, + 'FailureCrash': 4, + 'FailureMissingImageHash': 5, + 'FailureMissingImage': 6, + 'FailureMissingResult': 7, + 'FailureImageHashIncorrect': 8, } @staticmethod @@ -145,25 +144,6 @@ class FailureTextMismatch(FailureWithType): return "Text diff mismatch" -class FailureSimplifiedTextMismatch(FailureTextMismatch): - """Simplified text diff output failed. - - The results.html output format is basically the same as regular diff - failures (links to expected, actual and diff text files) so we share code - with the FailureTextMismatch class. - """ - - OUT_FILENAMES = ["-simp-actual.txt", "-simp-expected.txt", - "-simp-diff.txt"] - def __init__(self, test_type): - # Don't run wdiff on simplified text diffs. - FailureTextMismatch.__init__(self, test_type, False) - - @staticmethod - def Message(): - return "Simplified text diff mismatch" - - class FailureMissingImageHash(FailureWithType): """Actual result hash was missing.""" # Chrome doesn't know to display a .checksum file as text, so don't bother diff --git a/webkit/tools/layout_tests/layout_package/test_types_unittest.py b/webkit/tools/layout_tests/layout_package/test_types_unittest.py deleted file mode 100644 index 8442761..0000000 --- a/webkit/tools/layout_tests/layout_package/test_types_unittest.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Unittests that verify that the various test_types (e.g., simplified_diff) -are working.""" - -import difflib -import os -import unittest - -from test_types import simplified_text_diff - -class SimplifiedDiffUnittest(unittest.TestCase): - def testSimplifiedDiff(self): - """Compares actual output with expected output for some test cases. The - simplified diff of these test cases should be the same.""" - test_names = [ - 'null-offset-parent', - 'textAreaLineHeight', - 'form-element-geometry', - ] - differ = simplified_text_diff.SimplifiedTextDiff(None) - for prefix in test_names: - output_filename = os.path.join(self.GetTestDataDir(), - prefix + "-actual-win.txt") - expected_filename = os.path.join(self.GetTestDataDir(), - prefix + "-expected.txt") - output = differ._SimplifyText(open(output_filename).read()) - expected = differ._SimplifyText(open(expected_filename).read()) - - if output != expected: - lst = difflib.unified_diff(expected.splitlines(True), - output.splitlines(True), - 'expected', - 'actual') - for line in lst: - print line.rstrip() - self.failUnlessEqual(output, expected) - - def GetTestDataDir(self): - return os.path.join(os.path.abspath('testdata'), 'difftests') - -if '__main__' == __name__: - unittest.main() - diff --git a/webkit/tools/layout_tests/run_webkit_tests.py b/webkit/tools/layout_tests/run_webkit_tests.py index 3ad6f5e..0df9d21 100755 --- a/webkit/tools/layout_tests/run_webkit_tests.py +++ b/webkit/tools/layout_tests/run_webkit_tests.py @@ -47,7 +47,6 @@ from test_types import fuzzy_image_diff from test_types import image_diff from test_types import test_type_base from test_types import text_diff -from test_types import simplified_text_diff class TestInfo: """Groups information about a test for easy passing of data.""" @@ -1118,7 +1117,6 @@ def main(options, args): shutil.rmtree(cachedir) test_runner.AddTestType(text_diff.TestTextDiff) - test_runner.AddTestType(simplified_text_diff.SimplifiedTextDiff) if not options.no_pixel_tests: test_runner.AddTestType(image_diff.ImageDiff) if options.fuzzy_pixel_tests: diff --git a/webkit/tools/layout_tests/test_types/simplified_text_diff.py b/webkit/tools/layout_tests/test_types/simplified_text_diff.py deleted file mode 100644 index 3767a43..0000000 --- a/webkit/tools/layout_tests/test_types/simplified_text_diff.py +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Compares the text output to the expected text output while ignoring -positions and sizes of elements/text. - -If the output doesn't match, returns FailureSimplifiedTextMismatch and outputs -the diff files into the layout test results directory. -""" - -import difflib -import os.path -import re - -from layout_package import test_failures -from test_types import text_diff - -class SimplifiedTextDiff(text_diff.TestTextDiff): - def _SimplifyText(self, text): - """Removes position and size information from a render tree dump. This - also combines contiguous lines of text together so lines that wrap between - different words match. Returns the simplified text.""" - - # SVG render paths are a little complicated: we want to strip digits after - # a decimal point only for strings that begin with "RenderPath.*data". - def simplify_svg_path(match): - return match.group(1) + re.sub(r"([0-9]*)\.[0-9]{2}", "\\1", match.group(2)) - - # Regular expressions to remove or substitue text. - simplifications = ( - # Ignore TypeError and ReferenceError, V8 has different error text. - (re.compile(r"Message\tTypeError:.*"), 'Message\tTypeError:'), - (re.compile(r"Message\tReferenceError:.*"), 'Message\tReferenceError:'), - - # Ignore uncaught exceptions because V8s error messages are different. - (re.compile(r"CONSOLE MESSAGE: line \d+: .*"), 'CONSOLE MESSAGE: line'), - - # Remove position and size information from text. - (re.compile(r"at \(-?[0-9]+(\.[0-9]+)?,-?[0-9]+(\.[0-9]+)?\) *"), ''), - (re.compile(r"size -?[0-9]+(\.[0-9]+)?x-?[0-9]+(\.[0-9]+)? *"), ''), - (re.compile(r' RTL: "\."'), ': ""'), - (re.compile(r" (RTL|LTR)( override)?: "), ': '), - (re.compile(r"text run width -?[0-9]+: "), ''), - (re.compile(r"\([0-9]+px"), ''), - (re.compile(r"scrollHeight -?[0-9]+"), ''), - (re.compile(r"scrollWidth -?[0-9]+"), ''), - (re.compile(r"scrollX -?[0-9]+"), ''), - (re.compile(r"scrollY -?[0-9]+"), ''), - (re.compile(r"scrolled to [0-9]+,[0-9]+"), 'scrolled to'), - (re.compile(r"caret: position -?[0-9]+"), ''), - - # The file select widget has different text on Mac and Win. - (re.compile(r"Choose File"), "Browse..."), - - # Remove trailing spaces at the end of a line of text. - (re.compile(r' "\n'), '"\n'), - # Remove leading spaces at the beginning of a line of text. - (re.compile(r'(\s+") '), '\\1'), - # Remove empty lines (this only seems to happen with <textareas>) - (re.compile(r'^\s*""\n', re.M), ''), - # Merge text lines together. Lines ending in anything other than a - # hyphen get a space inserted when joined. - (re.compile(r'-"\s+"', re.M), '-'), - (re.compile(r'"\s+"', re.M), ' '), - - # Handle RTL "...Browse" text. The space gets inserted when text lines - # are merged together in the step above. - (re.compile(r"... Browse"), "Browse..."), - - # Some SVG tests inexplicably emit -0.00 rather than 0.00 in the expected results - (re.compile(r"-0\.00"), '0.00'), - - # Remove size information from SVG text - (re.compile(r"(chunk.*width )([0-9]+\.[0-9]{2})"), '\\1'), - - # Remove decimals from SVG paths - (re.compile(r"(RenderPath.*data)(.*)"), simplify_svg_path), - ) - - for regex, subst in simplifications: - text = re.sub(regex, subst, text) - - return text - - def CompareOutput(self, filename, proc, output, test_args, target): - """Implementation of CompareOutput that removes most numbers before - computing the diff. - - This test does not save new baseline results. - - """ - failures = [] - - # If we're generating a new baseline, we pass. - if test_args.new_baseline: - return failures - - # Normalize text to diff - output = self.GetNormalizedOutputText(output) - # The full text diff already gave the result file if requested, so we'll - # ignore the |show_sources| option here. - expected = self.GetNormalizedExpectedText(filename, show_sources=False) - - # Don't bother with the simplified text diff if we match before simplifying - # the text. - if output == expected: - return failures - - # Make the simplified text. - output = self._SimplifyText(output) - expected = self._SimplifyText(expected) - - if output != expected: - # Text doesn't match, write output files. - self.WriteOutputFiles(filename, "-simp", ".txt", output, expected) - - # Add failure to return list, unless it's a new test. - if expected != '': - failures.append(test_failures.FailureSimplifiedTextMismatch(self)) - - return failures - |