Title: [285496] trunk/Tools
Revision
285496
Author
[email protected]
Date
2021-11-09 06:40:32 -0800 (Tue, 09 Nov 2021)

Log Message

[EWS] Allow the optimization of running only the subset of failed tests on run-layout-tests-without-patch also for patches modifying the TestExpectations files
https://bugs.webkit.org/show_bug.cgi?id=231265

Reviewed by Alexey Proskuryakov.

On r274475 an optimization was applied to run-layout-tests-without-patch to only
run the subset of tests that failed with patch instead of the whole layout tests.
But this optimization had a corner case where it couldn't be applied.
It seems that we can still apply this optimization in this corner case if we pass
'--skipped=always' to run-webkit-tests so that Skipped tests are not run even if
those are specified as arguments on the command-line.

* CISupport/ews-build/steps.py:
(RunWebKitTests.setLayoutTestCommand):
(RunWebKitTestsWithoutPatch.setLayoutTestCommand):
* CISupport/ews-build/steps_unittest.py:
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(RunTest.test_ews_corner_case_failing_test):
(RunTest):
(RunTest.test_ews_corner_case_failing_directory):
(RunTest.test_ews_corner_case_skipped_test):
(RunTest.test_ews_corner_case_skipped_directory):
* Scripts/webkitpy/port/test.py:

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/steps.py (285495 => 285496)


--- trunk/Tools/CISupport/ews-build/steps.py	2021-11-09 14:35:50 UTC (rev 285495)
+++ trunk/Tools/CISupport/ews-build/steps.py	2021-11-09 14:40:32 UTC (rev 285496)
@@ -2218,31 +2218,6 @@
         if self.ENABLE_GUARD_MALLOC:
             self.setCommand(self.command + ['--guard-malloc'])
 
-        if self.name == 'run-layout-tests-without-patch':
-            # In order to speed up testing, on the step that retries running the layout tests without patch
-            # only run the subset of tests that failed on the previous steps.
-            # But only do that if the previous steps didn't exceed the test failure limit and the patch doesn't
-            # modify the TestExpectations files (there are corner cases where we can't guarantee the correctnes
-            # of this optimization if the patch modifies the TestExpectations files, for example, if the patch
-            # removes skipped tests but those tests still fail).
-            first_results_did_exceed_test_failure_limit = self.getProperty('first_results_exceed_failure_limit', False)
-            second_results_did_exceed_test_failure_limit = self.getProperty('second_results_exceed_failure_limit', False)
-            if not first_results_did_exceed_test_failure_limit and not second_results_did_exceed_test_failure_limit:
-                patch_modifies_expectation_files = False
-                patch = self._get_patch()
-                if patch:
-                    for line in patch.splitlines():
-                        line = line.strip()
-                        # patch is stored by buildbot as bytes: https://github.com/buildbot/buildbot/issues/5812#issuecomment-790175979
-                        if (b'LayoutTests/' in line and b'TestExpectations' in line) and (line.startswith(b'---') or line.startswith(b'+++')):
-                            patch_modifies_expectation_files = True
-                            break
-                if not patch_modifies_expectation_files:
-                    first_results_failing_tests = set(self.getProperty('first_run_failures', set()))
-                    second_results_failing_tests = set(self.getProperty('second_run_failures', set()))
-                    list_retry_tests = sorted(first_results_failing_tests.union(second_results_failing_tests))
-                    self.setCommand(self.command + list_retry_tests)
-
     def start(self):
         self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
         self.addLogObserver('stdio', self.log_observer)
@@ -2498,7 +2473,26 @@
                 self._addToLog(self.test_failures_log_name, '\n'.join(clean_tree_results.failing_tests))
         self._parseRunWebKitTestsOutput(logText)
 
+    def setLayoutTestCommand(self):
+        super(RunWebKitTestsWithoutPatch, self).setLayoutTestCommand()
+        # In order to speed up testing, on the step that retries running the layout tests without patch
+        # only run the subset of tests that failed on the previous steps.
+        # But only do that if the previous steps didn't exceed the test failure limit
+        # Also pass '--skipped=always' to avoid running a test that is skipped on the clean tree and that
+        # the patch removed from the TestExpectations file meanwhile it still fails with the patch (so
+        # it is passed as an argument on the command-line)
+        # The flag '--skip-failing-tests' that is passed by default (in combination with '--skipped=always')
+        # avoids running tests marked as failing on the Expectation files even when those are passed as arguments.
+        first_results_did_exceed_test_failure_limit = self.getProperty('first_results_exceed_failure_limit', False)
+        second_results_did_exceed_test_failure_limit = self.getProperty('second_results_exceed_failure_limit', False)
+        if not first_results_did_exceed_test_failure_limit and not second_results_did_exceed_test_failure_limit:
+            first_results_failing_tests = set(self.getProperty('first_run_failures', set()))
+            second_results_failing_tests = set(self.getProperty('second_run_failures', set()))
+            list_failed_tests_with_patch = sorted(first_results_failing_tests.union(second_results_failing_tests))
+            if list_failed_tests_with_patch:
+                self.setCommand(self.command + ['--skipped=always'] + list_failed_tests_with_patch)
 
