From 7b90c1c0c42099248fbb849e8a1c3251984688ac Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 9 Apr 2020 11:09:00 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/os/exec/exec_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index 8609b28bd4..d9c9812554 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -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") -- 2.50.0