From 2675f920652cc9218b4b3dc513c76b0546a5a5ae Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 22 Mar 2018 13:24:02 +0100 Subject: sys/linux: add cgroup descriptions --- pkg/csource/options_test.go | 85 +++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 29 deletions(-) (limited to 'pkg/csource/options_test.go') diff --git a/pkg/csource/options_test.go b/pkg/csource/options_test.go index f3f42a6fc..890bac75f 100644 --- a/pkg/csource/options_test.go +++ b/pkg/csource/options_test.go @@ -29,36 +29,55 @@ func TestParseOptionsCanned(t *testing.T) { // so we need to be able to parse old formats. canned := map[string]Options{ "{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}": Options{ - 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, + Collide: true, + Repeat: true, + Procs: 1, + Sandbox: "none", + Fault: false, + FaultCall: -1, + FaultNth: 0, + EnableTun: true, + UseTmpDir: true, + EnableCgroups: false, + HandleSegv: true, + WaitRepeat: true, + Debug: false, + Repro: false, }, "{Threaded:true Collide:true Repeat:true Procs:1 Sandbox: Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": Options{ - Threaded: true, - Collide: true, - Repeat: true, - Procs: 1, - Sandbox: "", - Fault: false, - FaultCall: -1, - FaultNth: 0, - EnableTun: true, - UseTmpDir: true, - HandleSegv: true, - WaitRepeat: true, - Debug: false, - Repro: false, + Threaded: true, + Collide: true, + Repeat: true, + Procs: 1, + Sandbox: "", + Fault: false, + FaultCall: -1, + FaultNth: 0, + EnableTun: true, + UseTmpDir: true, + EnableCgroups: false, + HandleSegv: true, + WaitRepeat: true, + Debug: false, + Repro: false, + }, + "{Threaded:false Collide:true Repeat:true Procs:1 Sandbox:namespace Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true EnableCgroups:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": Options{ + Threaded: false, + Collide: true, + Repeat: true, + Procs: 1, + Sandbox: "namespace", + Fault: false, + FaultCall: -1, + FaultNth: 0, + EnableTun: true, + UseTmpDir: true, + EnableCgroups: true, + HandleSegv: true, + WaitRepeat: true, + Debug: false, + Repro: false, }, } for data, want := range canned { @@ -76,7 +95,15 @@ func allOptionsSingle() []Options { var opts []Options fields := reflect.TypeOf(Options{}).NumField() for i := 0; i < fields; i++ { - opts = append(opts, enumerateField(Options{}, i)...) + // Because of constraints on options, we need some defaults + // (e.g. no collide without threaded). + opt := Options{ + Threaded: true, + Repeat: true, + Sandbox: "none", + UseTmpDir: true, + } + opts = append(opts, enumerateField(opt, i)...) } return opts } -- cgit mrf-deployment