Changeset 247433 in webkit


Ignore:
Timestamp:
Jul 15, 2019 9:54:28 AM (5 years ago)
Author:
aakash_jain@apple.com
Message:

[ews-build] Parse and display layout test failures
https://bugs.webkit.org/show_bug.cgi?id=199709

Rubber-stamped by Jonathan Bedard.

  • BuildSlaveSupport/ews-build/steps.py:

(RunWebKitTests.start): Initialize log_observer.
(RunWebKitTests._strip_python_logging_prefix): Copied from similar code in build.webkit.org buildbot config.
(RunWebKitTests._parseRunWebKitTestsOutput): Ditto.
(RunWebKitTests.commandComplete): Gather and parse the stdout and stderr logs.
(RunWebKitTests.evaluateResult): Analyze the results and decide build status.
(RunWebKitTests.getResultSummary): Update build and step summary.

  • BuildSlaveSupport/ews-build/steps_unittest.py: Added and updated unit-tests.
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/ews-build/steps.py

    r247389 r247433  
    845845
    846846    def start(self):
     847        self.log_observer = logobserver.BufferLogObserver(wantStderr=True)
     848        self.addLogObserver('stdio', self.log_observer)
     849
     850        self.incorrectLayoutLines = []
    847851        platform = self.getProperty('platform')
    848852        appendCustomBuildFlags(self, platform, self.getProperty('fullPlatform'))
     
    856860        return shell.Test.start(self)
    857861
     862    # FIXME: This will break if run-webkit-tests changes its default log formatter.
     863    nrwt_log_message_regexp = re.compile(r'\d{2}:\d{2}:\d{2}(\.\d+)?\s+\d+\s+(?P<message>.*)')
     864
     865    def _strip_python_logging_prefix(self, line):
     866        match_object = self.nrwt_log_message_regexp.match(line)
     867        if match_object:
     868            return match_object.group('message')
     869        return line
     870
     871    def _parseRunWebKitTestsOutput(self, logText):
     872        incorrectLayoutLines = []
     873        expressions = [
     874            ('flakes', re.compile(r'Unexpected flakiness.+\((\d+)\)')),
     875            ('new passes', re.compile(r'Expected to .+, but passed:\s+\((\d+)\)')),
     876            ('missing results', re.compile(r'Regressions: Unexpected missing results\s+\((\d+)\)')),
     877            ('failures', re.compile(r'Regressions: Unexpected.+\((\d+)\)')),
     878        ]
     879        testFailures = {}
     880
     881        for line in logText.splitlines():
     882            if line.find('Exiting early') >= 0 or line.find('leaks found') >= 0:
     883                incorrectLayoutLines.append(self._strip_python_logging_prefix(line))
     884                continue
     885            for name, expression in expressions:
     886                match = expression.search(line)
     887
     888                if match:
     889                    testFailures[name] = testFailures.get(name, 0) + int(match.group(1))
     890                    break
     891
     892                # FIXME: Parse file names and put them in results
     893
     894        for name in testFailures:
     895            incorrectLayoutLines.append(str(testFailures[name]) + ' ' + name)
     896
     897        self.incorrectLayoutLines = incorrectLayoutLines
     898
     899    def commandComplete(self, cmd):
     900        shell.Test.commandComplete(self, cmd)
     901        logText = self.log_observer.getStdout() + self.log_observer.getStderr()
     902        self._parseRunWebKitTestsOutput(logText)
     903
     904    def evaluateResult(self, cmd):
     905        result = SUCCESS
     906
     907        if self.incorrectLayoutLines:
     908            if len(self.incorrectLayoutLines) == 1:
     909                line = self.incorrectLayoutLines[0]
     910                if line.find('were new') >= 0 or line.find('was new') >= 0 or line.find(' leak') >= 0:
     911                    return WARNINGS
     912
     913            for line in self.incorrectLayoutLines:
     914                if line.find('flakes') >= 0 or line.find('new passes') >= 0 or line.find('missing results') >= 0:
     915                    result = WARNINGS
     916                else:
     917                    return FAILURE
     918
     919        # Return code from Tools/Scripts/layout_tests/run_webkit_tests.py.
     920        # This means that an exception was raised when running run-webkit-tests and
     921        # was never handled.
     922        if cmd.rc == 254:
     923            return RETRY
     924        if cmd.rc != 0:
     925            return FAILURE
     926
     927        return result
     928
    858929    def evaluateCommand(self, cmd):
    859         rc = super(RunWebKitTests, self).evaluateCommand(cmd)
    860         if rc == SUCCESS:
     930        rc = self.evaluateResult(cmd)
     931        if rc == SUCCESS or rc == WARNINGS:
    861932            message = 'Passed layout tests'
    862933            self.descriptionDone = message
     
    866937            self.build.addStepsAfterCurrentStep([ArchiveTestResults(), UploadTestResults(), ExtractTestResults(), ReRunWebKitTests()])
    867938        return rc
     939
     940    def getResultSummary(self):
     941        status = self.name
     942
     943        if self.results != SUCCESS and self.incorrectLayoutLines:
     944            status = u' '.join(self.incorrectLayoutLines)
     945            return {u'step': status}
     946
     947        return super(RunWebKitTests, self).getResultSummary()
    868948
    869949
  • trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py

    r247389 r247433  
    975975        self.expectOutcome(result=SUCCESS, state_string='Passed layout tests')
    976976        return self.runStep()
     977
     978    def test_warnings(self):
     979        self.setupStep(RunWebKitTests())
     980        self.setProperty('fullPlatform', 'ios-simulator')
     981        self.setProperty('configuration', 'release')
     982        self.expectRemoteCommands(
     983            ExpectShell(workdir='wkdir',
     984                        logfiles={'json': self.jsonFileName},
     985                        command=['python', 'Tools/Scripts/run-webkit-tests', '--no-build', '--no-new-test-results', '--no-show-results', '--exit-after-n-failures', '30', '--skip-failing-tests', '--release', '--results-directory', 'layout-test-results', '--debug-rwt-logging'],
     986                        )
     987            + 0
     988            + ExpectShell.log('stdio', stdout='''Unexpected flakiness: timeouts (2)
     989                              imported/blink/storage/indexeddb/blob-valid-before-commit.html [ Timeout Pass ]
     990                              storage/indexeddb/modern/deleteindex-2.html [ Timeout Pass ]'''),
     991        )
     992        self.expectOutcome(result=WARNINGS, state_string='2 flakes')
     993        return self.runStep()
     994
     995    def test_unexpected_error(self):
     996        self.setupStep(RunWebKitTests())
     997        self.setProperty('fullPlatform', 'mac-highsierra')
     998        self.setProperty('configuration', 'debug')
     999        self.expectRemoteCommands(
     1000            ExpectShell(workdir='wkdir',
     1001                        logfiles={'json': self.jsonFileName},
     1002                        command=['python', 'Tools/Scripts/run-webkit-tests', '--no-build', '--no-new-test-results', '--no-show-results', '--exit-after-n-failures', '30', '--skip-failing-tests', '--debug', '--results-directory', 'layout-test-results', '--debug-rwt-logging'],
     1003                        )
     1004            + ExpectShell.log('stdio', stdout='Unexpected error.')
     1005            + 254,
     1006        )
     1007        self.expectOutcome(result=RETRY, state_string='layout-tests (retry)')
     1008        return self.runStep()
     1009
    9771010
    9781011    def test_failure(self):
  • trunk/Tools/ChangeLog

    r247428 r247433  
     12019-07-15  Aakash Jain  <aakash_jain@apple.com>
     2
     3        [ews-build] Parse and display layout test failures
     4        https://bugs.webkit.org/show_bug.cgi?id=199709
     5
     6        Rubber-stamped by Jonathan Bedard.
     7
     8        * BuildSlaveSupport/ews-build/steps.py:
     9        (RunWebKitTests.start): Initialize log_observer.
     10        (RunWebKitTests._strip_python_logging_prefix): Copied from similar code in build.webkit.org buildbot config.
     11        (RunWebKitTests._parseRunWebKitTestsOutput): Ditto.
     12        (RunWebKitTests.commandComplete): Gather and parse the stdout and stderr logs.
     13        (RunWebKitTests.evaluateResult): Analyze the results and decide build status.
     14        (RunWebKitTests.getResultSummary): Update build and step summary.
     15        * BuildSlaveSupport/ews-build/steps_unittest.py: Added and updated unit-tests.
     16
    1172019-07-15  Commit Queue  <commit-queue@webkit.org>
    218
Note: See TracChangeset for help on using the changeset viewer.