diff options
| author | Bryan C. Mills <bcmills@google.com> | 2023-05-02 13:07:26 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-05-04 19:52:29 +0000 |
| commit | 79723f389b630e61c5e9635235b7f4c624ac1379 (patch) | |
| tree | 88696d86ce130583521dd875bcfc779a4b506749 /src/runtime/stack_test.go | |
| parent | a82f69f60e976d1a99c477903f5de98839c24f70 (diff) | |
| download | go-79723f389b630e61c5e9635235b7f4c624ac1379.tar.xz | |
internal/testenv: remove HasExec and simplify other support checks again
HasExec is an attractive nuisance: it is tempting to check in a
TestMain function, but TestMain really shouldn't be running
subprocesses eagerly anyway (they add needless overhead for operations
like 'go test -list=.'), and the trick of re-executing the test binary
to determine whether 'exec' works ends up in infinite recursion if
TestMain itself calls HasExec.
Instead, tests that need to execute a subprocess should call
MustHaveExec or MustHaveExecPath from within a specific test,
or just try to exec the program and check its error status
(perhaps using testenv.SyscallIsNotSupported).
While I'm in here and testing on the SlowBots anyway, a few other
cleanups relating to subprocesses:
- Add more t.Helper calls to support checks where appropriate.
- Remove findGoTool, which can be simplified to exec.LookPath as of
CL 404134.
- Add tests confirming the expected behavior of the support functions
on the Go project's builders.
Change-Id: I163c701b2dd6eb6b7a036c6848f99b64dd9f0838
Reviewed-on: https://go-review.googlesource.com/c/go/+/491660
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/runtime/stack_test.go')
0 files changed, 0 insertions, 0 deletions
