diff options
| author | Mara Mihali <maramihali@google.com> | 2021-07-06 11:36:45 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2021-07-06 15:47:33 +0200 |
| commit | 1729cf6917b3e2fe4a22101a05e833f717bca8ce (patch) | |
| tree | 2f2c835115a75eec528a9cd39e33e9e9396f486e /pkg/instance | |
| parent | 22ff12bdbb3509fbf00cd979af4629b50aaff7a3 (diff) | |
pkg/instance: added threaded and collide flags
These can be used to disable threaded execution and collision mode for program's system calls.
Diffstat (limited to 'pkg/instance')
| -rw-r--r-- | pkg/instance/instance.go | 6 | ||||
| -rw-r--r-- | pkg/instance/instance_test.go | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 19c71c067..c65d97cce 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -500,6 +500,8 @@ var MakeBin = func() string { return "make" }() -func RunnerCmd(prog, fwdAddr, os, arch string, poolIdx, vmIdx int) string { - return fmt.Sprintf("%s -addr=%s -os=%s -arch=%s -pool=%v -vm=%v", prog, fwdAddr, os, arch, poolIdx, vmIdx) +func RunnerCmd(prog, fwdAddr, os, arch string, poolIdx, vmIdx int, collide, threaded bool) string { + return fmt.Sprintf("%s -addr=%s -os=%s -arch=%s -pool=%d -vm=%d "+ + "-collide=%t -threaded=%t", prog, fwdAddr, os, arch, poolIdx, vmIdx, + collide, threaded) } diff --git a/pkg/instance/instance_test.go b/pkg/instance/instance_test.go index c5d8cd1d1..7d2ce3031 100644 --- a/pkg/instance/instance_test.go +++ b/pkg/instance/instance_test.go @@ -149,8 +149,10 @@ func TestRunnerCmd(t *testing.T) { flagArch := flags.String("arch", "", "target architecture") flagPool := flags.Int("pool", 0, "index of pool that started VM") flagVM := flags.Int("vm", 0, "index of VM that started the Runner") + flagCollide := flags.Bool("collide", true, "collide syscalls to provoke data races") + flagThreaded := flags.Bool("threaded", true, "use threaded mode in executor") - cmdLine := RunnerCmd(os.Args[0], "localhost:1234", targets.Linux, targets.AMD64, 0, 0) + cmdLine := RunnerCmd(os.Args[0], "localhost:1234", targets.Linux, targets.AMD64, 0, 0, false, false) args := strings.Split(cmdLine, " ")[1:] if err := flags.Parse(args); err != nil { t.Fatalf("error parsing flags: %v, want: nil", err) @@ -175,4 +177,12 @@ func TestRunnerCmd(t *testing.T) { if got, want := *flagVM, 0; got != want { t.Errorf("bad vm index: %d, want: %d", got, want) } + + if got, want := *flagCollide, false; got != want { + t.Errorf("bad collide: %t, want: %t", got, want) + } + + if got, want := *flagThreaded, false; got != want { + t.Errorf("bad threaded: %t, want: %t", got, want) + } } |
