]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: Loosen conditions in TestMemstat in an attempt to fix the nacl/arm build.
authorSanjay Menakuru <balasanjay@gmail.com>
Mon, 25 Aug 2014 07:29:53 +0000 (11:29 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Mon, 25 Aug 2014 07:29:53 +0000 (11:29 +0400)
LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews, khr
https://golang.org/cl/128680043

src/pkg/runtime/malloc_test.go

index 211d78dc8a95f35473188997886adb1ee529cc7d..b7795aa1d66071049fdd88d7a89c7b67d04d462f 100644 (file)
@@ -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