aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc/ipc_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-02-08 16:18:19 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-02-08 16:27:53 +0100
commit381ccbf2f8752e9369efc68aacae65f769378ba3 (patch)
treedd38816c52a0c7ebcf473737f7a1c1a1aaa297ae /pkg/ipc/ipc_test.go
parent78a290863d6375b7c568b6fb2b8e34663d42a78a (diff)
pkg/ipc: generate better temp name for executor
Just appending the pid number can produce conflicting names if the name itself ends with digits (standard temp file naming convention). So append ".PID". Also remove beginning from too long names instead of ending. Temp files in tests has unique numbers at the end, we need to preserve them to avoid file name conflicts.
Diffstat (limited to 'pkg/ipc/ipc_test.go')
-rw-r--r--pkg/ipc/ipc_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index 8d0ca7ff5..42d066d08 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -127,8 +127,9 @@ func TestParallel(t *testing.T) {
const P = 10
errs := make(chan error, P)
for p := 0; p < P; p++ {
+ p := p
go func() {
- env, err := MakeEnv(cfg, 0)
+ env, err := MakeEnv(cfg, p)
if err != nil {
errs <- fmt.Errorf("failed to create env: %v", err)
return