From 21724cb2543a5ebc632f065d59d8a4d93c708210 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 11 Aug 2022 10:40:01 +0200 Subject: prog: make TestRotationCoverage test more robust Currently we do 2e3 iterations or rotation and test that we selected each syscall at least once. This both takes lots of time and results in episodic flakes. Loop 1e4 iterations or until we selected each syscall at least once. This will result it fewer flakes and also may be faster in common case. --- prog/rotation_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'prog/rotation_test.go') diff --git a/prog/rotation_test.go b/prog/rotation_test.go index 37308f95b..0c2a059d8 100644 --- a/prog/rotation_test.go +++ b/prog/rotation_test.go @@ -63,10 +63,17 @@ func TestRotationCoverage(t *testing.T) { counters[call.Name] = 0 } rotator := MakeRotator(target, calls, rand.New(rs)) - for iter := 0; iter < 2e3; iter++ { +nextIter: + for iter := 0; iter < 1e4; iter++ { for call := range rotator.Select() { counters[call.Name]++ } + for _, count := range counters { + if count == 0 { + continue nextIter + } + } + break } type pair struct { name string -- cgit mrf-deployment