]> Cypherpunks repositories - gostls13.git/commit
runtime/pprof: try to use real stack in TestTryAdd
authorMichael Pratt <mpratt@google.com>
Tue, 7 Apr 2020 16:12:44 +0000 (12:12 -0400)
committerMichael Pratt <mpratt@google.com>
Wed, 8 Apr 2020 14:51:58 +0000 (14:51 +0000)
commit0dfb0513ec6a0e97db166bd91a2dc0a1ceb154f7
tree46eef9a3ef3767e4b7d1c54b18beb7415b5daede
parent08dd4ad7e30313d089793f19baff1855bbaa004e
runtime/pprof: try to use real stack in TestTryAdd

TestTryAdd is particularly brittle because it tests some real cases by
constructing fake sample stack frames. If those frames don't correctly
represent what the runtime would generate then they may fail to catch
regressions.

Instead, call runtime.Callers at the bottom of real function calls to
generate real frames as a base for truncation, etc in tests. Several of
these tests still have to fake parts of the frames to test the right
thing, but this is a bit less fragile.

Change-Id: I62522a9ded5544b06d1bf28550af5400f3af667b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227484
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
src/runtime/pprof/pprof_test.go