]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix TestCaller with -l=4
authorDavid Lazar <lazard@golang.org>
Tue, 18 Apr 2017 15:01:02 +0000 (11:01 -0400)
committerDavid Lazar <lazard@golang.org>
Tue, 18 Apr 2017 19:56:48 +0000 (19:56 +0000)
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>

src/runtime/symtab_test.go

index b15a2e9a855a19594b53cc1b94fde2b8b125bc32..57642a49fbda5a70260f9a405206ef3e32879d37 100644 (file)
@@ -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)