Include repo URL in bisection error. (#3795)

This commit is contained in:
Oliver Chang 2020-05-13 14:38:46 +10:00 committed by GitHub
parent afa7132603
commit 15289d2bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -59,6 +59,14 @@ END_MARKERS = [
DEDUP_TOKEN_MARKER = 'DEDUP_TOKEN:'
class BisectError(Exception):
"""Bisection error."""
def __init__(self, message, repo_url):
super().__init__(message)
self.repo_url = repo_url
def main():
"""Finds the commit SHA where an error was initally introduced."""
logging.getLogger().setLevel(logging.INFO)
@ -218,14 +226,14 @@ def _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target,
host_src_dir,
build_data,
base_builder_repo=base_builder_repo):
raise RuntimeError('Failed to build new_commit')
raise BisectError('Failed to build new_commit', repo_url)
if bisect_type == 'fixed':
should_crash = False
elif bisect_type == 'regressed':
should_crash = True
else:
raise ValueError('Invalid bisect type ' + bisect_type)
raise BisectError('Invalid bisect type ' + bisect_type, repo_url)
expected_error = _check_for_crash(build_data.project_name, fuzz_target,
test_case_path)
@ -244,11 +252,11 @@ def _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target,
host_src_dir,
build_data,
base_builder_repo=base_builder_repo):
raise RuntimeError('Failed to build old_commit')
raise BisectError('Failed to build old_commit', repo_url)
if _check_for_crash(build_data.project_name, fuzz_target,
test_case_path) == expected_error:
raise RuntimeError('old_commit had same result as new_commit')
raise BisectError('old_commit had same result as new_commit', repo_url)
while old_idx - new_idx > 1:
curr_idx = (old_idx + new_idx) // 2