diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-05-03 11:29:12 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-05-03 12:55:42 +0200 |
| commit | 58ae5e18624eaaac79cab00e63d6f32c9bd64ee0 (patch) | |
| tree | 00515dd9b2e461102e898930df00bc80400bf996 /prog/rand_test.go | |
| parent | 5457883a514281287bbd81364c4e26e25828563d (diff) | |
prog: remove StructDesc
Remove StructDesc, KeyedStruct, StructKey and all associated
logic/complexity in prog and pkg/compiler.
We can now handle recursion more generically with the Ref type,
and Dir/FieldName are not a part of the type anymore.
This makes StructType/UnionType simpler and more natural.
Reduces size of sys/linux/gen/amd64.go from 5201321 to 4180861 (-20%).
Update #1580
Diffstat (limited to 'prog/rand_test.go')
| -rw-r--r-- | prog/rand_test.go | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/prog/rand_test.go b/prog/rand_test.go index 6f251cb7c..da0871505 100644 --- a/prog/rand_test.go +++ b/prog/rand_test.go @@ -101,22 +101,20 @@ func TestEnabledCalls(t *testing.T) { func TestSizeGenerateConstArg(t *testing.T) { target, rs, iters := initRandomTargetTest(t, "test", "64") r := newRand(target, rs) - for _, c := range target.Syscalls { - foreachType(c, func(typ Type, ctx typeCtx) { - if _, ok := typ.(*IntType); !ok { - return - } - bits := typ.TypeBitSize() - limit := uint64(1<<bits - 1) - for i := 0; i < iters; i++ { - newArg, _ := typ.generate(r, nil, ctx.Dir) - newVal := newArg.(*ConstArg).Val - if newVal > limit { - t.Fatalf("invalid generated value: %d. (arg bitsize: %d; max value: %d)", newVal, bits, limit) - } + ForeachType(target.Syscalls, func(typ Type, ctx TypeCtx) { + if _, ok := typ.(*IntType); !ok { + return + } + bits := typ.TypeBitSize() + limit := uint64(1<<bits - 1) + for i := 0; i < iters; i++ { + newArg, _ := typ.generate(r, nil, ctx.Dir) + newVal := newArg.(*ConstArg).Val + if newVal > limit { + t.Fatalf("invalid generated value: %d. (arg bitsize: %d; max value: %d)", newVal, bits, limit) } - }) - } + } + }) } func TestFlags(t *testing.T) { |
