Skip to content

Commit 2184b15

Browse files
Ethan Grahamtarasmadan
authored andcommitted
prog: only generate one call per KFuzzTest program
1 parent 57f0a9a commit 2184b15

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

prog/generation.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@ func (target *Target) Generate(rs rand.Source, ncalls int, ct *ChoiceTable) *Pro
1515
}
1616
r := newRand(target, rs)
1717
s := newState(target, ct, nil)
18+
Loop:
1819
for len(p.Calls) < ncalls {
1920
calls := r.generateCall(s, p, len(p.Calls))
2021
for _, c := range calls {
2122
s.analyze(c)
2223
p.Calls = append(p.Calls, c)
24+
// Stop generating calls as soon as we have hit a KFuzzTest call,
25+
// as there isn't must point in chaining these together. These
26+
// are designed to be enabled in isolation, so we expect to generate
27+
// programs consisting of exactly one KFuzzTest call.
28+
if c.Meta.Attrs.KFuzzTest {
29+
break Loop
30+
}
2331
}
2432
}
2533
// For the last generated call we could get additional calls that create

0 commit comments

Comments
 (0)