go/ssa/interp: add fake runtime.callerName to fix broken tests

We are inching towards the point at which I blow away this entire
package, or at least all tests that interpret the standard "testing"
package.

Change-Id: I06d99aac6d7baab14ee6c6a61afe0af34b814767
Reviewed-on: https://go-review.googlesource.com/80356
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alan Donovan 2017-11-28 15:46:15 -05:00
parent 6d70fb2e85
commit 0e42b0fe40

View File

@ -139,6 +139,7 @@ func init() {
"sync/atomic.StoreInt64": ext۰atomic۰StoreInt64,
"sync/atomic.StoreUint64": ext۰atomic۰StoreUint64,
"testing.callerEntry": ext۰testing۰callerEntry,
"testing.callerName": ext۰testing۰callerName,
"testing.runExample": ext۰testing۰runExample,
"time.Sleep": ext۰time۰Sleep,
"time.now": ext۰time۰now,
@ -527,10 +528,19 @@ func ext۰testing۰runExample(fr *frame, args []value) value {
return true
}
// These two internal functions must be faked to avoid calls to
// runtime.CallersFrames, which is hard to emulate. We are inching
// towards the point at which I blow away this entire package, or at
// least all tests that interpret the standard "testing" package.
func ext۰testing۰callerEntry(fr *frame, args []value) value {
return uintptr(0) // bogus implementation for now
}
func ext۰testing۰callerName(fr *frame, args []value) value {
return "<unknown>" // bogus implementation for now
}
func ext۰time۰now(fr *frame, args []value) value {
nano := time.Now().UnixNano()
return tuple{int64(nano / 1e9), int32(nano % 1e9), int64(0)}