runtime: eliminate arbitrary timeouts in runBuiltTestProg and TestGdbBacktrace

This may fix the TestEINTR failures that have been frequent on the
riscv64 builders since CL 445597.

Updates #37405.
Updates #39043.

Change-Id: Iaf1403ff5ce2ff0203d5d0059908097d32d0b217
Reviewed-on: https://go-review.googlesource.com/c/go/+/447495
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2022-11-03 09:08:33 -04:00 committed by Gopher Robot
parent edfe078349
commit 0758a7d82d
2 changed files with 43 additions and 9 deletions

View file

@ -6,7 +6,6 @@ package runtime_test
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
@ -66,15 +65,17 @@ func runBuiltTestProg(t *testing.T, exe, name string, env ...string) string {
t.Skip("-quick")
}
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
cmd := testenv.CleanCmdEnv(testenv.CommandContext(t, ctx, exe, name))
start := time.Now()
cmd := testenv.CleanCmdEnv(testenv.Command(t, exe, name))
cmd.Env = append(cmd.Env, env...)
if testing.Short() {
cmd.Env = append(cmd.Env, "RUNTIME_TEST_SHORT=1")
}
out, err := cmd.CombinedOutput()
if err != nil {
if err == nil {
t.Logf("%v (%v): ok", cmd, time.Since(start))
} else {
if _, ok := err.(*exec.ExitError); ok {
t.Logf("%v: %v", cmd, err)
} else if errors.Is(err, exec.ErrWaitDelay) {