1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:54:45 -07:00

os/exec: extend grace period in TestExtraFiles to 20% of overall deadline

Updates #25628

Change-Id: I938a7646521b34779a3a57833e7ce9d508b58faf
Reviewed-on: https://go-review.googlesource.com/c/go/+/227765
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Bryan C. Mills 2020-04-09 11:09:00 -04:00 committed by Ian Lance Taylor
parent 28157b3292
commit 7b90c1c0c4

View File

@ -690,8 +690,12 @@ func TestExtraFiles(t *testing.T) {
// Use a deadline to try to get some output even if the program hangs.
ctx := context.Background()
if deadline, ok := t.Deadline(); ok {
// Leave a 20% grace period to flush output, which may be large on the
// linux/386 builders because we're running the subprocess under strace.
deadline = deadline.Add(-time.Until(deadline) / 5)
var cancel context.CancelFunc
ctx, cancel = context.WithDeadline(ctx, deadline.Add(-time.Second))
ctx, cancel = context.WithDeadline(ctx, deadline)
defer cancel()
}
c := helperCommandContext(t, ctx, "read3")