diff options
| author | Russ Cox <rsc@golang.org> | 2014-04-11 00:08:07 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-04-11 00:08:07 -0400 |
| commit | 9d81ade223e105880853ff31d0e04affd2fec488 (patch) | |
| tree | c6a724031ccd00a5fe17dbf444df21563aaa0220 /src/pkg/runtime/stack_test.go | |
| parent | a30eaa12eb2ecb484d3ced8775fadeeb20a21569 (diff) | |
| download | go-9d81ade223e105880853ff31d0e04affd2fec488.tar.xz | |
runtime: make stack growth test shorter
It runs too long in -short mode.
Disable the one in init, because it doesn't respect -short.
Make the part that claims to test execution in a finalizer
actually execute the test in the finalizer.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=aram.h, golang-codereviews, iant, khr
https://golang.org/cl/86550045
Diffstat (limited to 'src/pkg/runtime/stack_test.go')
| -rw-r--r-- | src/pkg/runtime/stack_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/pkg/runtime/stack_test.go b/src/pkg/runtime/stack_test.go index 8add63ad35..9a69704368 100644 --- a/src/pkg/runtime/stack_test.go +++ b/src/pkg/runtime/stack_test.go @@ -132,6 +132,7 @@ func TestStackGrowth(t *testing.T) { defer wg.Done() growStack() }() + wg.Wait() // in locked goroutine wg.Add(1) @@ -141,6 +142,7 @@ func TestStackGrowth(t *testing.T) { growStack() UnlockOSThread() }() + wg.Wait() // in finalizer wg.Add(1) @@ -150,6 +152,7 @@ func TestStackGrowth(t *testing.T) { go func() { s := new(string) SetFinalizer(s, func(ss *string) { + growStack() done <- true }) s = nil @@ -163,17 +166,20 @@ func TestStackGrowth(t *testing.T) { t.Fatal("finalizer did not run") } }() - wg.Wait() } // ... and in init -func init() { - growStack() -} +//func init() { +// growStack() +//} func growStack() { - for i := 0; i < 1<<10; i++ { + n := 1 << 10 + if testing.Short() { + n = 1 << 8 + } + for i := 0; i < n; i++ { x := 0 growStackIter(&x, i) if x != i+1 { |
