From 03d9c195daed8fca30b642783f35657aa7e32209 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 24 Aug 2023 18:24:04 +0200 Subject: pkg/bisect: test a subset of releases For older bugs (or for bugs on stable trees), our cause bisection strategy times out while trying to iterate over all reachable tags. Try to be smarter and only take a subset of them, thus limiting the time we spend detecting the bug-free release. Closes #3376. --- pkg/bisect/bisect_test.go | 62 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) (limited to 'pkg/bisect/bisect_test.go') diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index 600a68b60..d44532fe0 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -353,9 +353,9 @@ var bisectionTests = []BisectionTest{ introduced: "605", extraTest: func(t *testing.T, res *Result) { // False negative probability of each run is ~35%. - // We get two "good" results, so our accumulated confidence is ~42%. - assert.Less(t, res.Confidence, 0.5) - assert.Greater(t, res.Confidence, 0.4) + // We get three "good" results, so our accumulated confidence is ~27%. + assert.Less(t, res.Confidence, 0.3) + assert.Greater(t, res.Confidence, 0.2) }, }, // Test bisection returns correct cause with different baseline/config combinations. @@ -955,3 +955,59 @@ func TestMostFrequentReport(t *testing.T) { }) } } + +func TestPickReleaseTags(t *testing.T) { + tests := []struct { + name string + tags []string + ret []string + }{ + { + name: "upstream-clang", + tags: []string{ + "v6.5", "v6.4", "v6.3", "v6.2", "v6.1", "v6.0", "v5.19", + "v5.18", "v5.17", "v5.16", "v5.15", "v5.14", "v5.13", + "v5.12", "v5.11", "v5.10", "v5.9", "v5.8", "v5.7", "v5.6", + "v5.5", "v5.4", + }, + ret: []string{ + "v6.5", "v6.4", "v6.3", "v6.1", "v5.19", "v5.17", "v5.15", + "v5.13", "v5.10", "v5.7", "v5.4", + }, + }, + { + name: "upstream-gcc", + tags: []string{ + "v6.5", "v6.4", "v6.3", "v6.2", "v6.1", "v6.0", "v5.19", + "v5.18", "v5.17", "v5.16", "v5.15", "v5.14", "v5.13", + "v5.12", "v5.11", "v5.10", "v5.9", "v5.8", "v5.7", "v5.6", + "v5.5", "v5.4", "v5.3", "v5.2", "v5.1", "v5.0", "v4.20", "v4.19", + "v4.18", + }, + ret: []string{ + "v6.5", "v6.4", "v6.3", "v6.1", "v5.19", "v5.17", "v5.15", + "v5.13", "v5.10", "v5.7", "v5.4", "v5.1", "v4.19", "v4.18", + }, + }, + { + name: "lts", + tags: []string{ + "v5.15.10", "v5.15.9", "v5.15.8", "v5.15.7", "v5.15.6", + "v5.15.5", "v5.15.4", "v5.15.3", "v5.15.2", "v5.15.1", + "v5.15", "v5.14", "v5.13", "v5.12", "v5.11", "v5.10", + "v5.9", "v5.8", "v5.7", "v5.6", "v5.5", "v5.4", + }, + ret: []string{ + "v5.15.10", "v5.15.9", "v5.15.5", "v5.15", "v5.14", "v5.13", + "v5.11", "v5.9", "v5.7", "v5.5", "v5.4", + }, + }, + } + for _, test := range tests { + test := test + t.Run(test.name, func(t *testing.T) { + ret := pickReleaseTags(append([]string{}, test.tags...)) + assert.Equal(t, test.ret, ret) + }) + } +} -- cgit mrf-deployment