]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: scale timeout in TestStackGrowth
authorIan Lance Taylor <iant@golang.org>
Mon, 9 Jul 2018 00:02:48 +0000 (17:02 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 9 Jul 2018 02:18:16 +0000 (02:18 +0000)
Updates #19381

Change-Id: I62b8b0cd7170941af77281eb3aada3802623ec27
Reviewed-on: https://go-review.googlesource.com/122587
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/stack_test.go

index 5d674470c145fd11d422c0edc5ba23b84e309bd6..dc653951412b9dee333dcc87690e8b184e8b65a5 100644 (file)
@@ -7,9 +7,11 @@ package runtime_test
 import (
        "bytes"
        "fmt"
+       "os"
        "reflect"
        "regexp"
        . "runtime"
+       "strconv"
        "strings"
        "sync"
        "sync/atomic"
@@ -126,9 +128,18 @@ func TestStackGrowth(t *testing.T) {
                }()
                <-done
                GC()
+
+               timeout := 20 * time.Second
+               if s := os.Getenv("GO_TEST_TIMEOUT_SCALE"); s != "" {
+                       scale, err := strconv.Atoi(s)
+                       if err == nil {
+                               timeout *= time.Duration(scale)
+                       }
+               }
+
                select {
                case <-done:
-               case <-time.After(20 * time.Second):
+               case <-time.After(timeout):
                        if atomic.LoadUint32(&started) == 0 {
                                t.Log("finalizer did not start")
                        } else {