aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/llvm_bisection.py
diff options
context:
space:
mode:
Diffstat (limited to 'llvm_tools/llvm_bisection.py')
-rwxr-xr-xllvm_tools/llvm_bisection.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm_tools/llvm_bisection.py b/llvm_tools/llvm_bisection.py
index 37320baf..c8d694cd 100755
--- a/llvm_tools/llvm_bisection.py
+++ b/llvm_tools/llvm_bisection.py
@@ -13,6 +13,7 @@ import enum
import errno
import json
import os
+import subprocess
import sys
import chroot
@@ -117,6 +118,13 @@ def GetCommandLineArgs():
help='display contents of a command to the terminal '
'(default: %(default)s)')
+ # Add argument for whether to display command contents to `stdout`.
+ parser.add_argument(
+ '--nocleanup',
+ action='store_false',
+ dest='cleanup',
+ help='Abandon CLs created for bisectoin')
+
args_output = parser.parse_args()
assert args_output.start_rev < args_output.end_rev, (
@@ -348,6 +356,19 @@ def main(args_output):
'\n'.join(str(rev) for rev in skip_revisions))
print(skip_revisions_message)
+ if args_output.cleanup:
+ # Abondon all the CLs created for bisection
+ gerrit = os.path.join(args_output.chroot_path, 'chromite/bin/gerrit')
+ for build in bisect_state['jobs']:
+ try:
+ subprocess.check_output([gerrit, 'abandon', build['cl']],
+ stderr=subprocess.STDOUT,
+ encoding='utf-8')
+ except subprocess.CalledProcessError as err:
+ # the CL may have been abandoned
+ if 'chromite.lib.gob_util.GOBError' not in err.output:
+ raise
+
return BisectionExitStatus.BISECTION_COMPLETE.value
for rev in revisions: