Title: [292536] trunk/Tools
Revision
292536
Author
[email protected]
Date
2022-04-07 08:26:58 -0700 (Thu, 07 Apr 2022)

Log Message

[Merge-Queue] Share code for _addToLog
https://bugs.webkit.org/show_bug.cgi?id=238913
<rdar://problem/91383969>

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps.py:
(AddToLogMixin): Base class for all classes using _addToLog
(ConfigureBuild): Use from AddToLogMixin.
(AnalyzeChange): Ditto.
(BugzillaMixin): Ditto.
(ValidateCommitterAndReviewer): Ditto.
(BlockPullRequest): Ditto.
(RunBindingsTests): Ditto.
(WebKitPyTest): Ditto.
(CompileWebKit): Ditto.
(RunJavaScriptCoreTests): Ditto.
(AnalyzeJSCTestsResults): Ditto.
(RunWebKitTests): Ditto.
(AnalyzeAPITestsResults): Ditto.
(UpdatePullRequest): Ditto.
(ConfigureBuild._addToLog): Deleted.
(AnalyzeChange._addToLog): Deleted.
(BugzillaMixin._addToLog): Deleted.
(ValidateCommitterAndReviewer._addToLog): Deleted.
(BlockPullRequest._addToLog): Deleted.
(RunBindingsTests._addToLog): Deleted.
(WebKitPyTest._addToLog): Deleted.
(CompileWebKit._addToLog): Deleted.
(RunJavaScriptCoreTests._addToLog): Deleted.
(AnalyzeJSCTestsResults._addToLog): Deleted.
(RunWebKitTests._addToLog): Deleted.
(AnalyzeAPITestsResults._addToLog): Deleted.
(CheckPatchStatusOnEWSQueues._addToLog): Deleted.
(UpdatePullRequest._addToLog): Deleted.

Canonical link: https://commits.webkit.org/249374@main

Modified Paths

Diff

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


--- trunk/Tools/CISupport/ews-build/steps.py	2022-04-07 14:43:36 UTC (rev 292535)
+++ trunk/Tools/CISupport/ews-build/steps.py	2022-04-07 15:26:58 UTC (rev 292536)
@@ -374,6 +374,16 @@
         return 'true'
 
 
+class AddToLogMixin(object):
+    @defer.inlineCallbacks
+    def _addToLog(self, logName, message):
+        try:
+            log = self.getLog(logName)
+        except KeyError:
+            log = yield self.addLog(logName)
+        log.addStdout(message)
+
+
 class Contributors(object):
     url = ''
     contributors = {}
@@ -432,7 +442,7 @@
         return contributors, errors
 
 
-class ConfigureBuild(buildstep.BuildStep):
+class ConfigureBuild(buildstep.BuildStep, AddToLogMixin):
     name = 'configure-build'
     description = ['configuring build']
     descriptionDone = ['Configured build']
@@ -451,14 +461,6 @@
         self.remotes = remotes
         self.additionalArguments = additionalArguments
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def start(self):
         if self.platform and self.platform != '*':
             self.setProperty('platform', self.platform, 'config.json')
@@ -848,7 +850,7 @@
         return super(CheckOutPullRequest, self).getResultSummary()
 
 
-class AnalyzeChange(buildstep.BuildStep):
+class AnalyzeChange(buildstep.BuildStep, AddToLogMixin):
     flunkOnFailure = True
     haltOnFailure = True
 
@@ -860,14 +862,6 @@
             return sourcestamp.patch[1]
         return None
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     @property
     def change_type(self):
         if self.getProperty('github.number', False):
@@ -1051,18 +1045,11 @@
         return '{}attachment.cgi?id={}&action="" patch_id)
 
 
-class BugzillaMixin(object):
+class BugzillaMixin(AddToLogMixin):
     addURLs = False
     bug_open_statuses = ['UNCONFIRMED', 'NEW', 'ASSIGNED', 'REOPENED']
     bug_closed_statuses = ['RESOLVED', 'VERIFIED', 'CLOSED']
     fast_cq_preambles = ('revert of r', 'fast-cq', '[fast-cq]')
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
 
     def fetch_data_from_url_with_authentication(self, url):
         response = None
@@ -1487,7 +1474,7 @@
         return True
 
 
-class ValidateCommitterAndReviewer(buildstep.BuildStep, GitHubMixin):
+class ValidateCommitterAndReviewer(buildstep.BuildStep, GitHubMixin, AddToLogMixin):
     name = 'validate-commiter-and-reviewer'
     descriptionDone = ['Validated commiter and reviewer']
 
