diff options
| -rw-r--r-- | prog/expr_test.go | 17 | ||||
| -rw-r--r-- | prog/mutation.go | 1 | ||||
| -rw-r--r-- | prog/prog.go | 3 | ||||
| -rw-r--r-- | sys/test/expressions.txt | 11 |
4 files changed, 1 insertions, 31 deletions
diff --git a/prog/expr_test.go b/prog/expr_test.go index adff50c6a..f6c8c8603 100644 --- a/prog/expr_test.go +++ b/prog/expr_test.go @@ -42,23 +42,6 @@ func TestGenerateConditionalFields(t *testing.T) { } } -func TestConditionalResources(t *testing.T) { - // Let's stress test the code and rely on various internal checks. - target, rs, _ := initRandomTargetTest(t, "test", "64") - ct := target.BuildChoiceTable(nil, map[*Syscall]bool{ - target.SyscallMap["test$create_cond_resource"]: true, - target.SyscallMap["test$use_cond_resource"]: true, - }) - iters := 500 - if testing.Short() { - iters /= 10 - } - for i := 0; i < iters; i++ { - p := target.Generate(rs, 10, ct) - p.Mutate(rs, 10, ct, nil, nil) - } -} - func TestMutateConditionalFields(t *testing.T) { target, rs, _ := initRandomTargetTest(t, "test", "64") ct := target.DefaultChoiceTable() diff --git a/prog/mutation.go b/prog/mutation.go index 54f88c175..cf93ce4eb 100644 --- a/prog/mutation.go +++ b/prog/mutation.go @@ -505,6 +505,7 @@ func (t *UnionType) mutate(r *randGen, s *state, arg Arg, ctx ArgCtx) (calls []* index++ } optType, optDir := t.Fields[index].Type, t.Fields[index].Dir(a.Dir()) + removeArg(a.Option) var newOpt Arg newOpt, calls = r.generateArg(s, optType, optDir) replaceArg(arg, MakeUnionArg(t, a.Dir(), newOpt, index)) diff --git a/prog/prog.go b/prog/prog.go index f93293b64..34fcfa6e8 100644 --- a/prog/prog.go +++ b/prog/prog.go @@ -362,9 +362,6 @@ func replaceArg(arg, arg1 Arg) { case *PointerArg: *a = *arg1.(*PointerArg) case *UnionArg: - if a.Option != nil { - removeArg(a.Option) - } *a = *arg1.(*UnionArg) case *DataArg: *a = *arg1.(*DataArg) diff --git a/sys/test/expressions.txt b/sys/test/expressions.txt index 1c1cfbca5..16d5b96a7 100644 --- a/sys/test/expressions.txt +++ b/sys/test/expressions.txt @@ -68,14 +68,3 @@ conditional_union_parent { } test$conditional_union(a ptr[in, conditional_union_parent]) - -resource cond_res[int32] - -test$create_cond_resource() cond_res - -conditional_resouce_struct { - f0 int8 - f1 cond_res (if[value[f0] == 1]) -} - -test$use_cond_resource(a ptr[in, conditional_resouce_struct]) |
