]> Cypherpunks repositories - gostls13.git/commitdiff
test: fix flakey test case for issue 4388
authorMikio Hara <mikioh.mikioh@gmail.com>
Wed, 14 May 2014 21:39:15 +0000 (06:39 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Wed, 14 May 2014 21:39:15 +0000 (06:39 +0900)
Seems like we need to drag the stack for <autogenerated>:1 on Plan 9.

See http://build.golang.org/log/283b996102b833dd81c58301d78aceaa4fe9838b.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/95390043

test/fixedbugs/issue4388.go

index c8c53b71036f5918a578df8050412210577ac09f..2e052e138d60c600bdaad8242f4121d9d6e945b5 100644 (file)
@@ -43,8 +43,14 @@ func checkLine(n int) {
        if err := recover(); err == nil {
                panic("did not panic")
        }
-       _, file, line, _ := runtime.Caller(n)
-       if file != "<autogenerated>" || line != 1 {
-               panic(fmt.Sprintf("expected <autogenerated>:1 have %s:%d", file, line))
+       var file string
+       var line int
+       for i := 1; i <= n; i++ {
+               _, file, line, _ = runtime.Caller(i)
+               if file != "<autogenerated>" || line != 1 {
+                       continue
+               }
+               return
        }
+       panic(fmt.Sprintf("expected <autogenerated>:1 have %s:%d", file, line))
 }