Title: [244769] trunk/Tools
Revision
244769
Author
[email protected]
Date
2019-04-30 07:51:13 -0700 (Tue, 30 Apr 2019)

Log Message

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

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/steps.py:
(RunWebKitPyTests.start): Initialize log_observer for json output.
(RunWebKitPyTests.getResultSummary): Update step and build summary based on webkitpy results.
(RunWebKitPyTests._addToLog): Method to add message to log.
* BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-test accordingly.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps.py (244768 => 244769)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-04-30 14:32:43 UTC (rev 244768)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2019-04-30 14:51:13 UTC (rev 244769)
@@ -491,7 +491,43 @@
     def __init__(self, **kwargs):
         super(RunWebKitPyTests, self).__init__(timeout=2 * 60, **kwargs)
 
+    def start(self):
+        self.log_observer = logobserver.BufferLogObserver()
+        self.addLogObserver('json', self.log_observer)
+        return shell.ShellCommand.start(self)
 
+    def getResultSummary(self):
+        if self.results == SUCCESS:
+            message = 'Passed webkitpy tests'
+            self.build.buildFinished([message], SUCCESS)
+            return {u'step': unicode(message)}
+
+        logLines = self.log_observer.getStdout()
+        json_text = ''.join([line for line in logLines.splitlines()])
+        try:
+            webkitpy_results = json.loads(json_text)
+        except Exception as ex:
+            self._addToLog('stderr', 'ERROR: unable to parse data, exception: {}'.format(ex))
+            return super(RunWebKitPyTests, self).getResultSummary()
+
+        failures = webkitpy_results.get('failures') + webkitpy_results.get('errors')
+        if not failures:
+            return super(RunWebKitPyTests, self).getResultSummary()
+        pluralSuffix = 's' if len(failures) > 1 else ''
+        failures_string = ', '.join([failure.get('name').replace('webkitpy.', '') for failure in failures])
+        message = 'Found {} WebKitPy test failure{}: {}'.format(len(failures), pluralSuffix, failures_string)
+        self.build.buildFinished([message], FAILURE)
+        return {u'step': unicode(message)}
+
+    @defer.inlineCallbacks
+    def _addToLog(self, logName, message):
+        try:
+            log = self.getLog(logName)
+        except KeyError:
+            log = yield self.addLog(logName)
+        log.addStdout(message)
+
+
 def appendCustomBuildFlags(step, platform, fullPlatform):
     # FIXME: Make a common 'supported platforms' list.
     if platform not in ('gtk', 'wincairo', 'ios', 'jsc-only', 'wpe'):

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py (244768 => 244769)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-04-30 14:32:43 UTC (rev 244768)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps_unittest.py	2019-04-30 14:51:13 UTC (rev 244769)
@@ -372,7 +372,7 @@
                         )
             + 0,
         )
-        self.expectOutcome(result=SUCCESS, state_string='webkitpy-tests')
+        self.expectOutcome(result=SUCCESS, state_string='Passed webkitpy tests')
         return self.runStep()
 
     def test_failure(self):

Modified: trunk/Tools/ChangeLog (244768 => 244769)


--- trunk/Tools/ChangeLog	2019-04-30 14:32:43 UTC (rev 244768)
+++ trunk/Tools/ChangeLog	2019-04-30 14:51:13 UTC (rev 244769)
@@ -1,3 +1,16 @@
+2019-04-30  Aakash Jain  <[email protected]>
+
+        [ews-build] Parse and display webkitpy failures
+        https://bugs.webkit.org/show_bug.cgi?id=197395
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (RunWebKitPyTests.start): Initialize log_observer for json output.
+        (RunWebKitPyTests.getResultSummary): Update step and build summary based on webkitpy results.
+        (RunWebKitPyTests._addToLog): Method to add message to log.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-test accordingly.
+
 2019-04-29  Alex Christensen  <[email protected]>
 
         <rdar://problem/50299396> Fix internal High Sierra build
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to