diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-04-06 18:46:49 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-04-06 18:47:56 +0200 |
| commit | 4daf8570eba286299489fc3ebc7d788c458bb47a (patch) | |
| tree | 99b413a3fad8b7f7bf87c6a1fe957aa0a6112d75 /pkg/host/host_test.go | |
| parent | 48a846e42b1ef210d410b783656c59d5c2827e11 (diff) | |
pkg/host: explain why syscalls are disabled
Diffstat (limited to 'pkg/host/host_test.go')
| -rw-r--r-- | pkg/host/host_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pkg/host/host_test.go b/pkg/host/host_test.go new file mode 100644 index 000000000..470a6e5e1 --- /dev/null +++ b/pkg/host/host_test.go @@ -0,0 +1,45 @@ +// Copyright 2015 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package host + +import ( + "runtime" + "testing" + + "github.com/google/syzkaller/prog" + _ "github.com/google/syzkaller/sys" +) + +func TestLog(t *testing.T) { + t.Parallel() + target, err := prog.GetTarget(runtime.GOOS, runtime.GOARCH) + if err != nil { + t.Fatal(err) + } + // Dump for manual inspection. + supp, disabled, err := DetectSupportedSyscalls(target, "none") + if err != nil { + t.Skipf("skipping: %v", err) + } + for c, ok := range supp { + if !ok { + t.Fatalf("map contains false value for %v", c.Name) + } + } + t.Logf("unsupported:") + for c, reason := range disabled { + t.Logf("%v: %v", c.Name, reason) + } + trans := target.TransitivelyEnabledCalls(supp) + t.Logf("\n\ntransitively unsupported:") + for _, c := range target.Syscalls { + s, ok := trans[c] + if ok && !s { + t.Fatalf("map contains false value") + } + if !s && supp[c] { + t.Logf("%v", c.Name) + } + } +} |
