diff options
Diffstat (limited to 'src/os')
| -rw-r--r-- | src/os/pipe_test.go | 6 | ||||
| -rw-r--r-- | src/os/signal/signal_test.go | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go index a9e0c8bc8a..ccae6f61bf 100644 --- a/src/os/pipe_test.go +++ b/src/os/pipe_test.go @@ -118,7 +118,7 @@ func TestStdPipe(t *testing.T) { // all writes should fail with EPIPE and then exit 0. for _, sig := range []bool{false, true} { for dest := 1; dest < 4; dest++ { - cmd := testenv.Command(t, os.Args[0], "-test.run", "TestStdPipe") + cmd := testenv.Command(t, testenv.Executable(t), "-test.run", "TestStdPipe") cmd.Stdout = w cmd.Stderr = w cmd.ExtraFiles = []*os.File{w} @@ -145,7 +145,7 @@ func TestStdPipe(t *testing.T) { } // Test redirecting stdout but not stderr. Issue 40076. - cmd := testenv.Command(t, os.Args[0], "-test.run", "TestStdPipe") + cmd := testenv.Command(t, testenv.Executable(t), "-test.run", "TestStdPipe") cmd.Stdout = w var stderr bytes.Buffer cmd.Stderr = &stderr @@ -263,7 +263,7 @@ func TestReadNonblockingFd(t *testing.T) { } defer r.Close() defer w.Close() - cmd := testenv.Command(t, os.Args[0], "-test.run=^"+t.Name()+"$") + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^"+t.Name()+"$") cmd.Env = append(cmd.Environ(), "GO_WANT_READ_NONBLOCKING_FD=1") cmd.Stdin = r output, err := cmd.CombinedOutput() diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go index d54787bc19..0aa0439b90 100644 --- a/src/os/signal/signal_test.go +++ b/src/os/signal/signal_test.go @@ -304,7 +304,7 @@ func TestDetectNohup(t *testing.T) { // We have no intention of reading from c. c := make(chan os.Signal, 1) Notify(c, syscall.SIGHUP) - if out, err := testenv.Command(t, os.Args[0], "-test.run=^TestDetectNohup$", "-check_sighup_ignored").CombinedOutput(); err == nil { + if out, err := testenv.Command(t, testenv.Executable(t), "-test.run=^TestDetectNohup$", "-check_sighup_ignored").CombinedOutput(); err == nil { t.Errorf("ran test with -check_sighup_ignored and it succeeded: expected failure.\nOutput:\n%s", out) } Stop(c) @@ -316,7 +316,7 @@ func TestDetectNohup(t *testing.T) { } Ignore(syscall.SIGHUP) os.Remove("nohup.out") - out, err := testenv.Command(t, "/usr/bin/nohup", os.Args[0], "-test.run=^TestDetectNohup$", "-check_sighup_ignored").CombinedOutput() + out, err := testenv.Command(t, "/usr/bin/nohup", testenv.Executable(t), "-test.run=^TestDetectNohup$", "-check_sighup_ignored").CombinedOutput() data, _ := os.ReadFile("nohup.out") os.Remove("nohup.out") @@ -454,7 +454,7 @@ func TestNohup(t *testing.T) { if subTimeout != 0 { args = append(args, fmt.Sprintf("-test.timeout=%v", subTimeout)) } - out, err := testenv.Command(t, os.Args[0], args...).CombinedOutput() + out, err := testenv.Command(t, testenv.Executable(t), args...).CombinedOutput() if err == nil { t.Errorf("ran test with -send_uncaught_sighup=%d and it succeeded: expected failure.\nOutput:\n%s", i, out) @@ -562,7 +562,7 @@ func TestAtomicStop(t *testing.T) { if deadline, ok := t.Deadline(); ok { timeout = time.Until(deadline).String() } - cmd := testenv.Command(t, os.Args[0], "-test.run=^TestAtomicStop$", "-test.timeout="+timeout) + cmd := testenv.Command(t, testenv.Executable(t), "-test.run=^TestAtomicStop$", "-test.timeout="+timeout) cmd.Env = append(os.Environ(), "GO_TEST_ATOMIC_STOP=1") out, err := cmd.CombinedOutput() if err == nil { @@ -765,7 +765,7 @@ func TestNotifyContextNotifications(t *testing.T) { if subTimeout != 0 { args = append(args, fmt.Sprintf("-test.timeout=%v", subTimeout)) } - out, err := testenv.Command(t, os.Args[0], args...).CombinedOutput() + out, err := testenv.Command(t, testenv.Executable(t), args...).CombinedOutput() if err != nil { t.Errorf("ran test with -check_notify_ctx_notification and it failed with %v.\nOutput:\n%s", err, out) } |
