Title: [234559] trunk/Tools
Revision
234559
Author
[email protected]
Date
2018-08-03 14:35:49 -0700 (Fri, 03 Aug 2018)

Log Message

[ews-build] Add build step to Check Patch Relevance
https://bugs.webkit.org/show_bug.cgi?id=188295

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/steps.py:
(CheckPatchRelevance): Added step to check patch relevance.
(CheckPatchRelevance._patch_is_relevant): Checks if the patch is relevant.
(CheckPatchRelevance._get_patch): Retrieves the patch from buildbot.
(CheckPatchRelevance._addToLog): Add the log message.
(CheckPatchRelevance.start):
* BuildSlaveSupport/ews-build/factories.py: Added CheckPatchRelevance step appropriately.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-build/factories.py (234558 => 234559)


--- trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2018-08-03 21:10:44 UTC (rev 234558)
+++ trunk/Tools/BuildSlaveSupport/ews-build/factories.py	2018-08-03 21:35:49 UTC (rev 234559)
@@ -45,6 +45,7 @@
 class BindingsFactory(Factory):
     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
+        self.addStep(CheckPatchRelevance())
         self.addStep(RunBindingsTests())
 
 
@@ -57,6 +58,7 @@
 class WebKitPyFactory(Factory):
     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
+        self.addStep(CheckPatchRelevance())
         self.addStep(RunWebKitPyTests())
 
 
@@ -86,6 +88,7 @@
 class JSCTestsFactory(Factory):
     def __init__(self, platform, configuration='release', architectures=None, additionalArguments=None, **kwargs):
         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
+        self.addStep(CheckPatchRelevance())
         self.addStep(CompileJSCOnly())
         self.addStep(UnApplyPatchIfRequired())
         self.addStep(CompileJSCOnlyToT())

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


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2018-08-03 21:10:44 UTC (rev 234558)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2018-08-03 21:35:49 UTC (rev 234559)
@@ -76,6 +76,95 @@
                                                 **kwargs)
 
 
+class CheckPatchRelevance(buildstep.BuildStep):
+    name = 'check-patch-relevance'
+    description = ['check-patch-relevance running']
+    descriptionDone = ['check-patch-relevance']
+    flunkOnFailure = True
+    haltOnFailure = True
+
+    bindings_paths = [
+        "Source/WebCore",
+        "Tools",
+    ]
+
+    jsc_paths = [
+        "JSTests/",
+        "Source/_javascript_Core/",
+        "Source/WTF/",
+        "Source/bmalloc/",
+        "Makefile",
+        "Makefile.shared",
+        "Source/Makefile",
+        "Source/Makefile.shared",
+        "Tools/Scripts/build-webkit",
+        "Tools/Scripts/build-jsc",
+        "Tools/Scripts/jsc-stress-test-helpers/",
+        "Tools/Scripts/run-jsc",
+        "Tools/Scripts/run-jsc-benchmarks",
+        "Tools/Scripts/run-jsc-stress-tests",
+        "Tools/Scripts/run-_javascript_core-tests",
+        "Tools/Scripts/run-layout-jsc",
+        "Tools/Scripts/update-_javascript_core-test-results",
+        "Tools/Scripts/webkitdirs.pm",
+    ]
+
+    webkitpy_paths = [
+        "Tools/Scripts/webkitpy/",
+        "Tools/QueueStatusServer/",
+    ]
+
+    group_to_paths_mapping = {
+        'bindings': bindings_paths,
+        'jsc': jsc_paths,
+        'webkitpy': webkitpy_paths,
+    }
+
+    def _patch_is_relevant(self, patch, builderName):
+        group = [group for group in self.group_to_paths_mapping.keys() if group in builderName.lower()]
+        if not group:
+            # This builder doesn't have paths defined, all patches are relevant.
+            return True
+
+        relevant_paths = self.group_to_paths_mapping[group[0]]
+
+        for change in patch.splitlines():
+            for path in relevant_paths:
+                if re.search(path, change, re.IGNORECASE):
+                    return True
+        return False
+
+    def _get_patch(self):
+        sourcestamp = self.build.getSourceStamp(self.getProperty('codebase', ''))
+        if not sourcestamp or not sourcestamp.patch:
+            return None
+        return sourcestamp.patch[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 = self._get_patch()
+        if not patch:
+            # This build doesn't have a patch, it might be a force build.
+            self.finished(SUCCESS)
+            return None
+
+        if self._patch_is_relevant(patch, self.getProperty('buildername', '')):
+            self._addToLog('stdio', 'This patch contains relevant changes.')
+            self.finished(SUCCESS)
+            return None
+
+        self._addToLog('stdio', 'This patch does not have relevant changes.')
+        self.finished(FAILURE)
+        return None
+
+
 class UnApplyPatchIfRequired(CheckOutSource):
     name = 'unapply-patch'
 

Modified: trunk/Tools/ChangeLog (234558 => 234559)


--- trunk/Tools/ChangeLog	2018-08-03 21:10:44 UTC (rev 234558)
+++ trunk/Tools/ChangeLog	2018-08-03 21:35:49 UTC (rev 234559)
@@ -1,3 +1,18 @@
+2018-08-03  Aakash Jain  <[email protected]>
+
+        [ews-build] Add build step to Check Patch Relevance
+        https://bugs.webkit.org/show_bug.cgi?id=188295
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (CheckPatchRelevance): Added step to check patch relevance.
+        (CheckPatchRelevance._patch_is_relevant): Checks if the patch is relevant.
+        (CheckPatchRelevance._get_patch): Retrieves the patch from buildbot.
+        (CheckPatchRelevance._addToLog): Add the log message.
+        (CheckPatchRelevance.start):
+        * BuildSlaveSupport/ews-build/factories.py: Added CheckPatchRelevance step appropriately.
+
 2018-08-03  Jer Noble  <[email protected]>
 
         Unreviewed gardening; r234534 changed the policy for what audio session is set when a
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to