From: Sanjay Menakuru Date: Mon, 25 Aug 2014 07:29:53 +0000 (+0400) Subject: runtime: Loosen conditions in TestMemstat in an attempt to fix the nacl/arm build. X-Git-Tag: go1.4beta1~722 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=639dc6c794d682dd7efff21107d0e085ed66726c;p=gostls13.git runtime: Loosen conditions in TestMemstat in an attempt to fix the nacl/arm build. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews, khr https://golang.org/cl/128680043 --- diff --git a/src/pkg/runtime/malloc_test.go b/src/pkg/runtime/malloc_test.go index 211d78dc8a..b7795aa1d6 100644 --- a/src/pkg/runtime/malloc_test.go +++ b/src/pkg/runtime/malloc_test.go @@ -17,10 +17,10 @@ func TestMemStats(t *testing.T) { st := new(MemStats) ReadMemStats(st) - // Everything except HeapReleased, because it indeed can be 0. + // Everything except HeapReleased and HeapIdle, because they indeed can be 0. if st.Alloc == 0 || st.TotalAlloc == 0 || st.Sys == 0 || st.Lookups == 0 || st.Mallocs == 0 || st.Frees == 0 || st.HeapAlloc == 0 || st.HeapSys == 0 || - st.HeapIdle == 0 || st.HeapInuse == 0 || st.HeapObjects == 0 || st.StackInuse == 0 || + st.HeapInuse == 0 || st.HeapObjects == 0 || st.StackInuse == 0 || st.StackSys == 0 || st.MSpanInuse == 0 || st.MSpanSys == 0 || st.MCacheInuse == 0 || st.MCacheSys == 0 || st.BuckHashSys == 0 || st.GCSys == 0 || st.OtherSys == 0 || st.NextGC == 0 || st.NumGC == 0 { @@ -40,6 +40,10 @@ func TestMemStats(t *testing.T) { st.BuckHashSys+st.GCSys+st.OtherSys { t.Fatalf("Bad sys value: %+v", *st) } + + if st.HeapIdle+st.HeapInuse != st.HeapSys { + t.Fatalf("HeapIdle(%d) + HeapInuse(%d) should be equal to HeapSys(%d), but isn't.", st.HeapIdle, st.HeapInuse, st.HeapSys) + } } var mallocSink uintptr