From 88e3a1226bc591d81c1fb98e83cb63cd4f341c6e Mon Sep 17 00:00:00 2001 From: Andrey Artemiev Date: Sat, 6 Aug 2022 05:17:33 -0700 Subject: pkg/csource, pkg/instance, pkg/ipc, pkg/mgrconfig, tools/syz-prog2c, syz-manager: introduce a new setting 'sandbox_arg' (#3263) --- pkg/csource/options_test.go | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'pkg/csource/options_test.go') diff --git a/pkg/csource/options_test.go b/pkg/csource/options_test.go index 5e971a9d1..41d7cdbab 100644 --- a/pkg/csource/options_test.go +++ b/pkg/csource/options_test.go @@ -5,6 +5,7 @@ package csource import ( "fmt" + "math" "reflect" "testing" @@ -79,6 +80,32 @@ func TestParseOptionsCanned(t *testing.T) { FaultNth: 2, }, }, + `{"threaded":true,"collide":true,"repeat":true,"procs":10,"sandbox":"android", + "sandbox_arg":9,"fault":true,"fault_call":1,"fault_nth":2,"tun":true,"tmpdir":true,"cgroups":true, + "netdev":true,"resetnet":true, + "segv":true,"waitrepeat":true,"debug":true,"repro":true}`: { + Threaded: true, + Repeat: true, + Procs: 10, + Slowdown: 1, + Sandbox: "android", + SandboxArg: 9, + NetInjection: true, + NetDevices: true, + NetReset: true, + Cgroups: true, + BinfmtMisc: false, + CloseFDs: true, + UseTmpDir: true, + HandleSegv: true, + Repro: true, + LegacyOptions: LegacyOptions{ + Collide: true, + Fault: true, + FaultCall: 1, + FaultNth: 2, + }, + }, "{Threaded:true Collide:true Repeat:true Procs:1 Sandbox:none Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": { Threaded: true, Repeat: true, @@ -139,6 +166,27 @@ func TestParseOptionsCanned(t *testing.T) { FaultNth: 0, }, }, + "{Threaded:false Collide:true Repeat:true Procs:1 Sandbox:namespace SandboxArg:-234 Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true EnableCgroups:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": { + Threaded: false, + Repeat: true, + Procs: 1, + Slowdown: 1, + Sandbox: "namespace", + SandboxArg: -234, + NetInjection: true, + Cgroups: true, + BinfmtMisc: false, + CloseFDs: true, + UseTmpDir: true, + HandleSegv: true, + Repro: false, + LegacyOptions: LegacyOptions{ + Collide: true, + Fault: false, + FaultCall: -1, + FaultNth: 0, + }, + }, } for data, want := range canned { got, err := DeserializeOptions([]byte(data)) @@ -206,6 +254,11 @@ func enumerateField(OS string, opt Options, field int) []Options { fld.SetString(sandbox) opts = append(opts, opt) } + } else if fldName == "SandboxArg" { + for _, sandboxArg := range []int64{math.MinInt, math.MaxInt} { + fld.SetInt(sandboxArg) + opts = append(opts, opt) + } } else if fldName == "Procs" { for _, procs := range []int64{1, 4} { fld.SetInt(procs) -- cgit mrf-deployment