[ews-build] Add support for API tests in OpenSource EWS
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2018 23:29:13 +0000 (23:29 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jul 2018 23:29:13 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188156

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/config.json:
* BuildSlaveSupport/ews-build/factories.py:
(BuildFactory.__init__): Added triggers parameter.
(BuildFactory): If trigger is defined, create and upload archive and trigger appropriate queues.
(BuildFactory.propertiesToPassToTriggers): Pass all the required properties to triggered queue.
(APITestsFactory): Factory for running API tests.
* BuildSlaveSupport/ews-build/steps.py:
(ConfigureBuild.start): Set the property only if property is defined in config.json. Also set the
source of the property.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234397 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-build/config.json
Tools/BuildSlaveSupport/ews-build/factories.py
Tools/BuildSlaveSupport/ews-build/steps.py
Tools/ChangeLog

index c8416c0..0c39f5b 100644 (file)
       "platform": "ios-simulator-11",
       "configuration": "release",
       "architectures": ["x86_64"],
+      "triggers": ["api-tests-ios-sim-ews"],
       "workernames": ["ews123", "ews124", "ews125", "ews126"]
     },
     {
       "platform": "mac-sierra",
       "configuration": "release",
       "architectures": ["x86_64"],
+      "triggers": ["api-tests-mac-ews"],
       "workernames": ["ews100", "ews101", "ews102", "ews103"]
     },
     {
       "factory": "WebKitPerlFactory",
       "platform": "*",
       "workernames": ["webkit-misc"]
+    },
+    {
+      "name": "API-Tests-iOS-Simulator-EWS",
+      "factory": "APITestsFactory",
+      "platform": "*",
+      "workernames": ["webkit-misc"]
+    },
+    {
+      "name": "API-Tests-macOS-EWS",
+      "factory": "APITestsFactory",
+      "platform": "*",
+      "workernames": ["webkit-misc"]
     }
   ],
   "schedulers": [
       "builderNames": ["Style-EWS", "JSC-Tests-EWS", "macOS-Sierra-Release-WK1-EWS", "GTK-Webkit2-EWS", "macOS-Sierra-Release-WK2-EWS",
                        "macOS-High-Sierra-Release-32bit-WK2-EWS", "WPE-EWS", "Windows-EWS", "iOS-11-EWS", "WinCairo-EWS", "iOS-11-Simulator-EWS",
                        "WebKitPy-Tests-EWS", "WebKitPerl-Tests-EWS", "macOS-Sierra-Debug-WK1-EWS", "Bindings-tests-EWS"]
+    },
+    {
+      "type": "Triggerable",
+      "name": "api-tests-ios-sim-ews",
+      "builderNames": [
+        "API-Tests-iOS-Simulator-EWS"
+      ]     
+    },
+    {
+      "type": "Triggerable",
+      "name": "api-tests-mac-ews",
+      "builderNames": [
+        "API-Tests-macOS-EWS"
+      ]     
     }
   ]
 }
index cc7893a..845569f 100644 (file)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-from buildbot.process import factory
+from buildbot.process import factory, properties
+from buildbot.steps import trigger
 
 from steps import *
 
+Property = properties.Property
+
 
 class Factory(factory.BuildFactory):
     def __init__(self, platform, configuration=None, architectures=None, buildOnly=True, additionalArguments=None, **kwargs):
@@ -58,13 +61,26 @@ class WebKitPyFactory(Factory):
 
 
 class BuildFactory(Factory):
-    def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
+    def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, triggers=None, **kwargs):
         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
         self.addStep(KillOldProcesses())
         self.addStep(CleanBuild())
         self.addStep(CompileWebKit())
         self.addStep(UnApplyPatchIfRequired())
         self.addStep(CompileWebKitToT())
+        if triggers:
+            self.addStep(ArchiveBuiltProduct())
+            self.addStep(UploadBuiltProduct())
+            self.addStep(trigger.Trigger(schedulerNames=triggers, set_properties=self.propertiesToPassToTriggers() or {}))
+
+    def propertiesToPassToTriggers(self):
+        return {
+            "ewspatchid": Property("ewspatchid"),
+            "configuration": Property("configuration"),
+            "platform": Property("platform"),
+            "fullPlatform": Property("fullPlatform"),
+            "architecture": Property("architecture"),
+        }
 
 
 class JSCTestsFactory(Factory):
@@ -79,6 +95,17 @@ class JSCTestsFactory(Factory):
         self.addStep(RunJavaScriptCoreTestsToT())
 
 
+class APITestsFactory(Factory):
+    def getProduct(self):
+        self.addStep(DownloadBuiltProduct())
+        self.addStep(ExtractBuiltProduct())
+
+    def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
+        Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
+        self.getProduct()
+        self.addStep(RunAPITests())
+
+
 class GTKFactory(Factory):
     pass
 
@@ -88,8 +115,8 @@ class iOSFactory(BuildFactory):
 
 
 class iOSSimulatorFactory(BuildFactory):
-    def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
-        BuildFactory.__init__(self, platform, configuration, architectures, additionalArguments)
+    def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, triggers=None, **kwargs):
+        BuildFactory.__init__(self, platform, configuration, architectures, additionalArguments, triggers)
         self.addStep(RunWebKitTests())
 
 
index 5ced990..263d512 100644 (file)
@@ -49,12 +49,18 @@ class ConfigureBuild(buildstep.BuildStep):
         self.additionalArguments = additionalArguments
 
     def start(self):
-        self.setProperty("platform", self.platform)
-        self.setProperty("fullPlatform", self.fullPlatform)
-        self.setProperty("configuration", self.configuration)
-        self.setProperty("architecture", self.architecture)
-        self.setProperty("buildOnly", self.buildOnly)
-        self.setProperty("additionalArguments", self.additionalArguments)
+        if self.platform and self.platform != '*':
+            self.setProperty('platform', self.platform, 'config.json')
+        if self.fullPlatform and self.fullPlatform != '*':
+            self.setProperty('fullPlatform', self.fullPlatform, 'ConfigureBuild')
+        if self.configuration:
+            self.setProperty('configuration', self.configuration, 'config.json')
+        if self.architecture:
+            self.setProperty('architecture', self.architecture, 'config.json')
+        if self.buildOnly:
+            self.setProperty("buildOnly", self.buildOnly, 'config.json')
+        if self.additionalArguments:
+            self.setProperty("additionalArguments", self.additionalArguments, 'config.json')
         self.finished(SUCCESS)
         return defer.succeed(None)
 
index 62aca12..718b327 100644 (file)
@@ -1,3 +1,20 @@
+2018-07-30 Aakash Jain  <aakash_jain@apple.com>
+
+        [ews-build] Add support for API tests in OpenSource EWS
+        https://bugs.webkit.org/show_bug.cgi?id=188156
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-build/config.json:
+        * BuildSlaveSupport/ews-build/factories.py:
+        (BuildFactory.__init__): Added triggers parameter.
+        (BuildFactory): If trigger is defined, create and upload archive and trigger appropriate queues.
+        (BuildFactory.propertiesToPassToTriggers): Pass all the required properties to triggered queue.
+        (APITestsFactory): Factory for running API tests.
+        * BuildSlaveSupport/ews-build/steps.py:
+        (ConfigureBuild.start): Set the property only if property is defined in config.json. Also set the 
+        source of the property.
+
 2018-07-30  Aakash Jain  <aakash_jain@apple.com>
 
         [ews-build] loadConfig should ensure that the triggers are valid