From 3552691137284525a33d3de7e3c2d170da66c8ac Mon Sep 17 00:00:00 2001 From: Bhasker Hariharan Date: Wed, 6 Nov 2019 22:28:41 -0800 Subject: Fix data race in syscall_test_runner.go Fixes #1140 PiperOrigin-RevId: 279012793 --- test/syscalls/syscall_test_runner.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/syscalls/syscall_test_runner.go b/test/syscalls/syscall_test_runner.go index 856398994..7186a8ddc 100644 --- a/test/syscalls/syscall_test_runner.go +++ b/test/syscalls/syscall_test_runner.go @@ -208,14 +208,15 @@ func runRunsc(tc gtest.TestCase, spec *specs.Spec) error { } log.Warningf("%s: Got signal: %v", name, s) done := make(chan bool) - go func() { - dArgs := append(args, "-alsologtostderr=true", "debug", "--stacks", id) + dArgs := append([]string{}, args...) + dArgs = append(dArgs, "-alsologtostderr=true", "debug", "--stacks", id) + go func(dArgs []string) { cmd := exec.Command(*runscPath, dArgs...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr cmd.Run() done <- true - }() + }(dArgs) timeout := time.After(3 * time.Second) select { @@ -225,7 +226,7 @@ func runRunsc(tc gtest.TestCase, spec *specs.Spec) error { } log.Warningf("Send SIGTERM to the sandbox process") - dArgs := append(args, "debug", + dArgs = append(args, "debug", fmt.Sprintf("--signal=%d", syscall.SIGTERM), id) cmd = exec.Command(*runscPath, dArgs...) -- cgit v1.2.3