@@ -1495,14 +1482,6 @@
         super(ValidateCommitterAndReviewer, self).__init__(*args, **kwargs)
         self.contributors = {}
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def getResultSummary(self):
         if self.results == FAILURE:
             return {'step': self.descriptionDone}
@@ -1648,17 +1627,9 @@
         return not self.doStepIf(step)
 
 
-class BlockPullRequest(buildstep.BuildStep, GitHubMixin):
+class BlockPullRequest(buildstep.BuildStep, GitHubMixin, AddToLogMixin):
     name = 'block-pull-request'
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def start(self):
         pr_number = self.getProperty('github.number', '')
         build_finish_summary = self.getProperty('build_finish_summary', None)
@@ -1929,7 +1900,7 @@
         return int(match.group('errors'))
 
 
-class RunBindingsTests(shell.ShellCommand):
+class RunBindingsTests(shell.ShellCommand, AddToLogMixin):
     name = 'bindings-tests'
     description = ['bindings-tests running']
     descriptionDone = ['bindings-tests']
@@ -1969,15 +1940,7 @@
         self.build.buildFinished([message], FAILURE)
         return {'step': message}
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
 
-
 class RunWebKitPerlTests(shell.ShellCommand):
     name = 'webkitperl-tests'
     description = ['webkitperl-tests running']
@@ -2093,7 +2056,7 @@
         return {'step': 'Failed resultsdbpy unit tests'}
 
 
-class WebKitPyTest(shell.ShellCommand):
+class WebKitPyTest(shell.ShellCommand, AddToLogMixin):
     language = 'python'
     descriptionDone = ['webkitpy-tests']
     flunkOnFailure = True
@@ -2146,15 +2109,7 @@
         self.setBuildSummary(message)
         return {'step': message}
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
 
-
 class RunWebKitPyPython2Tests(WebKitPyTest):
     language = 'python2'
     name = 'webkitpy-tests-{}'.format(language)
@@ -2236,7 +2191,7 @@
             self.error_context_buffer = []
 
 
-class CompileWebKit(shell.Compile):
+class CompileWebKit(shell.Compile, AddToLogMixin):
     name = 'compile-webkit'
     description = ['compiling']
     descriptionDone = ['Compiled WebKit']
@@ -2283,14 +2238,6 @@
 
         return shell.Compile.start(self)
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def errorReceived(self, error):
         self._addToLog('errors', error + '\n')
 
@@ -2560,7 +2507,7 @@
         return shell.Compile.evaluateCommand(self, cmd)
 
 
-class RunJavaScriptCoreTests(shell.Test):
+class RunJavaScriptCoreTests(shell.Test, AddToLogMixin):
     name = 'jscore-test'
     description = ['jscore-tests running']
     descriptionDone = ['jscore-tests']
@@ -2672,15 +2619,7 @@
 
         return shell.Test.getResultSummary(self)
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
 
-
 class RunJSCTestsWithoutChange(RunJavaScriptCoreTests):
     name = 'jscore-test-without-change'
     prefix = 'jsc_clean_tree_'
@@ -2691,7 +2630,7 @@
         return rc
 
 
-class AnalyzeJSCTestsResults(buildstep.BuildStep):
+class AnalyzeJSCTestsResults(buildstep.BuildStep, AddToLogMixin):
     name = 'analyze-jsc-tests-results'
     description = ['analyze-jsc-test-results']
     descriptionDone = ['analyze-jsc-tests-results']
@@ -2779,14 +2718,6 @@
         self.build.buildFinished([message], FAILURE)
         return defer.succeed(None)
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def send_email_for_flaky_failure(self, test_name):
         try:
             builder_name = self.getProperty('buildername', '')
@@ -2880,7 +2811,7 @@
         return shell.Compile.getResultSummary(self)
 
 
-class RunWebKitTests(shell.Test):
+class RunWebKitTests(shell.Test, AddToLogMixin):
     name = 'layout-tests'
     description = ['layout-tests running']
     descriptionDone = ['layout-tests']
