From 15289d2bc21037d4e7d9b5df4f92e27ac1b7f299 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Wed, 13 May 2020 14:38:46 +1000 Subject: [PATCH] Include repo URL in bisection error. (#3795) --- infra/bisector.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/infra/bisector.py b/infra/bisector.py index 4e88bd8e4..ff8366db7 100644 --- a/infra/bisector.py +++ b/infra/bisector.py @@ -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