+
 class AnalyzeLayoutTestsResults(buildstep.BuildStep, BugzillaMixin):
     name = 'analyze-layout-tests-results'
     description = ['analyze-layout-test-results']

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (285495 => 285496)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-11-09 14:35:50 UTC (rev 285495)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2021-11-09 14:40:32 UTC (rev 285496)
@@ -2152,12 +2152,12 @@
         self.expectOutcome(result=SUCCESS, state_string='layout-tests')
         return self.runStep()
 
-    def test_success_retry_only_subset(self):
+    def test_run_subtest_tests_success(self):
         self.configureStep()
         self.setProperty('fullPlatform', 'ios-simulator')
         self.setProperty('configuration', 'release')
-        self.setProperty('first_run_failures', ['test1', 'test2', 'test3'])
-        self.setProperty('second_run_failures', ['test1', 'test3', 'test4'])
+        self.setProperty('first_run_failures', ['test1.html', 'test2.html', 'test3.html'])
+        self.setProperty('second_run_failures', ['test3.html', 'test4.html', 'test5.html'])
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         logfiles={'json': self.jsonFileName},
@@ -2173,7 +2173,8 @@
                                  '--debug-rwt-logging',
                                  '--exit-after-n-failures', '30',
                                  '--skip-failing-tests',
-                                 'test1', 'test2', 'test3', 'test4'],
+                                 '--skipped=always',
+                                 'test1.html', 'test2.html', 'test3.html', 'test4.html', 'test5.html'],
                         )
             + 0,
         )
@@ -2180,13 +2181,12 @@
         self.expectOutcome(result=SUCCESS, state_string='layout-tests')
         return self.runStep()
 
-    def test_success_retry_only_subset_limit_exceeded(self):
+    def test_run_subtest_tests_removes_skipped_that_fails(self):
         self.configureStep()
         self.setProperty('fullPlatform', 'ios-simulator')
         self.setProperty('configuration', 'release')
-        self.setProperty('first_run_failures', ['test1', 'test2', 'test3'])
-        self.setProperty('second_results_exceed_failure_limit', True)
-        self.setProperty('second_run_failures', ['test{}'.format(i) for i in range(0, 30)])
+        self.setProperty('first_run_failures', ['test-was-skipped-patch-removed-expectation-but-still-fails.html'])
+        self.setProperty('second_run_failures', ['test-was-skipped-patch-removed-expectation-but-still-fails.html'])
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         logfiles={'json': self.jsonFileName},
@@ -2201,7 +2201,9 @@
                                  '--results-directory', 'layout-test-results',
                                  '--debug-rwt-logging',
                                  '--exit-after-n-failures', '30',
-                                 '--skip-failing-tests'],
+                                 '--skip-failing-tests',
+                                 '--skipped=always',
+                                 'test-was-skipped-patch-removed-expectation-but-still-fails.html'],
                         )
             + 0,
         )
@@ -2208,13 +2210,12 @@
         self.expectOutcome(result=SUCCESS, state_string='layout-tests')
         return self.runStep()
 
-    def test_success_retry_only_subset_patch_no_modifies_expectations(self):
+    def test_run_subtest_tests_fail(self):
         self.configureStep()
         self.setProperty('fullPlatform', 'ios-simulator')
         self.setProperty('configuration', 'release')
-        self.setProperty('first_run_failures', ['test1', 'test2', 'test3'])
-        self.setProperty('second_run_failures', ['test1', 'test3', 'test4'])
-        RunWebKitTests._get_patch = lambda x: b'+++ Tools/ChangeLog\n+++ Tools/WebKitTestRunner/Options.cpp\n'
+        self.setProperty('first_run_failures', ['test-fails-withpatch1.html', 'test-pre-existent-failure1.html'])
+        self.setProperty('second_run_failures', ['test-fails-withpatch2.html', 'test-pre-existent-failure2.html'])
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         logfiles={'json': self.jsonFileName},
@@ -2230,20 +2231,22 @@
                                  '--debug-rwt-logging',
                                  '--exit-after-n-failures', '30',
                                  '--skip-failing-tests',
-                                 'test1', 'test2', 'test3', 'test4'],
+                                 '--skipped=always',
+                                 'test-fails-withpatch1.html', 'test-fails-withpatch2.html', 'test-pre-existent-failure1.html', 'test-pre-existent-failure2.html'],
                         )
