Commit 7f46fc26 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[wpt-importer] Escape literal asterisks in expectations

Bug: 1036130
Change-Id: Ie6bf04fcdae3af73aa7f412acbfd9cf692ad156d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002747
Commit-Queue: Robert Ma <robertma@chromium.org>
Commit-Queue: Rakib Hasan <rmhasan@google.com>
Auto-Submit: Robert Ma <robertma@chromium.org>
Reviewed-by: default avatarRakib Hasan <rmhasan@google.com>
Cr-Commit-Position: refs/heads/master@{#732546}
parent 93e8d409
...@@ -356,7 +356,8 @@ class WPTExpectationsUpdater(object): ...@@ -356,7 +356,8 @@ class WPTExpectationsUpdater(object):
line_parts = [] line_parts = []
if specifier: if specifier:
line_parts.append('[ %s ]' % specifier) line_parts.append('[ %s ]' % specifier)
line_parts.append(test_name) # Escape literal asterisks for typ (https://crbug.com/1036130).
line_parts.append(test_name.replace('*', '\\*'))
line_parts.append(expectations) line_parts.append(expectations)
# Only add the bug link if the expectations do not include WontFix. # Only add the bug link if the expectations do not include WontFix.
......
...@@ -394,8 +394,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase): ...@@ -394,8 +394,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
}) })
def test_create_line_dict_with_manual_tests(self): def test_create_line_dict_with_manual_tests(self):
# In this example, there are three unexpected results for wpt tests. # In this example, there are two manual tests that should be skipped.
# The new test expectation lines are sorted by test, and then specifier.
updater = WPTExpectationsUpdater(self.mock_host()) updater = WPTExpectationsUpdater(self.mock_host())
results = { results = {
'virtual/foo/external/wpt/test/aa-manual.html': { 'virtual/foo/external/wpt/test/aa-manual.html': {
...@@ -412,6 +411,22 @@ class WPTExpectationsUpdaterTest(LoggingTestCase): ...@@ -412,6 +411,22 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
], ],
}) })
def test_create_line_dict_with_asterisks(self):
# Literal asterisks in test names need to be escaped in expectations.
updater = WPTExpectationsUpdater(self.mock_host())
results = {
'external/wpt/html/dom/interfaces.https.html?exclude=(Document.*|HTML.*)': {
'test-linux-trusty': SimpleTestResult(expected='PASS', actual='FAIL', bug='crbug.com/test'),
},
}
self.assertEqual(
updater.create_line_dict(results),
{
'external/wpt/html/dom/interfaces.https.html?exclude=(Document.*|HTML.*)': [
'crbug.com/test [ Trusty ] external/wpt/html/dom/interfaces.https.html?exclude=(Document.\*|HTML.\*) [ Failure ]',
],
})
def test_normalized_specifiers(self): def test_normalized_specifiers(self):
updater = WPTExpectationsUpdater(self.mock_host()) updater = WPTExpectationsUpdater(self.mock_host())
self.assertEqual(updater.normalized_specifiers('x/y.html', ['test-mac-mac10.10']), ['Mac10.10']) self.assertEqual(updater.normalized_specifiers('x/y.html', ['test-mac-mac10.10']), ['Mac10.10'])
......
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