1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:18:32 -06:00

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
This commit is contained in:
Sanjay Menakuru 2014-08-25 11:29:53 +04:00 committed by Dmitriy Vyukov
parent 38ce599494
commit 639dc6c794

View File

@ -17,10 +17,10 @@ func TestMemStats(t *testing.T) {
st := new(MemStats) st := new(MemStats)
ReadMemStats(st) 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 || 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.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.StackSys == 0 || st.MSpanInuse == 0 || st.MSpanSys == 0 || st.MCacheInuse == 0 ||
st.MCacheSys == 0 || st.BuckHashSys == 0 || st.GCSys == 0 || st.OtherSys == 0 || st.MCacheSys == 0 || st.BuckHashSys == 0 || st.GCSys == 0 || st.OtherSys == 0 ||
st.NextGC == 0 || st.NumGC == 0 { st.NextGC == 0 || st.NumGC == 0 {
@ -40,6 +40,10 @@ func TestMemStats(t *testing.T) {
st.BuckHashSys+st.GCSys+st.OtherSys { st.BuckHashSys+st.GCSys+st.OtherSys {
t.Fatalf("Bad sys value: %+v", *st) 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 var mallocSink uintptr