-            + 0,
+            + ExpectShell.log('stdio', stdout='2 failures found.')
+            + 2,
         )
-        self.expectOutcome(result=SUCCESS, state_string='layout-tests')
+        self.expectOutcome(result=FAILURE, state_string='layout-tests (failure)')
         return self.runStep()
 
-    def test_success_retry_only_subset_patch_modifies_expectations(self):
+    def test_run_subtest_tests_limit_exceeded(self):
         self.configureStep()
         self.setProperty('fullPlatform', 'ios-simulator')
         self.setProperty('configuration', 'release')
-        self.setProperty('first_run_failures', ['test1', 'test2', 'test3'])
-        self.setProperty('second_run_failures', ['test1', 'test3', 'test4'])
-        RunWebKitTests._get_patch = lambda x: b'+++ LayoutTests/Changelog\n+++ LayoutTests/platform/gtk/TestExpectations\n'
+        self.setProperty('first_run_failures', ['test1.html', 'test2.html', 'test3.html'])
+        self.setProperty('second_results_exceed_failure_limit', True)
+        self.setProperty('second_run_failures', ['test{}.html'.format(i) for i in range(0, 30)])
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
                         logfiles={'json': self.jsonFileName},
@@ -2542,7 +2545,16 @@
         self.expectOutcome(result=FAILURE, state_string='Found unexpected failure with patch (failure)')
         return self.runStep()
 
+    def test_patch_removes_skipped_test_that_fails(self):
+        self.configureStep()
+        self.setProperty('first_run_failures', ['test-was-skipped-patch-removed-expectation-but-still-fails.html'])
+        self.setProperty('second_run_failures', ['test-was-skipped-patch-removed-expectation-but-still-fails.html'])
+        self.setProperty('clean_tree_run_failures', [])
+        self.setProperty('clean_tree_run_status', SUCCESS)
+        self.expectOutcome(result=FAILURE, state_string='Found 1 new test failure: test-was-skipped-patch-removed-expectation-but-still-fails.html (failure)')
+        return self.runStep()
 
