aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/llvm_bisection.py
diff options
context:
space:
mode:
authorJian Cai <jiancai@google.com>2020-08-23 20:09:02 -0700
committerJian Cai <jiancai@google.com>2020-10-02 23:41:23 +0000
commitb9a429906b7815cd9aeca6674f26e6e2e3ba56dd (patch)
treee6f169155c15bac835b476037497fca0ffa02520 /llvm_tools/llvm_bisection.py
parentfb8fd5be362ec7a52dc3be33859d31b0553c1038 (diff)
downloadtoolchain-utils-b9a429906b7815cd9aeca6674f26e6e2e3ba56dd.tar.gz
llvm_tools: abandon CLs after completing LLVM bisection.
Abandon CLs created for bisection if LLVM bisection successfully found the root cause. BUG=chromium:1081457 TEST=Verified locally. Change-Id: I3702c38432fbaf87f7df62418c0b29cbe4ca722a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2382420 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
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: