Example #1
0
    def _handle_run(args):
        runner = bisect_runner.BisectRunner()
        while True:
            subprocess_args = ["bisect-env"]
            subprocess_args.extend(
                bisect_runner.bisect_env_args(bisect_runner.read_patchset()))
            subprocess_args.append(args.cmd)
            subprocess_args.extend(args.args)

            quoted_cmd = " ".join(
                [shlex.quote(arg) for arg in subprocess_args])
            bisect_runner.bisect_append_log(f"# $ {quoted_cmd}")
            print(f"$ {quoted_cmd}")

            return_code = subprocess.call(subprocess_args)
            if return_code == 0:
                git_bisect.print_good()
                bisect_runner.bisect_good("HEAD")
            elif return_code == 125:
                git_bisect.print_skip()
                bisect_runner.bisect_skip("HEAD")
            elif return_code == 129:
                git_bisect.print_skip_range()
                patchset = bisect_runner.read_patchset()
                bisect_runner.named_skip("runner-skip", patchset, "HEAD")
            elif 1 <= return_code <= 127:
                git_bisect.print_bad()
                bisect_runner.bisect_bad("HEAD")
            else:
                break
            next_commit = runner.get_next()
            if next_commit is None:
                break
            git.checkout(next_commit)
        return 0
Example #2
0
 def run(self, bisect_fun):
     """Finds the first bad commit"""
     while True:
         next_commit = self.get_next()
         if next_commit is None:
             return
         git.checkout(next_commit)
         result = self._single_run(bisect_fun)
         if result == "bad":
             bisect_bad("HEAD")
             git_bisect.print_bad()
         elif result == "good":
             bisect_good("HEAD")
             git_bisect.print_good()
         elif result.startswith("skip"):
             reason = result[len("skip "):]
             git_bisect.print_skip(reason)
             named_skip(reason, read_patchset(), "HEAD")
         else:
             raise Exception("Unknown bisection result.")
Example #3
0
 def _handle_skip_range(args):
     patchset = bisect_runner.read_patchset()
     bisect_runner.named_skip(args.name, patchset, args.rev)
     git.checkout(bisect_runner.BisectRunner().get_next())
     return 0
Example #4
0
 def _handle_skip(args):
     bisect_runner.bisect_skip(args.rev)
     git.checkout(bisect_runner.BisectRunner().get_next())
     return 0
Example #5
0
 def _handle_good(args):
     print("Good")
     bisect_runner.bisect_good(args.rev)
     git.checkout(bisect_runner.BisectRunner().get_next())
     return 0
Example #6
0
 def _handle_skip(args):
     bisect_runner.bisect_skip(args.rev)
     if bisect_runner.has_good_and_bad():
         git.checkout(bisect_runner.BisectRunner().get_next())
     return 0