Commit a8bd98b2 authored by qyearsley's avatar qyearsley Committed by Commit bot

Consider any testharness result with >= 1 PASS and no FAIL to be passing.

This changes the rule about testharness test results to make
it less conservative and simpler - so that newlines and text
in the output are OK, and the test is considered passing as
long as there's at least one PASS and no FAIL.

BUG=687492

Review-Url: https://codereview.chromium.org/2668973002
Cr-Commit-Position: refs/heads/master@{#448045}
parent 505d7a79
...@@ -2085,8 +2085,6 @@ crbug.com/660295 inspector/elements/elements-panel-restore-selection-when-node-c ...@@ -2085,8 +2085,6 @@ crbug.com/660295 inspector/elements/elements-panel-restore-selection-when-node-c
# [css-grid] # [css-grid]
crbug.com/659610 fast/css-grid-layout/grid-baseline.html [ Failure ] crbug.com/659610 fast/css-grid-layout/grid-baseline.html [ Failure ]
crbug.com/659610 fast/css-grid-layout/grid-baseline-margins.html [ Failure ] crbug.com/659610 fast/css-grid-layout/grid-baseline-margins.html [ Failure ]
crbug.com/687492 external/csswg-test/css-grid-1/grid-definition/grid-inline-support-grid-template-areas-001.xht [ Failure ]
crbug.com/687492 external/csswg-test/css-grid-1/grid-definition/grid-support-grid-template-areas-001.xht [ Failure ]
crbug.com/511177 external/csswg-test/css-grid-1/grid-layout-properties.html [ Failure ] crbug.com/511177 external/csswg-test/css-grid-1/grid-layout-properties.html [ Failure ]
# TODO(rego): Skipping tests related to "Implied Minimum Size of Grid Items" # TODO(rego): Skipping tests related to "Implied Minimum Size of Grid Items"
# because the test suite needs to be updated after the CSS WG resolves # because the test suite needs to be updated after the CSS WG resolves
......
...@@ -34,47 +34,29 @@ def is_testharness_output(content_text): ...@@ -34,47 +34,29 @@ def is_testharness_output(content_text):
def is_testharness_output_passing(content_text): def is_testharness_output_passing(content_text):
"""Returns whether |content_text| is a passing testharness output.""" """Checks whether |content_text| is a passing testharness output.
# Leading and trailing white spaces are accepted. Under a relatively loose/accepting definition of passing
testharness output, we consider any output with at least one
PASS result and no FAIL result (or TIMEOUT or NOTRUN).
"""
# Leading and trailing whitespace are ignored.
lines = content_text.strip().splitlines() lines = content_text.strip().splitlines()
lines = [line.strip() for line in lines] lines = [line.strip() for line in lines]
# The check is very conservative and rejects any unexpected content in the output. at_least_one_pass = False
previous_line_is_console_line = False
for line in lines:
# There should be no empty lines, unless the empty line follows a console message.
if len(line) == 0:
if previous_line_is_console_line:
continue
else:
return False
# Those lines are expected to be exactly equivalent.
if line == _TESTHARNESSREPORT_HEADER or line == _TESTHARNESSREPORT_FOOTER:
previous_line_is_console_line = False
continue
# Those are expected passing output.
if line.startswith('CONSOLE'):
previous_line_is_console_line = True
continue
for line in lines:
if line.startswith('PASS'): if line.startswith('PASS'):
previous_line_is_console_line = False at_least_one_pass = True
continue continue
# Those are expected failing output.
if (line.startswith('FAIL') or if (line.startswith('FAIL') or
line.startswith('TIMEOUT') or line.startswith('TIMEOUT') or
line.startswith('NOTRUN') or line.startswith('NOTRUN') or
line.startswith('Harness Error. harness_status = ')): line.startswith('Harness Error. harness_status = ')):
return False return False
# Unexpected output should be considered as a failure. return at_least_one_pass
return False
return True
def has_console_errors_or_warnings(content_text): def has_console_errors_or_warnings(content_text):
......
...@@ -9,15 +9,22 @@ from webkitpy.layout_tests.models import testharness_results ...@@ -9,15 +9,22 @@ from webkitpy.layout_tests.models import testharness_results
class TestHarnessResultCheckerTest(unittest.TestCase): class TestHarnessResultCheckerTest(unittest.TestCase):
def test_is_all_pass_testharness_result(self): def test_is_all_pass_testharness_result_positive_cases(self):
self.assertFalse(testharness_results.is_all_pass_testharness_result(
'This is a testharness.js-based test.\n'
'CONSOLE WARNING: This is a warning.\n'
'Test ran to completion.'))
self.assertTrue(testharness_results.is_all_pass_testharness_result( self.assertTrue(testharness_results.is_all_pass_testharness_result(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' PASS: foo bar \n' ' PASS: foo bar \n'
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
self.assertTrue(testharness_results.is_all_pass_testharness_result(
'This is a testharness.js-based test.\n'
'PASS \'grid\' with: grid-template-areas: "a b"\n'
'"c d";\n'
'Harness: the test ran to completion.\n'))
def test_is_all_pass_testharness_result_negative_cases(self):
self.assertFalse(testharness_results.is_all_pass_testharness_result(
'This is a testharness.js-based test.\n'
'CONSOLE WARNING: This is a warning.\n'
'Test ran to completion.'))
self.assertFalse(testharness_results.is_all_pass_testharness_result( self.assertFalse(testharness_results.is_all_pass_testharness_result(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' PASS: foo bar \n' ' PASS: foo bar \n'
...@@ -57,11 +64,12 @@ class TestHarnessResultCheckerTest(unittest.TestCase): ...@@ -57,11 +64,12 @@ class TestHarnessResultCheckerTest(unittest.TestCase):
'Harness: the test ran to completion.')) 'Harness: the test ran to completion.'))
def test_is_testharness_output_passing_empty_content(self): def test_is_testharness_output_passing_empty_content(self):
self.assertTrue(testharness_results.is_testharness_output_passing( self.assertFalse(testharness_results.is_testharness_output_passing(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
def test_is_testharness_output_passing_unexpected_content(self): def test_is_testharness_output_passing_no_pass(self):
# If there are no PASS lines, then the test is not considered to pass.
self.assertFalse(testharness_results.is_testharness_output_passing( self.assertFalse(testharness_results.is_testharness_output_passing(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' \n' ' \n'
...@@ -70,11 +78,13 @@ class TestHarnessResultCheckerTest(unittest.TestCase): ...@@ -70,11 +78,13 @@ class TestHarnessResultCheckerTest(unittest.TestCase):
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' Foo bar \n' ' Foo bar \n'
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
self.assertFalse(testharness_results.is_testharness_output_passing(
def test_is_testharness_output_passing_with_pass_and_random_text(self):
self.assertTrue(testharness_results.is_testharness_output_passing(
'RANDOM TEXT.\n' 'RANDOM TEXT.\n'
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
'PASS: things are fine.\n' 'PASS: things are fine.\n'
'.Harness: the test ran to completion.\n' ' Harness: the test ran to completion.\n'
'\n')) '\n'))
def test_is_testharness_output_passing_basic_examples(self): def test_is_testharness_output_passing_basic_examples(self):
...@@ -97,13 +107,14 @@ class TestHarnessResultCheckerTest(unittest.TestCase): ...@@ -97,13 +107,14 @@ class TestHarnessResultCheckerTest(unittest.TestCase):
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
def test_is_testharness_output_passing_with_console_messages(self): def test_is_testharness_output_passing_with_console_messages(self):
self.assertTrue(testharness_results.is_testharness_output_passing( self.assertFalse(testharness_results.is_testharness_output_passing(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' CONSOLE ERROR: BLAH \n' ' CONSOLE ERROR: BLAH \n'
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
self.assertTrue(testharness_results.is_testharness_output_passing( self.assertTrue(testharness_results.is_testharness_output_passing(
'This is a testharness.js-based test.\n' 'This is a testharness.js-based test.\n'
' CONSOLE WARNING: BLAH \n' ' CONSOLE WARNING: BLAH \n'
'PASS: some passing method\n'
' Harness: the test ran to completion.')) ' Harness: the test ran to completion.'))
self.assertTrue(testharness_results.is_testharness_output_passing( self.assertTrue(testharness_results.is_testharness_output_passing(
'CONSOLE LOG: error.\n' 'CONSOLE LOG: error.\n'
......
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