aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rotation_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-08-11 10:40:01 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-08-11 14:40:25 +0200
commit21724cb2543a5ebc632f065d59d8a4d93c708210 (patch)
treebb4c744feb710338c5387c459e45c3cfeedca150 /prog/rotation_test.go
parent3e4f27bdcc4a69ccbe5fd7f9c1ad62bb40283e1c (diff)
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.
Diffstat (limited to 'prog/rotation_test.go')
-rw-r--r--prog/rotation_test.go9
1 files changed, 8 insertions, 1 deletions
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