Skip to content

Commit b56e247

Browse files
ianlancetaylorbradfitz
authored andcommitted
runtime: scale timeout in TestStackGrowth
Updates #19381 Change-Id: I62b8b0cd7170941af77281eb3aada3802623ec27 Reviewed-on: https://go-review.googlesource.com/122587 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent d82256a commit b56e247

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/runtime/stack_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ package runtime_test
77
import (
88
"bytes"
99
"fmt"
10+
"os"
1011
"reflect"
1112
"regexp"
1213
. "runtime"
14+
"strconv"
1315
"strings"
1416
"sync"
1517
"sync/atomic"
@@ -126,9 +128,18 @@ func TestStackGrowth(t *testing.T) {
126128
}()
127129
<-done
128130
GC()
131+
132+
timeout := 20 * time.Second
133+
if s := os.Getenv("GO_TEST_TIMEOUT_SCALE"); s != "" {
134+
scale, err := strconv.Atoi(s)
135+
if err == nil {
136+
timeout *= time.Duration(scale)
137+
}
138+
}
139+
129140
select {
130141
case <-done:
131-
case <-time.After(20 * time.Second):
142+
case <-time.After(timeout):
132143
if atomic.LoadUint32(&started) == 0 {
133144
t.Log("finalizer did not start")
134145
} else {

0 commit comments

Comments
 (0)