diff options
Diffstat (limited to 'pkg/bisect')
| -rw-r--r-- | pkg/bisect/bisect.go | 7 | ||||
| -rw-r--r-- | pkg/bisect/bisect_test.go | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 4fbeeec4f..1f3d8ea61 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -71,6 +71,7 @@ const NumTests = 10 // number of tests we do per commit // - Commit is nil // - NoopChange is set if the commit did not cause any change in the kernel binary // (bisection result it most likely wrong) +// - Bisected to a release commit // - if bisection is inconclusive, range of potential cause/fix commits in Commits // - report is nil in such case // - Commit is nil @@ -83,6 +84,7 @@ type Result struct { Report *report.Report Commit *vcs.Commit NoopChange bool + IsRelease bool } // Run does the bisection and returns either the Result, @@ -221,6 +223,11 @@ func (env *env) bisect() (*Result, error) { } if len(commits) == 1 { com := commits[0] + isRelease, err := env.bisecter.IsRelease(com.Hash) + if err != nil { + env.log("failed to detect release: %v", err) + } + res.IsRelease = isRelease if testRes := results[com.Hash]; testRes != nil { res.Report = testRes.rep if testRes.kernelSign != "" && len(com.Parents) == 1 { diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index 01dbfd44e..56e5e5ccb 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -127,6 +127,7 @@ type BisectionTest struct { expectErr bool expectRep bool noopChange bool + isRelease bool commitLen int oldestLatest int // input and output @@ -177,6 +178,7 @@ func TestBisectionResults(t *testing.T) { startCommit: 400, commitLen: 1, culprit: 500, + isRelease: true, }, // Tests that fix bisection returns error when crash does not reproduce // on the original commit. @@ -254,6 +256,7 @@ func TestBisectionResults(t *testing.T) { sameBinaryStart: 405, sameBinaryEnd: 500, noopChange: true, + isRelease: true, }, { name: "cause-same-binary-release2", @@ -285,6 +288,14 @@ func TestBisectionResults(t *testing.T) { sameBinaryEnd: 905, noopChange: true, }, + { + name: "fix-release", + fix: true, + startCommit: 400, + commitLen: 1, + culprit: 900, + isRelease: true, + }, } for _, test := range tests { test := test @@ -328,6 +339,9 @@ func TestBisectionResults(t *testing.T) { if res.NoopChange != test.noopChange { t.Fatalf("got noop change: %v, want: %v", res.NoopChange, test.noopChange) } + if res.IsRelease != test.isRelease { + t.Fatalf("got release change: %v, want: %v", res.IsRelease, test.isRelease) + } if test.oldestLatest != 0 && fmt.Sprint(test.oldestLatest) != res.Commit.Title || test.oldestLatest == 0 && res.Commit != nil { t.Fatalf("expected latest/oldest: %v got '%v'", |
