Commit 78a47b96 authored by dpranke@chromium.org's avatar dpranke@chromium.org

2011-04-08 Dirk Pranke <dpranke@chromium.org>

        Reviewed by Ojan Vafai.

        new-run-webkit-tests: clean up the way we handle missing files,
        to be consistent. With this change, the Port.expected_X() and
        Driver.run_test() routines should return None if there is no
        output, not ''.

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

        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/chromium.py:
        * Scripts/webkitpy/layout_tests/port/webkit.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e4d9ce14
2011-04-08 Dirk Pranke <dpranke@chromium.org>
Reviewed by Ojan Vafai.
new-run-webkit-tests: clean up the way we handle missing files,
to be consistent. With this change, the Port.expected_X() and
Driver.run_test() routines should return None if there is no
output, not ''.
https://bugs.webkit.org/show_bug.cgi?id=58101
* Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
* Scripts/webkitpy/layout_tests/port/base.py:
* Scripts/webkitpy/layout_tests/port/chromium.py:
* Scripts/webkitpy/layout_tests/port/webkit.py:
2011-04-08 Pere Martir <pere.martir4@gmail.com>
Reviewed by Adam Roben.
......
......@@ -222,13 +222,12 @@ class SingleTestRunner:
def _compare_text(self, actual_text, expected_text):
failures = []
if self._port.compare_text(self._get_normalized_output_text(actual_text),
# Assuming expected_text is already normalized.
expected_text):
if expected_text == '':
failures.append(test_failures.FailureMissingResult())
else:
failures.append(test_failures.FailureTextMismatch())
if (expected_text and actual_text and
# Assuming expected_text is already normalized.
self._port.compare_text(self._get_normalized_output_text(actual_text), expected_text)):
failures.append(test_failures.FailureTextMismatch())
elif actual_text and not expected_text:
failures.append(test_failures.FailureMissingResult())
return failures
def _get_normalized_output_text(self, output):
......
......@@ -352,14 +352,15 @@ 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, or None
if we don't expect there to be any text output.
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.
path = self.expected_filename(test, '.txt')
if not self.path_exists(path):
return ''
return None
text = self._filesystem.read_binary_file(path)
return text.replace("\r\n", "\n")
......
......@@ -425,7 +425,7 @@ class ChromiumDriver(base.Driver):
if png_path and self._port._filesystem.exists(png_path):
return self._port._filesystem.read_binary_file(png_path)
else:
return ''
return None
def _output_image_with_retry(self):
# Retry a few more times because open() sometimes fails on Windows,
......@@ -502,8 +502,11 @@ class ChromiumDriver(base.Driver):
run_time = time.time() - start_time
output_image = self._output_image_with_retry()
assert output_image is not None
return base.DriverOutput(''.join(output), output_image, actual_checksum,
text = ''.join(output)
if not text:
text = None
return base.DriverOutput(text, output_image, actual_checksum,
crash, run_time, timeout, ''.join(error))
def stop(self):
......
......@@ -409,7 +409,8 @@ class WebKitDriver(base.Driver):
have_seen_content_type = False
actual_image_hash = None
output = str() # Use a byte array for output, even though it should be UTF-8.
image = str()
text = None
image = None
timeout = int(driver_input.timeout) / 1000.0
deadline = time.time() + timeout
......@@ -429,6 +430,9 @@ class WebKitDriver(base.Driver):
line = self._server_process.read_line(timeout)
timeout = deadline - time.time()
if output:
text = output
# Now read a second block of text for the optional image data
remaining_length = -1
HASH_HEADER = 'ActualHash: '
......@@ -458,7 +462,7 @@ class WebKitDriver(base.Driver):
# FIXME: This seems like the wrong section of code to be doing
# this reset in.
self._server_process.error = ""
return base.DriverOutput(output, image, actual_image_hash,
return base.DriverOutput(text, image, actual_image_hash,
self._server_process.crashed,
time.time() - start_time,
self._server_process.timed_out,
......
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