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/linux.go | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'pkg/vcs/linux.go') diff --git a/pkg/vcs/linux.go b/pkg/vcs/linux.go index e12682277..aaca97fe7 100644 --- a/pkg/vcs/linux.go +++ b/pkg/vcs/linux.go @@ -31,30 +31,10 @@ func newLinux(dir string) *linux { } func (ctx *linux) PreviousReleaseTags(commit string) ([]string, error) { - return ctx.previousReleaseTags(commit, false) -} - -func (ctx *linux) previousReleaseTags(commit string, self bool) ([]string, error) { - var tags []string - if self { - output, err := ctx.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 := ctx.git.git("tag", "--no-contains", commit, "--merged", commit, "v*.*") - if err != nil { - return nil, err - } - tags1, err := gitParseReleaseTags(output) + tags, err := ctx.git.previousReleaseTags(commit, false) if err != nil { return nil, err } - tags = append(tags, tags1...) for i, tag := range tags { if tag == "v4.0" { // Initially we tried to stop at 3.8 because: -- cgit mrf-deployment