cmd/internal/script: help deflake "WaitDelay expired" errors by reporting the duration

Issue #76685 has many watchflake reports that include the error
"WaitDelay expired". I have been able to reproduce some of those flakes.

The cmd/link testscripts have the highest volume on #76685, such as:
    script_test_basics.txt:6: cc -c testdata/mumble.c: exec: WaitDelay expired before I/O complete

To help triage, this CL adds the os/exec.Cmd.WaitDelay duration to
the error string. That sample error becomes:
    script_test_basics.txt:6: cc -c testdata/mumble.c: exec: WaitDelay expired before I/O complete: output pipes not closed after waiting 100ms

The 100ms shown is a concrete clue that the WaitDelay could be higher.
The next CL 785722 attempts to address that, hopefully eliminating those
particular flakes.

This code path is used by cmd/link tests, as well as testscript tests
in cmd/go, cmd/compile, cmd/internal/fuzztest, and cmd/internal/test2json.

Updates #76685
Updates #79409

Change-Id: Ib03dceccb839dc7653b86ca977e1a54bb48e7ead
Reviewed-on: https://go-review.googlesource.com/c/go/+/785820
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
1 file changed
tree: cd4a7db5373773855e8a86fc9802a948dea5ad7e
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. misc/
  6. src/
  7. test/
  8. .gitattributes
  9. .gitignore
  10. codereview.cfg
  11. CONTRIBUTING.md
  12. go.env
  13. LICENSE
  14. PATENTS
  15. README.md
  16. SECURITY.md
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.