]> Cypherpunks repositories - gostls13.git/commit
runtime: make TestMemStats failure messages useful
authorAustin Clements <austin@google.com>
Fri, 24 Feb 2017 02:40:55 +0000 (21:40 -0500)
committerAustin Clements <austin@google.com>
Fri, 31 Mar 2017 00:46:14 +0000 (00:46 +0000)
commitbda74b0e4a8eb1acae8c202efd62d298ec3268f0
treee9432205f9678c9a5819195ca606bf096d241ce4
parentbc972e8ef870471c3c4ba95b92c5194b37ba2871
runtime: make TestMemStats failure messages useful

Currently most TestMemStats failures dump the whole MemStats object if
anything is amiss without telling you what is amiss, or even which
field is wrong. This makes it hard to figure out what the actual
problem is.

Replace this with a reflection walk over MemStats and a map of
predicates to check. If one fails, we can construct a detailed and
descriptive error message. The predicates are a direct translation of
the current tests.

Change-Id: I5a7cafb8e6a1eeab653d2e18bb74e2245eaa5444
Reviewed-on: https://go-review.googlesource.com/37512
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/malloc_test.go