Title: [269786] trunk/Tools
Revision
269786
Author
[email protected]
Date
2020-11-13 10:22:32 -0800 (Fri, 13 Nov 2020)

Log Message

[build.webkit.org] Update RunAPITests step for new buildbot
https://bugs.webkit.org/show_bug.cgi?id=218907

Reviewed by Jonathan Bedard.

* CISupport/build-webkit-org/steps.py:
(TestWithFailureCount.getText): Added FIXME to remove this method after switching to buildbot v2.
(TestWithFailureCount.getText2): Added FIXME to remove this method after switching to buildbot v2.
(TestWithFailureCount.getResultSummary): Method to generate custom step summary.
(RunWebKitTests.getResultSummary): Removed unnecessary u'', python3 defaults to unicode anyways.
(RunAPITests):
(RunAPITests.start): Use ParseByLineLogObserver.
(RunAPITests.countFailures):
(RunAPITests.parseOutputLine): Method to process each line.

Modified Paths

Diff

Modified: trunk/Tools/CISupport/build-webkit-org/steps.py (269785 => 269786)


--- trunk/Tools/CISupport/build-webkit-org/steps.py	2020-11-13 17:51:06 UTC (rev 269785)
+++ trunk/Tools/CISupport/build-webkit-org/steps.py	2020-11-13 18:22:32 UTC (rev 269786)
@@ -44,6 +44,7 @@
 if USE_BUILDBOT_VERSION2:
     Interpolate = properties.Interpolate
     from buildbot.process import logobserver
+    from buildbot.process.results import Results
     from buildbot.steps.source.svn import SVN
 else:
     from buildbot.steps.source import SVN
@@ -91,15 +92,28 @@
         return SUCCESS
 
     def getText(self, cmd, results):
+        # FIXME: delete this method after switching to Buildbot v2
         return self.getText2(cmd, results)
 
     def getText2(self, cmd, results):
+        # FIXME: delete this method after switching to Buildbot v2
         if results != SUCCESS and self.failedTestCount:
             return [self.failedTestsFormatString % (self.failedTestCount, self.failedTestPluralSuffix)]
 
         return [self.name]
 
+    def getResultSummary(self):
+        status = self.name
 
+        if self.results != SUCCESS:
+            if self.failedTestCount:
+                status = self.failedTestsFormatString % (self.failedTestCount, self.failedTestPluralSuffix)
+            else:
+                status += ' ({})'.format(Results[self.results])
+
+        return {'step': status}
+
+
 class ConfigureBuild(buildstep.BuildStep):
     name = "configure-build"
     description = ["configuring build"]
@@ -617,8 +631,8 @@
         status = self.name
 
         if self.results != SUCCESS and self.incorrectLayoutLines:
-            status = u' '.join(self.incorrectLayoutLines)
-            return {u'step': status}
+            status = ' '.join(self.incorrectLayoutLines)
+            return {'step': status}
         return super(RunWebKitTests, self).getResultSummary()
 
     def getText(self, cmd, results):
@@ -664,6 +678,7 @@
         "--report", RESULTS_WEBKIT_URL,
     ]
     failedTestsFormatString = "%d api test%s failed or timed out"
+    test_summary_re = re.compile(r'Ran (?P<ran>\d+) tests of (?P<total>\d+) with (?P<passed>\d+) successful')
 
     def __init__(self, *args, **kwargs):
         kwargs['logEnviron'] = False
@@ -672,6 +687,9 @@
     def start(self):
         if USE_BUILDBOT_VERSION2:
             self.workerEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
+            self.log_observer = ParseByLineLogObserver(self.parseOutputLine)
+            self.addLogObserver('stdio', self.log_observer)
+            self.failedTestCount = 0
         else:
             self.slaveEnvironment[RESULTS_SERVER_API_KEY] = os.getenv(RESULTS_SERVER_API_KEY)
         appendCustomTestingFlags(self, self.getProperty('platform'), self.getProperty('device_model'))
@@ -678,6 +696,9 @@
         return shell.Test.start(self)
 
     def countFailures(self, cmd):
+        if USE_BUILDBOT_VERSION2:
+            return self.failedTestCount
+
         log_text = cmd.logs['stdio'].getText()
 
         match = re.search(r'Ran (?P<ran>\d+) tests of (?P<total>\d+) with (?P<passed>\d+) successful', log_text)
@@ -685,7 +706,12 @@
             return -1
         return int(match.group('ran')) - int(match.group('passed'))
 
+    def parseOutputLine(self, line):
+        match = self.test_summary_re.match(line)
+        if match:
+            self.failedTestCount = int(match.group('ran')) - int(match.group('passed'))
 
+
 class RunPythonTests(TestWithFailureCount):
 
     def start(self):

Modified: trunk/Tools/ChangeLog (269785 => 269786)


--- trunk/Tools/ChangeLog	2020-11-13 17:51:06 UTC (rev 269785)
+++ trunk/Tools/ChangeLog	2020-11-13 18:22:32 UTC (rev 269786)
@@ -1,3 +1,20 @@
+2020-11-13  Aakash Jain  <[email protected]>
+
+        [build.webkit.org] Update RunAPITests step for new buildbot
+        https://bugs.webkit.org/show_bug.cgi?id=218907
+
+        Reviewed by Jonathan Bedard.
+
+        * CISupport/build-webkit-org/steps.py:
+        (TestWithFailureCount.getText): Added FIXME to remove this method after switching to buildbot v2.
+        (TestWithFailureCount.getText2): Added FIXME to remove this method after switching to buildbot v2.
+        (TestWithFailureCount.getResultSummary): Method to generate custom step summary.
+        (RunWebKitTests.getResultSummary): Removed unnecessary u'', python3 defaults to unicode anyways.
+        (RunAPITests):
+        (RunAPITests.start): Use ParseByLineLogObserver.
+        (RunAPITests.countFailures):
+        (RunAPITests.parseOutputLine): Method to process each line.
+
 2020-11-12  Darin Adler  <[email protected]>
 
         Remove unused advanced plug-in features: snapshotting and plug-in load policy
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to