From 4daf8570eba286299489fc3ebc7d788c458bb47a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Apr 2018 18:46:49 +0200 Subject: pkg/host: explain why syscalls are disabled --- pkg/host/host_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pkg/host/host_test.go (limited to 'pkg/host/host_test.go') 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) + } + } +} -- cgit mrf-deployment