aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/modify_a_tryjob.py
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:02:00 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:02:00 +0000
commitfb6e2972318a5d63365e66c35c000a6d2e096501 (patch)
tree35fa0fbaeaaddd9cc2a126a05eee3527b51e83a8 /llvm_tools/modify_a_tryjob.py
parent2186a2d2b9783318bc8226b3eff1fd114f03a8c4 (diff)
parentb75f321fc8978b92ce3db6886ccb966768f0c7a8 (diff)
downloadtoolchain-utils-fb6e2972318a5d63365e66c35c000a6d2e096501.tar.gz
Change-Id: If223f5dd2285da8941d62bcf5daf8e53ec9908ad
Diffstat (limited to 'llvm_tools/modify_a_tryjob.py')
-rwxr-xr-xllvm_tools/modify_a_tryjob.py75
1 files changed, 32 insertions, 43 deletions
diff --git a/llvm_tools/modify_a_tryjob.py b/llvm_tools/modify_a_tryjob.py
index 4d41e6b2..20ba3541 100755
--- a/llvm_tools/modify_a_tryjob.py
+++ b/llvm_tools/modify_a_tryjob.py
@@ -14,12 +14,13 @@ import json
import os
import sys
-import chroot
-import failure_modes
-import get_llvm_hash
-import update_packages_and_run_tests
-import update_tryjob_status
-import update_chromeos_llvm_hash
+from assert_not_in_chroot import VerifyOutsideChroot
+from failure_modes import FailureModes
+from get_llvm_hash import GetLLVMHashAndVersionFromSVNOption
+from update_packages_and_run_tryjobs import RunTryJobs
+from update_tryjob_status import FindTryjobIndex
+from update_tryjob_status import TryjobStatus
+import update_chromeos_llvm_next_hash
class ModifyTryjob(enum.Enum):
@@ -116,16 +117,9 @@ def GetCLAfterUpdatingPackages(packages, git_hash, svn_version, chroot_path,
patch_metadata_file, svn_option):
"""Updates the packages' LLVM_NEXT."""
- change_list = update_chromeos_llvm_hash.UpdatePackages(
- packages,
- update_chromeos_llvm_hash.LLVMVariant.next,
- git_hash,
- svn_version,
- chroot_path,
- patch_metadata_file,
- failure_modes.FailureModes.DISABLE_PATCHES,
- svn_option,
- extra_commit_msg=None)
+ change_list = update_chromeos_llvm_next_hash.UpdatePackages(
+ packages, git_hash, svn_version, chroot_path, patch_metadata_file,
+ FailureModes.DISABLE_PATCHES, svn_option)
print('\nSuccessfully updated packages to %d' % svn_version)
print('Gerrit URL: %s' % change_list.url)
@@ -135,7 +129,7 @@ def GetCLAfterUpdatingPackages(packages, git_hash, svn_version, chroot_path,
def CreateNewTryjobEntryForBisection(cl, extra_cls, options, builder,
- chroot_path, cl_url, revision):
+ chroot_path, verbose, cl_url, revision):
"""Submits a tryjob and adds additional information."""
# Get the tryjob results after submitting the tryjob.
@@ -149,15 +143,15 @@ def CreateNewTryjobEntryForBisection(cl, extra_cls, options, builder,
# 'builder' : [BUILDER_AS_A_LIST]
# }
# ]
- tryjob_results = update_packages_and_run_tests.RunTryJobs(
- cl, extra_cls, options, [builder], chroot_path)
+ tryjob_results = RunTryJobs(cl, extra_cls, options, [builder], chroot_path,
+ verbose)
print('\nTryjob:')
print(tryjob_results[0])
# Add necessary information about the tryjob.
tryjob_results[0]['url'] = cl_url
tryjob_results[0]['rev'] = revision
- tryjob_results[0]['status'] = update_tryjob_status.TryjobStatus.PENDING.value
+ tryjob_results[0]['status'] = TryjobStatus.PENDING.value
tryjob_results[0]['cl'] = cl
return tryjob_results[0]
@@ -167,16 +161,15 @@ def AddTryjob(packages, git_hash, revision, chroot_path, patch_metadata_file,
extra_cls, options, builder, verbose, svn_option):
"""Submits a tryjob."""
- update_chromeos_llvm_hash.verbose = verbose
+ update_chromeos_llvm_next_hash.verbose = verbose
change_list = GetCLAfterUpdatingPackages(packages, git_hash, revision,
chroot_path, patch_metadata_file,
svn_option)
- tryjob_dict = CreateNewTryjobEntryForBisection(change_list.cl_number,
- extra_cls, options, builder,
- chroot_path, change_list.url,
- revision)
+ tryjob_dict = CreateNewTryjobEntryForBisection(
+ change_list.cl_number, extra_cls, options, builder, chroot_path, verbose,
+ change_list.url, revision)
return tryjob_dict
@@ -215,13 +208,12 @@ def PerformTryjobModification(revision, modify_tryjob, status_file, extra_cls,
if not bisect_contents['jobs'] and modify_tryjob != ModifyTryjob.ADD:
sys.exit('No tryjobs in %s' % status_file)
- tryjob_index = update_tryjob_status.FindTryjobIndex(revision,
- bisect_contents['jobs'])
+ tryjob_index = FindTryjobIndex(revision, bisect_contents['jobs'])
# 'FindTryjobIndex()' returns None if the tryjob was not found.
if tryjob_index is None and modify_tryjob != ModifyTryjob.ADD:
- raise ValueError('Unable to find tryjob for %d in %s' %
- (revision, status_file))
+ raise ValueError(
+ 'Unable to find tryjob for %d in %s' % (revision, status_file))
# Determine the action to take based off of 'modify_tryjob'.
if modify_tryjob == ModifyTryjob.REMOVE:
@@ -230,14 +222,13 @@ def PerformTryjobModification(revision, modify_tryjob, status_file, extra_cls,
print('Successfully deleted the tryjob of revision %d' % revision)
elif modify_tryjob == ModifyTryjob.RELAUNCH:
# Need to update the tryjob link and buildbucket ID.
- tryjob_results = update_packages_and_run_tests.RunTryJobs(
+ tryjob_results = RunTryJobs(
bisect_contents['jobs'][tryjob_index]['cl'],
bisect_contents['jobs'][tryjob_index]['extra_cls'],
bisect_contents['jobs'][tryjob_index]['options'],
bisect_contents['jobs'][tryjob_index]['builder'], chroot_path, verbose)
- bisect_contents['jobs'][tryjob_index][
- 'status'] = update_tryjob_status.TryjobStatus.PENDING.value
+ bisect_contents['jobs'][tryjob_index]['status'] = TryjobStatus.PENDING.value
bisect_contents['jobs'][tryjob_index]['link'] = tryjob_results[0]['link']
bisect_contents['jobs'][tryjob_index]['buildbucket_id'] = tryjob_results[0][
'buildbucket_id']
@@ -260,8 +251,7 @@ def PerformTryjobModification(revision, modify_tryjob, status_file, extra_cls,
patch_metadata_file = 'PATCHES.json'
- git_hash, revision = get_llvm_hash.GetLLVMHashAndVersionFromSVNOption(
- revision)
+ git_hash, revision = GetLLVMHashAndVersionFromSVNOption(revision)
tryjob_dict = AddTryjob(update_packages, git_hash, revision, chroot_path,
patch_metadata_file, extra_cls, options, builder,
@@ -273,8 +263,8 @@ def PerformTryjobModification(revision, modify_tryjob, status_file, extra_cls,
else:
raise ValueError('Failed to add tryjob to %s' % status_file)
else:
- raise ValueError('Invalid "modify_tryjob" option provided: %s' %
- modify_tryjob)
+ raise ValueError(
+ 'Invalid "modify_tryjob" option provided: %s' % modify_tryjob)
with open(status_file, 'w') as update_tryjobs:
json.dump(bisect_contents, update_tryjobs, indent=4, separators=(',', ': '))
@@ -283,16 +273,15 @@ def PerformTryjobModification(revision, modify_tryjob, status_file, extra_cls,
def main():
"""Removes, relaunches, or adds a tryjob."""
- chroot.VerifyOutsideChroot()
+ VerifyOutsideChroot()
args_output = GetCommandLineArgs()
- PerformTryjobModification(args_output.revision,
- ModifyTryjob(args_output.modify_tryjob),
- args_output.status_file,
- args_output.extra_change_lists, args_output.options,
- args_output.builder, args_output.chroot_path,
- args_output.verbose)
+ PerformTryjobModification(
+ args_output.revision, ModifyTryjob(
+ args_output.modify_tryjob), args_output.status_file,
+ args_output.extra_change_lists, args_output.options, args_output.builder,
+ args_output.chroot_path, args_output.verbose)
if __name__ == '__main__':