+
 class TestCheckOutSpecificRevision(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
         self.longMessage = True

Modified: trunk/Tools/ChangeLog (285495 => 285496)


--- trunk/Tools/ChangeLog	2021-11-09 14:35:50 UTC (rev 285495)
+++ trunk/Tools/ChangeLog	2021-11-09 14:40:32 UTC (rev 285496)
@@ -1,3 +1,29 @@
+2021-11-09  Carlos Alberto Lopez Perez  <[email protected]>
+
+        [EWS] Allow the optimization of running only the subset of failed tests on run-layout-tests-without-patch also for patches modifying the TestExpectations files
+        https://bugs.webkit.org/show_bug.cgi?id=231265
+
+        Reviewed by Alexey Proskuryakov.
+
+        On r274475 an optimization was applied to run-layout-tests-without-patch to only
+        run the subset of tests that failed with patch instead of the whole layout tests.
+        But this optimization had a corner case where it couldn't be applied.
+        It seems that we can still apply this optimization in this corner case if we pass
+        '--skipped=always' to run-webkit-tests so that Skipped tests are not run even if
+        those are specified as arguments on the command-line.
+
+        * CISupport/ews-build/steps.py:
+        (RunWebKitTests.setLayoutTestCommand):
+        (RunWebKitTestsWithoutPatch.setLayoutTestCommand):
+        * CISupport/ews-build/steps_unittest.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+        (RunTest.test_ews_corner_case_failing_test):
+        (RunTest):
+        (RunTest.test_ews_corner_case_failing_directory):
+        (RunTest.test_ews_corner_case_skipped_test):
+        (RunTest.test_ews_corner_case_skipped_directory):
+        * Scripts/webkitpy/port/test.py:
+
 2021-11-08  Myles C. Maxfield  <[email protected]>
 
         Make WebGPU.xcodeproj and WebGPU.framework

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (285495 => 285496)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2021-11-09 14:35:50 UTC (rev 285495)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2021-11-09 14:40:32 UTC (rev 285496)
@@ -349,6 +349,39 @@
         # Now check that we don't run anything.
         self.assertEqual(get_tests_run(['--skipped=always', 'passes/skipped/skip.html']), [])
 
+    def test_ews_corner_case_failing_test(self):
+        # We should skip running tests marked as failures (or flakies) when passing '--skip-failing-tests'
+        self.assertEqual(get_tests_run(['--skip-failing-tests', 'failures/expected']), [])
+        # But if we specify the name of the individual tests, then those tests should run
+        list_of_tests_failing = ['failures/expected/timeout.html', 'failures/expected/text.html', 'failures/expected/crash.html', 'failures/expected/missing_image.html']
+        self.assertEqual(get_tests_run(['--skip-failing-tests'] + list_of_tests_failing), list_of_tests_failing)
+        # Unless we specify also '--skipped=always', then they should be skipped even when we list them individually on the command line
+        self.assertEqual(get_tests_run(['--skip-failing-tests', '--skipped=always'] + list_of_tests_failing), [])
+
+    def test_ews_corner_case_failing_directory(self):
+        # When a whole directory is is marked as failing (or flaky), then the tests inside should not run if we specify the name of the directory and we pass '--skip-failing-tests'
+        self.assertEqual(get_tests_run(['--skip-failing-tests', 'corner-cases/ews/directory-flaky']), [])
+        # But if we specify on the command-line the name of individual tests inside that directory the tests should run (even with '--skip-failing-tests')
+        list_of_tests_failing = ['corner-cases/ews/directory-skipped/failure.html', 'corner-cases/ews/directory-skipped/timeout.html']
+        self.assertEqual(get_tests_run(['--no-retry-failures', '--skip-failing-tests'] + list_of_tests_failing), list_of_tests_failing)
+        # Unless we specify also '--skipped=always' (in combination with '--skip-failing-tests'), then they should be skipped even when we list them individually on the command line
+        self.assertEqual(get_tests_run(['--no-retry-failures',  '--skip-failing-tests', '--skipped=always'] + list_of_tests_failing), [])
+
+    def test_ews_corner_case_skipped_test(self):
+        # When we specify on the command line the name of a test skipped this test should run
+        self.assertEqual(get_tests_run(['passes/skipped/skip.html']), ['passes/skipped/skip.html'])
+        # Unless we specify also '--skipped=always', then it should be skipped even when we list it on the command line
+        self.assertEqual(get_tests_run(['--skipped=always', 'passes/skipped/skip.html']), [])
+
+    def test_ews_corner_case_skipped_directory(self):
+        # When a whole directory is skipped, then the tests inside should not run if we specify the name of the directory
+        self.assertEqual(get_tests_run(['corner-cases/ews/directory-skipped']), [])
+        # But if we specify on the command-line the name of individual tests inside that directory the tests should run
+        list_of_tests_failing = ['corner-cases/ews/directory-skipped/failure.html', 'corner-cases/ews/directory-skipped/timeout.html']
+        self.assertEqual(get_tests_run(['--no-retry-failures'] + list_of_tests_failing), list_of_tests_failing)
+        # Unless we specify also '--skipped=always', then they should be skipped even when we list them individually on the command line
+        self.assertEqual(get_tests_run(['--no-retry-failures', '--skipped=always'] + list_of_tests_failing), [])
+
     def test_iterations(self):
         tests_to_run = ['passes/image.html', 'passes/text.html']
         tests_run = get_tests_run(['--iterations', '2'] + tests_to_run)

Modified: trunk/Tools/Scripts/webkitpy/port/test.py (285495 => 285496)


--- trunk/Tools/Scripts/webkitpy/port/test.py	2021-11-09 14:35:50 UTC (rev 285495)
+++ trunk/Tools/Scripts/webkitpy/port/test.py	2021-11-09 14:40:32 UTC (rev 285496)
@@ -106,8 +106,8 @@
 #
 # These numbers may need to be updated whenever we add or delete tests.
 #
-TOTAL_TESTS = 71
-TOTAL_SKIPS = 9
+TOTAL_TESTS = 75
+TOTAL_SKIPS = 11
 TOTAL_RETRIES = 11
 
 UNEXPECTED_PASSES = 6
@@ -260,6 +260,11 @@
         actual_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
         expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-png')
 
+    tests.add('corner-cases/ews/directory-skipped/failure.html', expected_text='ok-txt', actual_text='text_fail-txt')
+    tests.add('corner-cases/ews/directory-skipped/timeout.html', timeout=True)
+    tests.add('corner-cases/ews/directory-flaky/failure.html', expected_text='ok-txt', actual_text='text_fail-txt')
+    tests.add('corner-cases/ews/directory-flaky/timeout.html', timeout=True)
+
     return tests
 
 
@@ -304,6 +309,8 @@
 Bug(test) failures/expected/exception.html [ WontFix ]
 Bug(test) failures/unexpected/pass.html [ Failure ]
 Bug(test) passes/skipped/skip.html [ Skip ]
+Bug(test) corner-cases/ews/directory-skipped [ Skip ]
+Bug(test) corner-cases/ews/directory-flaky [ Pass Timeout Failure ]
 """)
 
     # FIXME: This test was only being ignored because of missing a leading '/'.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to