From 4538d6d746f2dc7443cb25940513ef23dbb275f0 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 10 Dec 2019 10:59:01 +0100 Subject: pkg/bisect: add test for #1527 Update #1527 --- pkg/bisect/bisect_test.go | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'pkg/bisect') diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index 56e5e5ccb..701b35edc 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -74,7 +74,18 @@ func runBisection(t *testing.T, test BisectionTest) (*Result, error) { } for rv := 4; rv < 10; rv++ { for i := 0; i < 6; i++ { - repo.CommitChange(fmt.Sprintf("%v", rv*100+i)) + if rv == 7 && i == 0 { + // Create a slightly special commit graph here (for #1527): + // Commit 650 is part of 700 release, but it does not have + // 600 (the previous release) in parents, instead it's based + // on the previous-previous release 500. + repo.Git("checkout", "v5.0") + com := repo.CommitChange("650") + repo.Git("checkout", "master") + repo.Git("merge", "-m", "700", com.Hash) + } else { + repo.CommitChange(fmt.Sprintf("%v", rv*100+i)) + } if i == 0 { repo.SetTag(fmt.Sprintf("v%v.0", rv)) } @@ -168,7 +179,7 @@ func TestBisectionResults(t *testing.T) { startCommit: 802, brokenStart: 500, brokenEnd: 700, - commitLen: 14, + commitLen: 15, culprit: 605, }, // Tests that bisection returns the correct fix commit. @@ -296,6 +307,17 @@ func TestBisectionResults(t *testing.T) { culprit: 900, isRelease: true, }, + { + name: "cause-not-in-previous-release", + startCommit: 905, + culprit: 650, + commitLen: 1, + expectRep: true, + sameBinaryStart: 500, + sameBinaryEnd: 650, + // This should be (see #1527): + // noopChange: true, + }, } for _, test := range tests { test := test -- cgit mrf-deployment