From 5ed211ca96c6e6ab96fad7b5a495d81178ee98eb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 12 Mar 2019 12:22:13 +0100 Subject: pkg/vcs: refactor bisection support In preparation for syz-ci bisection: - move bisection function into a separate interface they look out of place in vcs.Repo because most OSes don't implement it and most users don't case - extract author name and more CC emails for commits - move linux-specific PreviousReleaseTags into linux.go - fix inconclusive bisection (more than 1 potential commits) - add tests fr bisection - add maintainers returned from get_maintainers.pl for commits that don't have enough emails (e.g. only author email) Update #501 --- pkg/bisect/bisect.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pkg/bisect') diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index df5dfcd90..10a2eff9e 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -136,7 +136,7 @@ func (env *env) bisect() (*vcs.Commit, error) { if good == "" { return nil, nil // still not fixed } - return env.repo.Bisect(bad, good, cfg.Trace, func() (vcs.BisectResult, error) { + commits, err := env.repo.(vcs.Bisecter).Bisect(bad, good, cfg.Trace, func() (vcs.BisectResult, error) { res, err := env.test() if cfg.Fix { if res == vcs.BisectBad { @@ -147,6 +147,13 @@ func (env *env) bisect() (*vcs.Commit, error) { } return res, err }) + if err != nil { + return nil, err + } + if len(commits) == 1 { + return commits[0], nil + } + return nil, nil } func (env *env) commitRange() (*vcs.Commit, string, string, error) { @@ -173,7 +180,7 @@ func (env *env) commitRangeForFix() (*vcs.Commit, string, string, error) { func (env *env) commitRangeForBug() (*vcs.Commit, string, string, error) { cfg := env.cfg - tags, err := env.repo.PreviousReleaseTags(cfg.Kernel.Commit) + tags, err := env.repo.(vcs.Bisecter).PreviousReleaseTags(cfg.Kernel.Commit) if err != nil { return nil, "", "", err } @@ -312,7 +319,7 @@ func (env *env) processResults(current *vcs.Commit, results []error) (bad, good // Note: linux-specific. func (env *env) buildEnvForCommit(commit string) (*buildEnv, error) { cfg := env.cfg - tags, err := env.repo.PreviousReleaseTags(commit) + tags, err := env.repo.(vcs.Bisecter).PreviousReleaseTags(commit) if err != nil { return nil, err } -- cgit mrf-deployment