diff options
| author | Ian Lance Taylor <iant@golang.org> | 2018-07-08 16:42:33 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2018-07-09 17:48:35 +0000 |
| commit | 9b7a8aaaf3adbc330ef724fb581b3bfa72ab2a49 (patch) | |
| tree | 57e959ec214c0414b52b6a23de0d483815a68035 /src/runtime | |
| parent | a41d21695cad0e30d9c006198cd7edd8c38bf885 (diff) | |
| download | go-9b7a8aaaf3adbc330ef724fb581b3bfa72ab2a49.tar.xz | |
runtime: only run TestMemStats sanity tests once
Fixes #22696
Change-Id: Ibe4628f71d64a2b36b655ea69710a925924b12a3
Reviewed-on: https://go-review.googlesource.com/122586
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/malloc_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/malloc_test.go b/src/runtime/malloc_test.go index 0bce059f7f..e6afc25ea9 100644 --- a/src/runtime/malloc_test.go +++ b/src/runtime/malloc_test.go @@ -19,7 +19,11 @@ import ( "unsafe" ) +var testMemStatsCount int + func TestMemStats(t *testing.T) { + testMemStatsCount++ + // Make sure there's at least one forced GC. GC() @@ -35,6 +39,13 @@ func TestMemStats(t *testing.T) { } le := func(thresh float64) func(interface{}) error { return func(x interface{}) error { + // These sanity tests aren't necessarily valid + // with high -test.count values, so only run + // them once. + if testMemStatsCount > 1 { + return nil + } + if reflect.ValueOf(x).Convert(reflect.TypeOf(thresh)).Float() < thresh { return nil } |
