aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-01-07 14:31:14 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-01-07 14:31:14 +0100
commit36860d8b256045601248ecfc0323ac838779e72b (patch)
tree0eddd5017b01b1336adbd720ad509c16a65a3f52 /prog/mutation.go
parentd817520681553e36f8ce01f56fc8f8570e5ccc7c (diff)
prog: increase array size during mutation
We have strict upper bound of array size 10. However, for netlink we frequently need lots of attributes in arrays. Add a mutation that increases array size by few elements without an upper bound (we should not grow them infinitely due to coverage feedback?).
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 571b54a3f..7868c6445 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -382,8 +382,14 @@ func (t *ArrayType) mutate(r *randGen, s *state, arg Arg, ctx ArgCtx) (calls []*
count := uint64(0)
switch t.Kind {
case ArrayRandLen:
- for count == uint64(len(a.Inner)) {
- count = r.randArrayLen()
+ if r.bin() {
+ for count = uint64(len(a.Inner)); r.bin(); {
+ count++
+ }
+ } else {
+ for count == uint64(len(a.Inner)) {
+ count = r.randArrayLen()
+ }
}
case ArrayRangeLen:
if t.RangeBegin == t.RangeEnd {