Make webkit test output comparison compatible to stress testing.

In stress testing, the output is repeated several times. In this case, it is now compared several times to the actual output.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/18062002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15369 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ee67afee
...@@ -116,16 +116,40 @@ class WebkitTestSuite(testsuite.TestSuite): ...@@ -116,16 +116,40 @@ class WebkitTestSuite(testsuite.TestSuite):
return True return True
file_name = os.path.join(self.root, testpath) + "-expected.txt" file_name = os.path.join(self.root, testpath) + "-expected.txt"
with file(file_name, "r") as expected: with file(file_name, "r") as expected:
def ExpIterator(): expected_lines = expected.readlines()
for line in expected.readlines():
if line.startswith("#") or not line.strip(): continue def ExpIterator():
yield line.strip() for line in expected_lines:
def ActIterator(): if line.startswith("#") or not line.strip(): continue
for line in output.stdout.splitlines(): yield line.strip()
if self._IgnoreLine(line.strip()): continue
yield line.strip() def ActIterator(lines):
for line in lines:
if self._IgnoreLine(line.strip()): continue
yield line.strip()
def ActBlockIterator():
"""Iterates over blocks of actual output lines."""
lines = output.stdout.splitlines()
start_index = 0
found_eqeq = False
for index, line in enumerate(lines):
# If a stress test separator is found:
if line.startswith("=="):
# Iterate over all lines before a separator except the first.
if not found_eqeq:
found_eqeq = True
else:
yield ActIterator(lines[start_index:index])
# The next block of ouput lines starts after the separator.
start_index = index + 1
# Iterate over complete output if no separator was found.
if not found_eqeq:
yield ActIterator(lines)
for act_iterator in ActBlockIterator():
for (expected, actual) in itertools.izip_longest( for (expected, actual) in itertools.izip_longest(
ExpIterator(), ActIterator(), fillvalue=''): ExpIterator(), act_iterator, fillvalue=''):
if expected != actual: if expected != actual:
return True return True
return False return False
......
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