]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: extend grace period in TestExtraFiles to 20% of overall deadline
authorBryan C. Mills <bcmills@google.com>
Thu, 9 Apr 2020 15:09:00 +0000 (11:09 -0400)
committerIan Lance Taylor <iant@golang.org>
Fri, 10 Apr 2020 01:36:31 +0000 (01:36 +0000)
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>
src/os/exec/exec_test.go

index 8609b28bd4923a533545832ed2164ea9ab8c24b7..d9c98125546fad8e1581e9d9bbc1d4a810830a96 100644 (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")