Skip to content

Commit

Permalink
[EWS] find-modified-layout-tests step should include .svg tests
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=229577
rdar://82683414

Reviewed by Jonathan Bedard.

Adds .svg to regex and diff conditions.

* Tools/CISupport/ews-build/steps.py:
(FindModifiedLayoutTests): Update regex to look for .svg suffix.
(FindModifiedLayoutTests.run): Finds .svg in test expectation diff.
(FindModifiedLayoutTests.find_test_names_from_patch): Add .svg suffixes to ignore.

* Tools/CISupport/ews-build/steps_unittest.py:
(TestFindModifiedLayoutTests):
(TestFindModifiedLayoutTests.test_success_svg): Added.
(TestFindModifiedLayoutTests.test_ignore_certain_directories_svg): Added.

Canonical link: https://commits.webkit.org/278009@main
  • Loading branch information
briannafan committed Apr 25, 2024
1 parent 2f1dda6 commit 5d45254
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tools/CISupport/ews-build/steps.py
Expand Up @@ -1407,7 +1407,7 @@ class FindModifiedLayoutTests(shell.ShellCommandNewStyle, AnalyzeChange):
name = 'find-modified-layout-tests'
description = 'find-modified-layout tests running'
descriptionDone = 'Found modified layout tests'
RE_LAYOUT_TEST = br'^(\+\+\+).*(LayoutTests.*\.html)'
RE_LAYOUT_TEST = br'^(\+\+\+).*(LayoutTests.*\.html|LayoutTests.*\.svg)'
DIRECTORIES_TO_IGNORE = ['reference', 'reftest', 'resources', 'support', 'script-tests', 'tools']
SUFFIXES_TO_IGNORE = ['-expected', '-expected-mismatch', '-ref', '-notref']
command = ['diff', '-u', 'base-expectations.txt', 'new-expectations.txt']
Expand All @@ -1423,7 +1423,7 @@ def run(self):
rc = yield super().run()
modified_tests = set()
log_text = self.log_observer.getStdout()
match = re.findall(r'\+(.*\.html)', log_text)
match = re.findall(r'\+(.*\.html)', log_text) + re.findall(r'\+(.*\.svg)', log_text)
yield self._addToLog('stdio', '\nLooking for test expectation changes...\n')
for test in match:
yield self._addToLog('stdio', f' LayoutTests/{test}\n')
Expand Down Expand Up @@ -1465,7 +1465,7 @@ def find_test_names_from_patch(self, patch):
for line in patch.splitlines():
match = re.search(self.RE_LAYOUT_TEST, line, re.IGNORECASE)
if match:
if any((suffix + '.html').encode('utf-8') in line for suffix in self.SUFFIXES_TO_IGNORE):
if any(((suffix + '.html').encode('utf-8') or (suffix + '.svg').encode('utf-8')) in line for suffix in self.SUFFIXES_TO_IGNORE):
continue
test_name = match.group(2).decode('utf-8')
if any(directory in test_name.split('/') for directory in self.DIRECTORIES_TO_IGNORE):
Expand Down
25 changes: 25 additions & 0 deletions Tools/CISupport/ews-build/steps_unittest.py
Expand Up @@ -4494,6 +4494,19 @@ def test_success(self):
self.assertEqual(self.getProperty('modified_tests'), ['LayoutTests/http/tests/events/device-orientation-motion-insecure-context.html'])
return rc

def test_success_svg(self):
self.setupStep(FindModifiedLayoutTests())
self.assertEqual(FindModifiedLayoutTests.haltOnFailure, True)
self.assertEqual(FindModifiedLayoutTests.flunkOnFailure, True)
FindModifiedLayoutTests._get_patch = lambda x: b'+++ LayoutTests/svg/filters/feConvolveMatrix-clipped.svg'
self.expectOutcome(result=SUCCESS, state_string='Patch contains relevant changes')
self.expectRemoteCommands(
ExpectShell(workdir='wkdir', logEnviron=True, command=['diff', '-u', 'base-expectations.txt', 'new-expectations.txt']) + 0
)
rc = self.runStep()
self.assertEqual(self.getProperty('modified_tests'), ['LayoutTests/svg/filters/feConvolveMatrix-clipped.svg'])
return rc

def test_ignore_certain_directories(self):
self.setupStep(FindModifiedLayoutTests())
dir_names = ['reference', 'reftest', 'resources', 'support', 'script-tests', 'tools']
Expand All @@ -4506,6 +4519,18 @@ def test_ignore_certain_directories(self):
self.assertEqual(self.getProperty('modified_tests'), None)
return rc

def test_ignore_certain_directories_svg(self):
self.setupStep(FindModifiedLayoutTests())
dir_names = ['reference', 'reftest', 'resources', 'support', 'script-tests', 'tools']
FindModifiedLayoutTests._get_patch = lambda x: f'+++ LayoutTests/reference/test-name.svg'.encode('utf-8')
self.expectOutcome(result=SKIPPED, state_string='Patch doesn\'t have relevant changes')
self.expectRemoteCommands(
ExpectShell(workdir='wkdir', logEnviron=True, command=['diff', '-u', 'base-expectations.txt', 'new-expectations.txt']) + 0
)
rc = self.runStep()
self.assertEqual(self.getProperty('modified_tests'), None)
return rc

def test_ignore_certain_suffixes(self):
self.setupStep(FindModifiedLayoutTests())
FindModifiedLayoutTests._get_patch = lambda x: f'+++ LayoutTests/http/tests/events/device-motion-expected-mismatch.html'.encode('utf-8')
Expand Down

0 comments on commit 5d45254

Please sign in to comment.