2018-07-11 Aakash Jain <aakash_jain@apple.com>
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2018 18:10:10 +0000 (18:10 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Jul 2018 18:10:10 +0000 (18:10 +0000)
[ews-build] EWS should unapply the patch and build ToT when patch fails to build
https://bugs.webkit.org/show_bug.cgi?id=187358

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-build/factories.py:
(BuildFactory.__init__):
* BuildSlaveSupport/ews-build/steps.py:
(CompileWebKit): Set haltOnFailure to false so as to run next steps (e.g.: un-apply patch, compile ToT).
(CompileWebKit.evaluateCommand): Set patchFailedToBuild property.
(CompileWebKitToT): Build ToT without patch.
(CompileWebKitToT.doStepIf): Run this step only if patch failed to build.
* BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests. Also lower-cased Release and Debug.

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

Tools/BuildSlaveSupport/ews-build/factories.py
Tools/BuildSlaveSupport/ews-build/steps.py
Tools/BuildSlaveSupport/ews-build/steps_unittest.py
Tools/ChangeLog

index 268fe54..3e42170 100644 (file)
@@ -63,6 +63,8 @@ class BuildFactory(Factory):
         self.addStep(KillOldProcesses())
         self.addStep(CleanBuild())
         self.addStep(CompileWebKit())
+        self.addStep(UnApplyPatchIfRequired())
+        self.addStep(CompileWebKitToT())
 
 
 class JSCTestsFactory(Factory):
index f65d4c2..af071a6 100644 (file)
@@ -138,6 +138,7 @@ class CompileWebKit(shell.Compile):
     descriptionDone = ["compiled"]
     env = {'MFLAGS': ''}
     warningPattern = ".*arning: .*"
+    haltOnFailure = False
     command = ["perl", "Tools/Scripts/build-webkit", WithProperties("--%(configuration)s")]
 
     def start(self):
@@ -163,6 +164,23 @@ class CompileWebKit(shell.Compile):
 
         return shell.Compile.start(self)
 
+    def evaluateCommand(self, cmd):
+        if cmd.didFail():
+            self.setProperty('patchFailedToBuild', True)
+
+        return super(CompileWebKit, self).evaluateCommand(cmd)
+
+
+class CompileWebKitToT(CompileWebKit):
+    name = 'compile-webkit-tot'
+    haltOnFailure = True
+
+    def doStepIf(self, step):
+        return self.getProperty('patchFailedToBuild')
+
+    def hideStepIf(self, results, step):
+        return not self.doStepIf(step)
+
 
 class CompileJSCOnly(CompileWebKit):
     name = "build-jsc"
index 59551e7..eeeb56a 100644 (file)
@@ -147,7 +147,7 @@ class TestCheckStyle(BuildStepMixinAdditions, unittest.TestCase):
         self.setupStep(CheckStyle())
         self.setProperty('try-codebase', 'internal')
         self.setProperty('platform', 'mac')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
 
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
@@ -162,7 +162,7 @@ class TestCheckStyle(BuildStepMixinAdditions, unittest.TestCase):
         self.setupStep(CheckStyle())
         self.setProperty('try-codebase', 'foo')
         self.setProperty('platform', 'mac')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
 
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
@@ -177,7 +177,7 @@ class TestCheckStyle(BuildStepMixinAdditions, unittest.TestCase):
         self.setupStep(CheckStyle())
         self.setProperty('try-codebase', 'internal')
         self.setProperty('platform', 'mac')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
 
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
@@ -199,7 +199,7 @@ Total errors found: 8 in 48 files''')
         self.setupStep(CheckStyle())
         self.setProperty('try-codebase', 'internal')
         self.setProperty('platform', 'mac')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
 
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
@@ -215,7 +215,7 @@ Total errors found: 8 in 48 files''')
         self.setupStep(CheckStyle())
         self.setProperty('try-codebase', 'internal')
         self.setProperty('platform', 'mac')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
 
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
@@ -383,10 +383,10 @@ class TestCleanBuild(BuildStepMixinAdditions, unittest.TestCase):
     def test_success(self):
         self.setupStep(CleanBuild())
         self.setProperty('fullPlatform', 'ios-11')
-        self.setProperty('configuration', 'Release')
+        self.setProperty('configuration', 'release')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=['python', 'Tools/BuildSlaveSupport/clean-build', '--platform=ios-11', '--Release'],
+                        command=['python', 'Tools/BuildSlaveSupport/clean-build', '--platform=ios-11', '--release'],
                         )
             + 0,
         )
