aboutsummaryrefslogtreecommitdiffstats
path: root/sys/decl_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-05 13:31:14 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-05 15:52:42 +0200
commitffe7e17368d7ae6c2b40da2ce0703d8ad8a116ac (patch)
tree195b7c32977fdaab05acb1282a727fb480593431 /sys/decl_test.go
parent4fc47026945ebec3fc81d0c897547670034cfb58 (diff)
prog, sys: move types to prog
Large overhaul moves syscalls and arg types from sys to prog. Sys package now depends on prog and contains only generated descriptions of syscalls. Introduce prog.Target type that encapsulates all targer properties, like syscall list, ptr/page size, etc. Also moves OS-dependent pieces like mmap call generation from prog to sys. Update #191
Diffstat (limited to 'sys/decl_test.go')
-rw-r--r--sys/decl_test.go62
1 files changed, 0 insertions, 62 deletions
diff --git a/sys/decl_test.go b/sys/decl_test.go
deleted file mode 100644
index a156f4f61..000000000
--- a/sys/decl_test.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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 sys
-
-import (
- "testing"
-)
-
-func TestResourceCtors(t *testing.T) {
- for _, c := range Syscalls {
- for _, res := range c.InputResources() {
- if len(resourceCtors(res.Desc.Kind, true)) == 0 {
- t.Errorf("call %v requires input resource %v, but there are no calls that can create this resource", c.Name, res.Desc.Name)
- }
- }
- }
-}
-
-func TestTransitivelyEnabledCalls(t *testing.T) {
- t.Parallel()
- calls := make(map[*Syscall]bool)
- for _, c := range Syscalls {
- calls[c] = true
- }
- if trans := TransitivelyEnabledCalls(calls); len(calls) != len(trans) {
- for c := range calls {
- if !trans[c] {
- t.Logf("disabled %v", c.Name)
- }
- }
- t.Fatalf("can't create some resource")
- }
- delete(calls, SyscallMap["epoll_create"])
- if trans := TransitivelyEnabledCalls(calls); len(calls) != len(trans) {
- t.Fatalf("still must be able to create epoll fd with epoll_create1")
- }
- delete(calls, SyscallMap["epoll_create1"])
- trans := TransitivelyEnabledCalls(calls)
- if len(calls)-5 != len(trans) ||
- trans[SyscallMap["epoll_ctl$EPOLL_CTL_ADD"]] ||
- trans[SyscallMap["epoll_ctl$EPOLL_CTL_MOD"]] ||
- trans[SyscallMap["epoll_ctl$EPOLL_CTL_DEL"]] ||
- trans[SyscallMap["epoll_wait"]] ||
- trans[SyscallMap["epoll_pwait"]] {
- t.Fatalf("epoll fd is not disabled")
- }
-}
-
-func TestClockGettime(t *testing.T) {
- t.Parallel()
- calls := make(map[*Syscall]bool)
- for _, c := range Syscalls {
- calls[c] = true
- }
- // Removal of clock_gettime should disable all calls that accept timespec/timeval.
- delete(calls, SyscallMap["clock_gettime"])
- trans := TransitivelyEnabledCalls(calls)
- if len(trans)+10 > len(calls) {
- t.Fatalf("clock_gettime did not disable enough calls: before %v, after %v", len(calls), len(trans))
- }
-}