]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/debug: deflake TestFreeOSMemory
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 20 Feb 2013 08:34:16 +0000 (12:34 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 20 Feb 2013 08:34:16 +0000 (12:34 +0400)
This is followup to https://golang.org/cl/7319050/

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7379043

src/pkg/runtime/debug/garbage_test.go

index 5fda5ca1ae129a427e481afbe2fe5a08d9d6a5a7..b93cfee56852f91c5e4dcf5d41465a1ea98f1392 100644 (file)
@@ -70,12 +70,14 @@ func TestReadGCStats(t *testing.T) {
        }
 }
 
-var big []byte
+var big = make([]byte, 1<<20)
 
 func TestFreeOSMemory(t *testing.T) {
        var ms1, ms2 runtime.MemStats
 
-       big = make([]byte, 1<<20)
+       if big == nil {
+               t.Skip("test is not reliable when run multiple times")
+       }
        big = nil
        runtime.GC()
        runtime.ReadMemStats(&ms1)