Modified: trunk/Tools/CISupport/ews-build/steps.py (289814 => 289815)
--- trunk/Tools/CISupport/ews-build/steps.py 2022-02-15 15:42:32 UTC (rev 289814)
+++ trunk/Tools/CISupport/ews-build/steps.py 2022-02-15 15:45:24 UTC (rev 289815)
@@ -206,6 +206,23 @@
return True
+class ShellMixin(object):
+ WINDOWS_SHELL_PLATFORMS = ['wincairo']
+
+ def has_windows_shell(self):
+ return self.getProperty('platform', '*') in self.WINDOWS_SHELL_PLATFORMS
+
+ def shell_command(self, command):
+ if self.has_windows_shell():
+ return ['cmd', '/c', command]
+ return ['/bin/sh', '-c', command]
+
+ def shell_exit_0(self):
+ if self.has_windows_shell():
+ return 'exit 0'
+ return 'true'
+
+
class Contributors(object):
url = ''
contributors = {}
@@ -567,7 +584,7 @@
return rc
-class ApplyPatch(shell.ShellCommand, CompositeStepMixin):
+class ApplyPatch(shell.ShellCommand, CompositeStepMixin, ShellMixin):
name = 'apply-patch'
description = ['applying-patch']
descriptionDone = ['Applied patch']
@@ -591,7 +608,7 @@
if not patch:
# Forced build, don't have patch_id raw data on the request, need to fech it.
patch_id = self.getProperty('patch_id', '')
- self.command = ['/bin/sh', '-c', 'curl -L "https://bugs.webkit.org/attachment.cgi?id={}" -o .buildbot-diff && {}'.format(patch_id, ' '.join(self.command))]
+ self.command = self.shell_command('curl -L "https://bugs.webkit.org/attachment.cgi?id={}" -o .buildbot-diff && {}'.format(patch_id, ' '.join(self.command)))
shell.ShellCommand.start(self)
return None
@@ -626,7 +643,7 @@
return rc
-class CheckOutPullRequest(steps.ShellSequence):
+class CheckOutPullRequest(steps.ShellSequence, ShellMixin):
name = 'checkout-pull-request'
description = ['checking-out-pull-request']
descriptionDone = ['Checked out pull request']
@@ -651,7 +668,7 @@
rebase_target_hash = self.getProperty('ews_revision') or self.getProperty('got_revision')
commands = [
- ['/bin/sh', '-c', 'git remote add {} {}{}.git & true'.format(remote, GITHUB_URL, project)],
+ self.shell_command('git remote add {} {}{}.git || {}'.format(remote, GITHUB_URL, project, self.shell_exit_0())),
['git', 'remote', 'set-url', remote, '{}{}.git'.format(GITHUB_URL, project)],
['git', 'fetch', remote],
['git', 'branch', '-f', pr_branch, 'remotes/{}/{}'.format(remote, pr_branch)],
@@ -3935,7 +3952,7 @@
# FIXME: We should be able to remove this step once abandoning patch workflows
-class CleanGitRepo(steps.ShellSequence):
+class CleanGitRepo(steps.ShellSequence, ShellMixin):
name = 'clean-up-git-repo'
haltOnFailure = False
flunkOnFailure = False
@@ -3950,7 +3967,7 @@
branch = self.getProperty('basename', self.default_branch)
self.commands = []
for command in [
- ['/bin/sh', '-c', 'git rebase --abort & true'],
+ self.shell_command('git rebase --abort || {}'.format(self.shell_exit_0())),
['git', 'clean', '-f', '-d'], # Remove any left-over layout test results, added files, etc.
['git', 'fetch', self.git_remote], # Avoid updating the working copy to a stale revision.
['git', 'checkout', '{}/{}'.format(self.git_remote, branch), '-f'], # Checkout branch from specific remote
Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (289814 => 289815)
--- trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-02-15 15:42:32 UTC (rev 289814)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py 2022-02-15 15:45:24 UTC (rev 289815)
@@ -3106,7 +3106,7 @@
workdir='wkdir',
timeout=600,
logEnviron=False,
- command=['/bin/sh', '-c', 'git remote add Contributor https://github.com/Contributor/WebKit.git & true'],
+ command=['/bin/sh', '-c', 'git remote add Contributor https://github.com/Contributor/WebKit.git || true'],
) + 0, ExpectShell(
workdir='wkdir',
timeout=600,
@@ -3142,6 +3142,57 @@
self.expectOutcome(result=SUCCESS, state_string='Checked out pull request')
return self.runStep()
+ def test_success_wincairo(self):
+ self.setupStep(CheckOutPullRequest())
+ self.setProperty('platform', 'wincairo')
+ self.setProperty('github.number', '1234')
+ self.setProperty('github.head.repo.full_name', 'Contributor/WebKit')
+ self.setProperty('github.head.ref', 'eng/pull-request-branch')
+ self.setProperty('github.base.sha', 'aaebef7312238f3ad1d25e8894916a1aaea45ba1')
+ self.setProperty('got_revision', '59dab0396721db221c264aad3c0cea37ef0d297b')
+ self.assertEqual(CheckOutPullRequest.flunkOnFailure, True)
+ self.assertEqual(CheckOutPullRequest.haltOnFailure, True)
+ self.expectRemoteCommands(
+ ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['cmd', '/c', 'git remote add Contributor https://github.com/Contributor/WebKit.git || exit 0'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'remote', 'set-url', 'Contributor', 'https://github.com/Contributor/WebKit.git'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'fetch', 'Contributor'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'branch', '-f', 'eng/pull-request-branch', 'remotes/Contributor/eng/pull-request-branch'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'checkout', 'eng/pull-request-branch'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'config', 'merge.changelog.driver', 'perl Tools/Scripts/resolve-ChangeLogs --merge-driver -c %O %A %B'],
+ ) + 0, ExpectShell(
+ workdir='wkdir',
+ timeout=600,
+ logEnviron=False,
+ command=['git', 'rebase', '--onto', '59dab0396721db221c264aad3c0cea37ef0d297b', 'aaebef7312238f3ad1d25e8894916a1aaea45ba1', 'eng/pull-request-branch'],
+ ) + 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Checked out pull request')
+ return self.runStep()
+
def test_failure(self):
self.setupStep(CheckOutPullRequest())
self.setProperty('github.number', '1234')
@@ -3156,7 +3207,7 @@
workdir='wkdir',
timeout=600,
logEnviron=False,
- command=['/bin/sh', '-c', 'git remote add Contributor https://github.com/Contributor/WebKit.git & true'],
+ command=['/bin/sh', '-c', 'git remote add Contributor https://github.com/Contributor/WebKit.git || true'],
) + 0, ExpectShell(
workdir='wkdir',
timeout=600,
@@ -4567,7 +4618,7 @@
self.setProperty('buildername', 'Style-EWS')
self.expectRemoteCommands(
- ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort & true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
@@ -4583,12 +4634,34 @@
self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
return self.runStep()
+ def test_success_wincairo(self):
+ self.setupStep(CleanGitRepo())
+ self.setProperty('buildername', 'WinCairo-EWS')
+ self.setProperty('platform', 'wincairo')
+
+ self.expectRemoteCommands(
+ ExpectShell(command=['cmd', '/c', 'git rebase --abort || exit 0'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'fetch', 'origin'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout=''),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-f'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='You are in detached HEAD state.'),
+ ExpectShell(command=['git', 'branch', '-D', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout='Deleted branch main (was 57015967fef9).'),
+ ExpectShell(command=['git', 'checkout', 'origin/main', '-b', 'main'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ + ExpectShell.log('stdio', stdout="Switched to a new branch 'main'"),
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Cleaned up git repository')
+ return self.runStep()
+
def test_success_master(self):
self.setupStep(CleanGitRepo(default_branch='master'))
self.setProperty('buildername', 'Commit-Queue')
self.expectRemoteCommands(
- ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort & true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
@@ -4609,7 +4682,7 @@
self.setProperty('buildername', 'Commit-Queue')
self.expectRemoteCommands(
- ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort & true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
@@ -4631,7 +4704,7 @@
self.setProperty('basename', 'safari-612-branch')
self.expectRemoteCommands(
- ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort & true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell(command=['/bin/sh', '-c', 'git rebase --abort || true'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),
ExpectShell(command=['git', 'clean', '-f', '-d'], workdir='wkdir', timeout=300, logEnviron=False) + 0
+ ExpectShell.log('stdio', stdout=''),