diff options
author | Bryan C. Mills <bcmills@google.com> | 2022-12-07 16:33:42 -0500 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-12-08 03:52:44 +0000 |
commit | c8313d4fa8ca04a1844edcb4a6e1f61cf13fd40e (patch) | |
tree | 7271469d8bb4703e98e3bc52c9a1ac8652c5a833 /src/cmd/go/internal/test | |
parent | b9747e0e6b82c6de1ebe020841087e8fb1eabccc (diff) | |
download | go-git-c8313d4fa8ca04a1844edcb4a6e1f61cf13fd40e.tar.gz |
cmd/go: deflake TestScript/test2json_interrupt
- Start handling signals in 'go test' just before starting the test
subprocess instead of just after. (It is unlikely that starting the
process will cause cmd/go to hang in a way that requires signals to
debug, and it is possible that something the test does — such as
sending os.Interrupt to its parent processes — will immediately
send a signal that needs to be handled.)
- In the test-test, don't try to re-parse the parent PIDs after
sending signals, and sleep for a much shorter time interval.
(Overrunning the sleep caused the next call to strconv.Atoi — which
shouldn't even happen! — to fail with a parse error, leading to the
failure mode observed in
https://build.golang.org/log/f0982dcfc6a362f9c737eec3e7072dcc7ef29e32.)
Fixes #56083.
Updates #53563.
Change-Id: I346a95bdda5619632659ea854f98a9e17a6aede7
Reviewed-on: https://go-review.googlesource.com/c/go/+/456115
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/test')
-rw-r--r-- | src/cmd/go/internal/test/test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 5a56009829..0051970cfc 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -1306,6 +1306,7 @@ func (r *runTestActor) Act(b *work.Builder, ctx context.Context, a *work.Action) cmd.Env = env } + base.StartSigHandlers() t0 := time.Now() err = cmd.Start() @@ -1314,7 +1315,6 @@ func (r *runTestActor) Act(b *work.Builder, ctx context.Context, a *work.Action) // running. if err == nil { tick := time.NewTimer(testKillTimeout) - base.StartSigHandlers() done := make(chan error) go func() { done <- cmd.Wait() |