diff options
author | David Lazar <lazard@golang.org> | 2017-04-18 11:01:02 -0400 |
---|---|---|
committer | David Lazar <lazard@golang.org> | 2017-04-18 19:56:48 +0000 |
commit | 17137fae2e9abed50a1e6499f0a2fffedc6f0256 (patch) | |
tree | 16288dd250d9288b17ed5b71416792dca0085bef /src/runtime/symtab_test.go | |
parent | 7821be59519b65182e4399425b6e6d908252c11b (diff) | |
download | go-17137fae2e9abed50a1e6499f0a2fffedc6f0256.tar.gz go-17137fae2e9abed50a1e6499f0a2fffedc6f0256.zip |
runtime: fix TestCaller with -l=4
Only the noinline pragma on testCallerFoo is needed to pass the test,
but the second pragma makes the test robust to future changes to the
inliner.
Change-Id: I80b384380c598f52e0382f53b59bb47ff196363d
Reviewed-on: https://go-review.googlesource.com/40877
Run-TryBot: David Lazar <lazard@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/symtab_test.go')
-rw-r--r-- | src/runtime/symtab_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/symtab_test.go b/src/runtime/symtab_test.go index b15a2e9a85..57642a49fb 100644 --- a/src/runtime/symtab_test.go +++ b/src/runtime/symtab_test.go @@ -26,10 +26,14 @@ func TestCaller(t *testing.T) { } } +// These are marked noinline so that we can use FuncForPC +// in testCallerBar. +//go:noinline func testCallerFoo(t *testing.T) { testCallerBar(t) } +//go:noinline func testCallerBar(t *testing.T) { for i := 0; i < 2; i++ { pc, file, line, ok := runtime.Caller(i) |