From: David Lazar Date: Tue, 18 Apr 2017 15:01:02 +0000 (-0400) Subject: runtime: fix TestCaller with -l=4 X-Git-Tag: go1.9beta1~638 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=17137fae2e9abed50a1e6499f0a2fffedc6f0256;p=gostls13.git 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 Reviewed-by: Austin Clements Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- 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)