@@ -396,10 +396,10 @@ class TestCleanBuild(BuildStepMixinAdditions, unittest.TestCase):
     def test_failure(self):
         self.setupStep(CleanBuild())
         self.setProperty('fullPlatform', 'ios-simulator-11')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=['python', 'Tools/BuildSlaveSupport/clean-build', '--platform=ios-simulator-11', '--Debug'],
+                        command=['python', 'Tools/BuildSlaveSupport/clean-build', '--platform=ios-simulator-11', '--debug'],
                         )
             + ExpectShell.log('stdio', stdout='Unexpected error.')
             + 2,
@@ -419,10 +419,10 @@ class TestCompileWebKit(BuildStepMixinAdditions, unittest.TestCase):
     def test_success(self):
         self.setupStep(CompileWebKit())
         self.setProperty('fullPlatform', 'ios-simulator-11')
-        self.setProperty('configuration', 'Release')
+        self.setProperty('configuration', 'release')
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=["perl", "Tools/Scripts/build-webkit", '--Release'],
+                        command=["perl", "Tools/Scripts/build-webkit", '--release'],
                         )
             + 0,
         )
@@ -432,10 +432,48 @@ class TestCompileWebKit(BuildStepMixinAdditions, unittest.TestCase):
     def test_failure(self):
         self.setupStep(CompileWebKit())
         self.setProperty('fullPlatform', 'mac-sierra')
-        self.setProperty('configuration', 'Debug')
+        self.setProperty('configuration', 'debug')
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=["perl", "Tools/Scripts/build-webkit", '--debug'],
+                        )
+            + ExpectShell.log('stdio', stdout='1 error generated.')
+            + 2,
+        )
+        self.expectOutcome(result=FAILURE, state_string='compiled (failure)')
+        return self.runStep()
+
+
+class TestCompileWebKitToT(BuildStepMixinAdditions, unittest.TestCase):
+    def setUp(self):
+        self.longMessage = True
+        return self.setUpBuildStep()
+
+    def tearDown(self):
+        return self.tearDownBuildStep()
+
+    def test_success(self):
+        self.setupStep(CompileWebKitToT())
+        self.setProperty('fullPlatform', 'ios-simulator-11')
+        self.setProperty('configuration', 'release')
+        self.setProperty('patchFailedToBuild', True)
+        self.expectRemoteCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['perl', 'Tools/Scripts/build-webkit', '--release'],
+                        )
+            + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='compiled')
+        return self.runStep()
+
+    def test_failure(self):
+        self.setupStep(CompileWebKitToT())
+        self.setProperty('fullPlatform', 'mac-sierra')
+        self.setProperty('configuration', 'debug')
+        self.setProperty('patchFailedToBuild', True)
         self.expectRemoteCommands(
             ExpectShell(workdir='wkdir',
-                        command=["perl", "Tools/Scripts/build-webkit", '--Debug'],
+                        command=['perl', 'Tools/Scripts/build-webkit', '--debug'],
                         )
             + ExpectShell.log('stdio', stdout='1 error generated.')
             + 2,
@@ -443,6 +481,14 @@ class TestCompileWebKit(BuildStepMixinAdditions, unittest.TestCase):
         self.expectOutcome(result=FAILURE, state_string='compiled (failure)')
         return self.runStep()
 
+    def test_skip(self):
+        self.setupStep(CompileWebKitToT())
+        self.setProperty('fullPlatform', 'ios-simulator-11')
+        self.setProperty('configuration', 'release')
+        self.expectHidden(True)
+        self.expectOutcome(result=SKIPPED, state_string='compiled (skipped)')
+        return self.runStep()
+
 
 class TestCompileJSCOnly(BuildStepMixinAdditions, unittest.TestCase):
     def setUp(self):
index fb1596e..7b91f6a 100644 (file)
@@ -1,3 +1,19 @@
+ 2018-07-11  Aakash Jain  <aakash_jain@apple.com>
+        [ews-build] EWS should unapply the patch and build ToT when patch fails to build
+        https://bugs.webkit.org/show_bug.cgi?id=187358
+        Reviewed by Alexey Proskuryakov.
+        * BuildSlaveSupport/ews-build/factories.py:
+        (BuildFactory.__init__):
+        * BuildSlaveSupport/ews-build/steps.py:
+        (CompileWebKit): Set haltOnFailure to false so as to run next steps (e.g.: un-apply patch, compile ToT).
+        (CompileWebKit.evaluateCommand): Set patchFailedToBuild property.
+        (CompileWebKitToT): Build ToT without patch.
+        (CompileWebKitToT.doStepIf): Run this step only if patch failed to build.
+        * BuildSlaveSupport/ews-build/steps_unittest.py: Added unit-tests. Also lower-cased Release and Debug.
+
 2018-07-11  Robin Morisset  <rmorisset@apple.com>
 
         [WSL] WIP, more of the spec