diff options
| author | Bryan C. Mills <bcmills@google.com> | 2022-10-26 12:18:13 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-10-31 20:53:50 +0000 |
| commit | 84cd7ab3c388fb3280cf426a35045d85cda99ff8 (patch) | |
| tree | c0095494d1b06e22b0d801c0ad33ad50492d2e96 /src/runtime | |
| parent | 76940b3e5749a9936cbc32631e068065c2003267 (diff) | |
| download | go-84cd7ab3c388fb3280cf426a35045d85cda99ff8.tar.xz | |
internal/testenv: add CommandContext and Command
This adds a testenv.CommandContext function, with timeout behavior
based on the existing logic in cmd/go.TestScript: namely, the command
is terminated with SIGQUIT (if supported) with an arbitrary grace
period remaining until the test's deadline.
If the test environment does not support executing subprocesses,
CommandContext skips the test.
If the command is terminated due to the timout expiring or the test
fails to wait for the command after starting it, CommandContext marks
the test as failing.
For tests where a shorter timeout is desired (such as for fail-fast
behavior), one may be supplied using context.WithTimeout.
The more concise Command helper is like CommandContext but without
the need to supply an explicit Context.
Updates #50436.
Change-Id: Ifd81fb86c402f034063c9e9c03045b4106eab81a
Reviewed-on: https://go-review.googlesource.com/c/go/+/445596
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions
