aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/instance/instance_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-25 09:17:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-28 14:22:41 +0100
commitcbd0445ec3b0b184db66966d8a47e6b37d13692e (patch)
tree14ed47723c325ef1b388e4e732a70c0fed4fa101 /pkg/instance/instance_test.go
parent2242f77fdc5a6c50bd8fa1021d2abc8b83e09e8d (diff)
all: make timeouts configurable
Add sys/targets.Timeouts struct that parametrizes timeouts throughout the system. The struct allows to control syscall/program/no output timeouts for OS/arch/VM/etc. See comment on the struct for more details.
Diffstat (limited to 'pkg/instance/instance_test.go')
-rw-r--r--pkg/instance/instance_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/pkg/instance/instance_test.go b/pkg/instance/instance_test.go
index e19f91faf..d95b6623e 100644
--- a/pkg/instance/instance_test.go
+++ b/pkg/instance/instance_test.go
@@ -10,6 +10,7 @@ import (
"strings"
"testing"
+ "github.com/google/syzkaller/pkg/tool"
"github.com/google/syzkaller/sys/targets"
)
@@ -32,7 +33,7 @@ func TestFuzzerCmd(t *testing.T) {
flagDebug := flags.Bool("debug", false, "debug output from executor")
flagV := flags.Int("v", 0, "verbosity")
cmdLine := OldFuzzerCmd(os.Args[0], "/myexecutor", "myname", targets.Linux, targets.I386, "localhost:1234",
- "namespace", 3, true, true)
+ "namespace", 3, true, true, false, 0)
args := strings.Split(cmdLine, " ")[1:]
if err := flags.Parse(args); err != nil {
t.Fatal(err)
@@ -93,10 +94,11 @@ func TestExecprogCmd(t *testing.T) {
flagCollide := flags.Bool("collide", true, "collide syscalls to provoke data races")
flagSignal := flags.Bool("cover", false, "collect feedback signals (coverage)")
flagSandbox := flags.String("sandbox", "none", "sandbox for fuzzing (none/setuid/namespace)")
+ flagSlowdown := flags.Int("slowdown", 1, "")
cmdLine := ExecprogCmd(os.Args[0], "/myexecutor", targets.FreeBSD, targets.I386,
- "namespace", true, false, false, 7, 2, 3, "myprog")
+ "namespace", true, false, false, 7, 2, 3, true, 10, "myprog")
args := strings.Split(cmdLine, " ")[1:]
- if err := flags.Parse(args); err != nil {
+ if err := tool.ParseFlags(flags, args); err != nil {
t.Fatal(err)
}
if len(flags.Args()) != 1 || flags.Arg(0) != "myprog" {
@@ -135,4 +137,7 @@ func TestExecprogCmd(t *testing.T) {
if *flagCollide {
t.Errorf("bad collide: %v, want: %v", *flagCollide, false)
}
+ if *flagSlowdown != 10 {
+ t.Errorf("bad slowdown: %v, want: %v", *flagSlowdown, 10)
+ }
}