@@ -2947,14 +2878,6 @@
             return match_object.group('message')
         return line
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def _parseRunWebKitTestsOutput(self, logText):
         incorrectLayoutLines = []
         expressions = [
@@ -4016,7 +3939,7 @@
         return TestWithFailureCount.evaluateCommand(self, cmd)
 
 
-class AnalyzeAPITestsResults(buildstep.BuildStep):
+class AnalyzeAPITestsResults(buildstep.BuildStep, AddToLogMixin):
     name = 'analyze-api-tests-results'
     description = ['analyze-api-test-results']
     descriptionDone = ['analyze-api-tests-results']
@@ -4102,14 +4025,6 @@
                     self.send_email_for_flaky_failure(flaky_failure)
             self.build.buildFinished([message], SUCCESS)
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def getBuildStepByName(self, name):
         for step in self.build.executedSteps:
             if step.name == name:
@@ -4577,14 +4492,6 @@
             self._addToLog('stdio', 'Failed to access {}\n'.format(url))
             return -1
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def start(self):
         patch_id = self.getProperty('patch_id', '')
         patch_status_on_mac_wk2 = self.get_patch_status(patch_id, 'mac-wk2')
@@ -4968,7 +4875,8 @@
     def hideStepIf(self, results, step):
         return not self.doStepIf(step)
 
-class UpdatePullRequest(shell.ShellCommand, GitHubMixin):
+
+class UpdatePullRequest(shell.ShellCommand, GitHubMixin, AddToLogMixin):
     name = 'update-pull-request'
     haltOnFailure = True
     command = ['git', 'log', '-1', '--no-decorate']
@@ -4995,14 +4903,6 @@
     def __init__(self, **kwargs):
         super(UpdatePullRequest, self).__init__(logEnviron=False, timeout=300, **kwargs)
 
-    @defer.inlineCallbacks
-    def _addToLog(self, logName, message):
-        try:
-            log = self.getLog(logName)
-        except KeyError:
-            log = yield self.addLog(logName)
-        log.addStdout(message)
-
     def start(self, BufferLogObserverClass=logobserver.BufferLogObserver):
         self.log_observer = BufferLogObserverClass(wantStderr=True)
         self.addLogObserver('stdio', self.log_observer)

Modified: trunk/Tools/ChangeLog (292535 => 292536)


--- trunk/Tools/ChangeLog	2022-04-07 14:43:36 UTC (rev 292535)
+++ trunk/Tools/ChangeLog	2022-04-07 15:26:58 UTC (rev 292536)
@@ -1,3 +1,41 @@
+2022-04-06  Jonathan Bedard  <[email protected]>
+
+        [Merge-Queue] Share code for _addToLog
+        https://bugs.webkit.org/show_bug.cgi?id=238913
+        <rdar://problem/91383969>
+
+        Reviewed by Aakash Jain.
+
+        * CISupport/ews-build/steps.py:
+        (AddToLogMixin): Base class for all classes using _addToLog
+        (ConfigureBuild): Use from AddToLogMixin.
+        (AnalyzeChange): Ditto.
+        (BugzillaMixin): Ditto.
+        (ValidateCommitterAndReviewer): Ditto.
+        (BlockPullRequest): Ditto.
+        (RunBindingsTests): Ditto.
+        (WebKitPyTest): Ditto.
+        (CompileWebKit): Ditto.
+        (RunJavaScriptCoreTests): Ditto.
+        (AnalyzeJSCTestsResults): Ditto.
+        (RunWebKitTests): Ditto.
+        (AnalyzeAPITestsResults): Ditto.
+        (UpdatePullRequest): Ditto.
+        (ConfigureBuild._addToLog): Deleted.
+        (AnalyzeChange._addToLog): Deleted.
+        (BugzillaMixin._addToLog): Deleted.
+        (ValidateCommitterAndReviewer._addToLog): Deleted.
+        (BlockPullRequest._addToLog): Deleted.
+        (RunBindingsTests._addToLog): Deleted.
+        (WebKitPyTest._addToLog): Deleted.
+        (CompileWebKit._addToLog): Deleted.
+        (RunJavaScriptCoreTests._addToLog): Deleted.
+        (AnalyzeJSCTestsResults._addToLog): Deleted.
+        (RunWebKitTests._addToLog): Deleted.
+        (AnalyzeAPITestsResults._addToLog): Deleted.
+        (CheckPatchStatusOnEWSQueues._addToLog): Deleted.
+        (UpdatePullRequest._addToLog): Deleted.
+
 2022-04-06  Dewei Zhu  <[email protected]>
 
         Use 'open' command on macOS to launch URL should pass Safari app bundle instead of binary
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to