Commit 8e9f65bb authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Handle test names with query strings containing a dot

We are now seeing new WPT test names like:
external/wpt/html/dom/interfaces.https.html?exclude=(Document|Window|HTML.*)
which were not handled properly by Base.output_filename because it would
consider the ".*)" part as the file extension.

Change-Id: I5adc37c37fb677dc360085d395f0213d096f04ef
Reviewed-on: https://chromium-review.googlesource.com/1102182Reviewed-by: default avatarQuinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567703}
parent a2a05c66
......@@ -534,17 +534,17 @@ class Port(object):
Returns:
A string, the output filename.
"""
test_name_root, test_name_ext = self._filesystem.splitext(test_name)
# WPT names might contain query strings, e.g. external/wpt/foo.html?wss,
# in which case we mangle test_name_root (the part of a path before the
# last extension point) to external/wpt/foo_wss, and the output filename
# becomes external/wpt/foo_wss-expected.txt.
index = test_name_ext.find('?')
index = test_name.find('?')
if index != -1:
query_part = test_name_ext[index + 1:]
test_name_root += '_' + self._filesystem.sanitize_filename(query_part)
test_name_root, _ = self._filesystem.splitext(test_name[:index])
query_part = test_name[index:]
test_name_root += self._filesystem.sanitize_filename(query_part)
else:
test_name_root, _ = self._filesystem.splitext(test_name)
return test_name_root + suffix + extension
def expected_baselines(self, test_name, extension, all_baselines=False, match=True):
......
......@@ -99,6 +99,13 @@ class PortTest(LoggingTestCase):
self.assertEqual(port.output_filename(test_file, '-actual', '.png'),
'fast/test_wss_run_type=1-actual.png')
# Test filename with query string containing a dot
test_file = 'fast/test.html?include=HTML.*'
self.assertEqual(port.output_filename(test_file, '-expected', '.txt'),
'fast/test_include=HTML._-expected.txt')
self.assertEqual(port.output_filename(test_file, '-actual', '.png'),
'fast/test_include=HTML._-actual.png')
def test_expected_baselines(self):
port = self.make_port(port_name='foo')
port.FALLBACK_PATHS = {'': ['foo']}
......
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