From e1e5c79fdc5d97de74f449dfb42a8a8ddfb2e728 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 May 2021 12:48:10 +0200 Subject: prog: extend TestEnabledCalls test Enable random set of syscalls to test more combinations. --- prog/rand_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'prog') diff --git a/prog/rand_test.go b/prog/rand_test.go index 60cf28a1c..629dffaf5 100644 --- a/prog/rand_test.go +++ b/prog/rand_test.go @@ -80,11 +80,18 @@ func generateProg(t *testing.T, target *Target, rs rand.Source, ct *ChoiceTable, // Checks that a generated program contains only enabled syscalls. func TestEnabledCalls(t *testing.T) { target, rs, iters := initTest(t) - enabledCalls := map[string]bool{"open": true, "read": true, "dup3": true, "write": true, "close": true} + enabledCalls := make(map[string]bool) enabled := make(map[*Syscall]bool) - for c := range enabledCalls { - enabled[target.SyscallMap[c]] = true + rnd := rand.New(rs) + for i := 0; i < len(target.Syscalls)/10; i++ { + c := target.Syscalls[rnd.Intn(len(target.Syscalls))] + enabled[c] = true + enabledCalls[c.Name] = true } + c := target.SyscallMap["clock_gettime"] + enabled[c] = true + enabledCalls[c.Name] = true + ct := target.BuildChoiceTable(nil, enabled) const tries = 10 for i := 0; i < tries; i++ { -- cgit mrf-deployment