Commit 3bba2c48 authored by jamesr@google.com's avatar jamesr@google.com

2010-12-20 Cosmin Truta <ctruta@chromium.org>

        Reviewed by James Robinson.

        new-run-webkit-tests ignores trailing EOL differences in text tests
        https://bugs.webkit.org/show_bug.cgi?id=36983

        Changed the handling of new-line characters within new-run-webkit-tests
        to match old-run-webkit-tests.  Differences in leading and trailing empty
        lines in text expectation files are no longer ignored.

        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/test.py:
        Added unit tests.  Removed old duplicate unit test entries.
        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e9a416f3
2010-12-20 Cosmin Truta <ctruta@chromium.org>
Reviewed by James Robinson.
new-run-webkit-tests ignores trailing EOL differences in text tests
https://bugs.webkit.org/show_bug.cgi?id=36983
Changed the handling of new-line characters within new-run-webkit-tests
to match old-run-webkit-tests. Differences in leading and trailing empty
lines in text expectation files are no longer ignored.
* Scripts/webkitpy/layout_tests/port/base.py:
* Scripts/webkitpy/layout_tests/port/test.py:
Added unit tests. Removed old duplicate unit test entries.
* Scripts/webkitpy/layout_tests/test_types/text_diff.py:
2010-12-20 David Levin <levin@chromium.org>
Reviewed by Shinichiro Hamaji.
......
......@@ -322,7 +322,8 @@ class Port(object):
return self._filesystem.read_binary_file(path)
def expected_text(self, test):
"""Returns the text output we expect the test to produce."""
"""Returns the text output we expect the test to produce.
End-of-line characters are normalized to '\n'."""
# FIXME: DRT output is actually utf-8, but since we don't decode the
# output from DRT (instead treating it as a binary string), we read the
# baselines as a binary string, too.
......@@ -330,7 +331,7 @@ class Port(object):
if not self.path_exists(path):
return ''
text = self._filesystem.read_binary_file(path)
return text.strip("\r\n").replace("\r\n", "\n") + "\n"
return text.replace("\r\n", "\n")
def filename_to_uri(self, filename):
"""Convert a test file (which is an absolute path) to a URI."""
......
......@@ -90,8 +90,6 @@ class TestPort(base.Port):
def __init__(self, **kwargs):
base.Port.__init__(self, **kwargs)
tests = TestList(self)
tests.add('passes/image.html')
tests.add('passes/text.html')
tests.add('failures/expected/checksum.html',
actual_checksum='checksum_fail-checksum')
tests.add('failures/expected/crash.html', crash=True)
......@@ -114,6 +112,15 @@ class TestPort(base.Port):
expected_image=None)
tests.add('failures/expected/missing_text.html',
expected_text=None)
tests.add('failures/expected/newlines_leading.html',
expected_text="\nfoo\n",
actual_text="foo\n")
tests.add('failures/expected/newlines_trailing.html',
expected_text="foo\n\n",
actual_text="foo\n")
tests.add('failures/expected/newlines_with_excess_CR.html',
expected_text="foo\r\r\r\n",
actual_text="foo\n")
tests.add('failures/expected/text.html',
actual_text='text_fail-png')
tests.add('failures/unexpected/crash.html', crash=True)
......@@ -126,7 +133,11 @@ class TestPort(base.Port):
tests.add('passes/error.html', error='stuff going to stderr')
tests.add('passes/image.html')
tests.add('passes/platform_image.html')
tests.add('passes/text.html')
# Text output files contain "\r\n" on Windows. This may be
# helpfully filtered to "\r\r\n" by our Python/Cygwin tooling.
tests.add('passes/text.html',
expected_text='\nfoo\n\n',
actual_text='\nfoo\r\n\r\r\n')
tests.add('websocket/tests/passes/text.html')
self._tests = tests
......@@ -272,6 +283,9 @@ WONTFIX : failures/expected/image_checksum.html = IMAGE
WONTFIX : failures/expected/missing_check.html = MISSING PASS
WONTFIX : failures/expected/missing_image.html = MISSING PASS
WONTFIX : failures/expected/missing_text.html = MISSING PASS
WONTFIX : failures/expected/newlines_leading.html = TEXT
WONTFIX : failures/expected/newlines_trailing.html = TEXT
WONTFIX : failures/expected/newlines_with_excess_CR.html = TEXT
WONTFIX : failures/expected/text.html = TEXT
WONTFIX : failures/expected/timeout.html = TIMEOUT
WONTFIX SKIP : failures/expected/hang.html = TIMEOUT
......
......@@ -49,11 +49,13 @@ _log = logging.getLogger("webkitpy.layout_tests.test_types.text_diff")
class TestTextDiff(test_type_base.TestTypeBase):
def _get_normalized_output_text(self, output):
# Some tests produce "\r\n" explicitly. Our system (Python/Cygwin)
# helpfully changes the "\n" to "\r\n", resulting in "\r\r\n".
norm = output.replace("\r\r\n", "\r\n").strip("\r\n").replace(
"\r\n", "\n")
return norm + "\n"
"""Returns the normalized text output, i.e. the output in which
the end-of-line characters are normalized to "\n"."""
# Running tests on Windows produces "\r\n". The "\n" part is helpfully
# changed to "\r\n" by our system (Python/Cygwin), resulting in
# "\r\r\n", when, in fact, we wanted to compare the text output with
# 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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment