Skip to content

Commit f8cc0c8

Browse files
committed
prog: skip large calls in TestHintsRandom
In the test mode that sets debug=true, MutateWithHints is essentially quadratic to the prog(call) size due to numerous validation checks. Skip calls that are too large in order to prevent test hangs. Closes #5637.
1 parent 97f97a1 commit f8cc0c8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

prog/hints_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,16 +655,24 @@ func TestHintsRandom(t *testing.T) {
655655
r := newRand(target, rs)
656656
for i := 0; i < iters; i++ {
657657
p := target.Generate(rs, 5, ct)
658-
for i, c := range p.Calls {
658+
for j, c := range p.Calls {
659659
vals := extractValues(c)
660-
for j := 0; j < 5; j++ {
660+
for k := 0; k < 5; k++ {
661661
vals[r.randInt64()] = true
662662
}
663+
// In the test mode, MutateWithHints is essentially quadratic over the number of values
664+
// since we run full prog validation on each run.
665+
// To avoid consuming too much time, let's just skip all calls that are too big.
666+
const valsCutOff = 10000
667+
if len(vals) > valsCutOff {
668+
t.Logf("iter %d: skipping call %d - too big", i, j)
669+
continue
670+
}
663671
comps := make(CompMap)
664672
for v := range vals {
665673
comps.Add(1, v, r.randInt64(), true)
666674
}
667-
p.MutateWithHints(i, comps, func(p1 *Prog) bool { return true })
675+
p.MutateWithHints(j, comps, func(p1 *Prog) bool { return true })
668676
}
669677
}
670678
}

0 commit comments

Comments
 (0)