1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 var _
= runtime
.Caller
14 var _
= strings
.HasSuffix
17 /* runtime.Caller is not fully implemented for gccgo.
19 func TestCaller(t *testing.T) {
20 procs := runtime.GOMAXPROCS(-1)
21 c := make(chan bool, procs)
22 for p := 0; p < procs; p++ {
24 for i := 0; i < 1000; i++ {
35 func testCallerFoo(t *testing.T) {
39 func testCallerBar(t *testing.T) {
40 for i := 0; i < 2; i++ {
41 pc, file, line, ok := runtime.Caller(i)
42 f := runtime.FuncForPC(pc)
44 !strings.HasSuffix(file, "symtab_test.go") ||
45 (i == 0 && !strings.HasSuffix(f.Name(), "testCallerBar")) ||
46 (i == 1 && !strings.HasSuffix(f.Name(), "testCallerFoo")) ||
47 line < 5 || line > 1000 ||
49 t.Errorf("incorrect symbol info %d: %t %d %d %s %s %d",
50 i, ok, f.Entry(), pc, f.Name(), file, line)