From a2bdbd8c37841cc507a2ad59f25d90d6467e5858 Mon Sep 17 00:00:00 2001 From: Zubin Mithra Date: Tue, 8 Oct 2019 15:57:52 -0700 Subject: pkg/bisect: add initial testing support for cause bisection (note: incomplete change) Refactor existing code as follows: * Move reusable test utility functions from git_repo_test.go to pkg/vcs/test_util.go and make them exported. * Split Run() into Run()+runImpl(). * Change type of bisect.go:env.inst to `instance.BuilderTester`. Change usage inside syz-testbuild/testbuild.go accordingly. * Move most of linux.PreviousReleaseTags() into vcs/git.go as git.previousReleaseTags(). * Allow build.CompilerIdentity to be mocked. Introduce the following changes: * instance.BuilderTester is an interface with methods BuildSyzkaller() BuildKernel() Test() NewEnv() now returns this interface. * type testEnv implements instance.BuilderTester. * type testBuilder implements builder interface. Add a entry into table inside pkg/build/build.go:getBuilder() to return testBuilder object. --- pkg/vcs/git.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pkg/vcs/git.go') diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go index 7b0a621b6..359c3d68e 100644 --- a/pkg/vcs/git.go +++ b/pkg/vcs/git.go @@ -450,3 +450,27 @@ func (git *git) bisectInconclusive(output []byte) ([]*Commit, error) { } return commits, nil } + +func (git *git) previousReleaseTags(commit string, self bool) ([]string, error) { + var tags []string + if self { + output, err := git.git("tag", "--list", "--points-at", commit, "--merged", commit, "v*.*") + if err != nil { + return nil, err + } + tags, err = gitParseReleaseTags(output) + if err != nil { + return nil, err + } + } + output, err := git.git("tag", "--no-contains", commit, "--merged", commit, "v*.*") + if err != nil { + return nil, err + } + tags1, err := gitParseReleaseTags(output) + if err != nil { + return nil, err + } + tags = append(tags, tags1...) + return tags, nil +} -- cgit mrf-deployment