Modified: trunk/Tools/CISupport/ews-build/steps.py (275623 => 275624)
--- trunk/Tools/CISupport/ews-build/steps.py 2021-04-07 20:07:14 UTC (rev 275623)
+++ trunk/Tools/CISupport/ews-build/steps.py 2021-04-07 21:00:24 UTC (rev 275624)
@@ -169,6 +169,18 @@
return shell.ShellCommand.start(self)
+class GitResetHard(shell.ShellCommand):
+ name = 'git-reset-hard'
+ descriptionDone = ['Performed git reset --hard']
+
+ def __init__(self, **kwargs):
+ super(GitResetHard, self).__init__(logEnviron=False, **kwargs)
+
+ def start(self):
+ self.setCommand(['git', 'reset', 'HEAD~10', '--hard'])
+ return shell.ShellCommand.start(self)
+
+
class FetchBranches(shell.ShellCommand):
name = 'fetch-branch-references'
descriptionDone = ['Updated branch information']
@@ -3271,7 +3283,7 @@
retry_count = int(self.getProperty('retry_count', 0))
if retry_count < self.MAX_RETRY:
self.setProperty('retry_count', retry_count + 1)
- self.build.addStepsAfterCurrentStep([CheckOutSource(), ShowIdentifier(), UpdateWorkingDirectory(), ApplyPatch(), CreateLocalGITCommit(), PushCommitToWebKitRepo()])
+ self.build.addStepsAfterCurrentStep([GitResetHard(), CheckOutSource(), ShowIdentifier(), UpdateWorkingDirectory(), ApplyPatch(), CreateLocalGITCommit(), PushCommitToWebKitRepo()])
return rc
self.setProperty('bugzilla_comment_text', self.comment_text_for_bug())
Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (275623 => 275624)
--- trunk/Tools/CISupport/ews-build/steps_unittest.py 2021-04-07 20:07:14 UTC (rev 275623)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py 2021-04-07 21:00:24 UTC (rev 275624)
@@ -46,7 +46,7 @@
CleanBuild, CleanUpGitIndexLock, CleanWorkingDirectory, CompileJSC, CompileJSCWithoutPatch, CompileWebKit,
CompileWebKitWithoutPatch, ConfigureBuild, CreateLocalGITCommit,
DownloadBuiltProduct, DownloadBuiltProductFromMaster, EWS_BUILD_HOSTNAME, ExtractBuiltProduct, ExtractTestResults,
- FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, InstallGtkDependencies, InstallWpeDependencies,
+ FetchBranches, FindModifiedChangeLogs, FindModifiedLayoutTests, GitResetHard, InstallGtkDependencies, InstallWpeDependencies,
KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo, ReRunAPITests, ReRunJavaScriptCoreTests, ReRunWebKitPerlTests,
ReRunWebKitTests, RunAPITests, RunAPITestsWithoutPatch, RunBindingsTests, RunBuildWebKitOrgUnitTests,
RunBuildbotCheckConfigForBuildWebKit, RunBuildbotCheckConfigForEWS, RunEWSUnitTests, RunResultsdbpyTests,
@@ -839,6 +839,40 @@
return self.runStep()
+class TestGitResetHard(BuildStepMixinAdditions, unittest.TestCase):
+ def setUp(self):
+ self.longMessage = True
+ return self.setUpBuildStep()
+
+ def tearDown(self):
+ return self.tearDownBuildStep()
+
+ def test_success(self):
+ self.setupStep(GitResetHard())
+ self.expectRemoteCommands(
+ ExpectShell(workdir='wkdir',
+ command=['git', 'reset', 'HEAD~10', '--hard'],
+ logEnviron=False,
+ )
+ + 0,
+ )
+ self.expectOutcome(result=SUCCESS, state_string='Performed git reset --hard')
+ return self.runStep()
+
+ def test_failure(self):
+ self.setupStep(GitResetHard())
+ self.expectRemoteCommands(
+ ExpectShell(workdir='wkdir',
+ command=['git', 'reset', 'HEAD~10', '--hard'],
+ logEnviron=False,
+ )
+ + ExpectShell.log('stdio', stdout='Unexpected error.')
+ + 2,
+ )
+ self.expectOutcome(result=FAILURE, state_string='Performed git reset --hard (failure)')
+ return self.runStep()
+
+
class TestCleanBuild(BuildStepMixinAdditions, unittest.TestCase):
def setUp(self):
self.longMessage = True