aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/options_test.go
diff options
context:
space:
mode:
authorAndrey Artemiev <artemiev@google.com>2022-08-06 05:17:33 -0700
committerGitHub <noreply@github.com>2022-08-06 14:17:33 +0200
commit88e3a1226bc591d81c1fb98e83cb63cd4f341c6e (patch)
tree323b7fa492a8d9698e432c1d3bd4514771fc3252 /pkg/csource/options_test.go
parente853abd9a2542fcccb8e1a23eb8ae475500ecaf9 (diff)
pkg/csource, pkg/instance, pkg/ipc, pkg/mgrconfig, tools/syz-prog2c, syz-manager: introduce a new setting 'sandbox_arg' (#3263)
Diffstat (limited to 'pkg/csource/options_test.go')
-rw-r--r--pkg/csource/options_test.go53
1 files changed, 53 insertions, 0 deletions
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)