forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 golang#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>
- Loading branch information
1 parent
a21503b
commit cc1f5e4
Showing
1 changed file
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters