go/ssa/interp: add internal/syscall/unix.syscall_fcntl to fix tests

CL 100077 added the syscall_fcntl function in the internal/syscall/unix
package to refer to syscall.fcntl outside of the syscall package in a
unified way.

Add a replacement that simulates a successful fcntl call to fix the
interp tests.

Change-Id: I05847d222f18a19cb30f1395497e708a027a002e
Reviewed-on: https://go-review.googlesource.com/106415
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser 2018-04-11 20:41:39 +02:00 committed by Tobias Klauser
parent 368a7e18b5
commit ccd319aab1

View File

@ -32,118 +32,119 @@ var externals = make(map[string]externalFn)
func init() { func init() {
// That little dot ۰ is an Arabic zero numeral (U+06F0), categories [Nd]. // That little dot ۰ is an Arabic zero numeral (U+06F0), categories [Nd].
for k, v := range map[string]externalFn{ for k, v := range map[string]externalFn{
"(*sync.Pool).Get": ext۰sync۰Pool۰Get, "(*sync.Pool).Get": ext۰sync۰Pool۰Get,
"(*sync.Pool).Put": ext۰nop, "(*sync.Pool).Put": ext۰nop,
"(reflect.Value).Bool": ext۰reflect۰Value۰Bool, "(reflect.Value).Bool": ext۰reflect۰Value۰Bool,
"(reflect.Value).CanAddr": ext۰reflect۰Value۰CanAddr, "(reflect.Value).CanAddr": ext۰reflect۰Value۰CanAddr,
"(reflect.Value).CanInterface": ext۰reflect۰Value۰CanInterface, "(reflect.Value).CanInterface": ext۰reflect۰Value۰CanInterface,
"(reflect.Value).Elem": ext۰reflect۰Value۰Elem, "(reflect.Value).Elem": ext۰reflect۰Value۰Elem,
"(reflect.Value).Field": ext۰reflect۰Value۰Field, "(reflect.Value).Field": ext۰reflect۰Value۰Field,
"(reflect.Value).Float": ext۰reflect۰Value۰Float, "(reflect.Value).Float": ext۰reflect۰Value۰Float,
"(reflect.Value).Index": ext۰reflect۰Value۰Index, "(reflect.Value).Index": ext۰reflect۰Value۰Index,
"(reflect.Value).Int": ext۰reflect۰Value۰Int, "(reflect.Value).Int": ext۰reflect۰Value۰Int,
"(reflect.Value).Interface": ext۰reflect۰Value۰Interface, "(reflect.Value).Interface": ext۰reflect۰Value۰Interface,
"(reflect.Value).IsNil": ext۰reflect۰Value۰IsNil, "(reflect.Value).IsNil": ext۰reflect۰Value۰IsNil,
"(reflect.Value).IsValid": ext۰reflect۰Value۰IsValid, "(reflect.Value).IsValid": ext۰reflect۰Value۰IsValid,
"(reflect.Value).Kind": ext۰reflect۰Value۰Kind, "(reflect.Value).Kind": ext۰reflect۰Value۰Kind,
"(reflect.Value).Len": ext۰reflect۰Value۰Len, "(reflect.Value).Len": ext۰reflect۰Value۰Len,
"(reflect.Value).MapIndex": ext۰reflect۰Value۰MapIndex, "(reflect.Value).MapIndex": ext۰reflect۰Value۰MapIndex,
"(reflect.Value).MapKeys": ext۰reflect۰Value۰MapKeys, "(reflect.Value).MapKeys": ext۰reflect۰Value۰MapKeys,
"(reflect.Value).NumField": ext۰reflect۰Value۰NumField, "(reflect.Value).NumField": ext۰reflect۰Value۰NumField,
"(reflect.Value).NumMethod": ext۰reflect۰Value۰NumMethod, "(reflect.Value).NumMethod": ext۰reflect۰Value۰NumMethod,
"(reflect.Value).Pointer": ext۰reflect۰Value۰Pointer, "(reflect.Value).Pointer": ext۰reflect۰Value۰Pointer,
"(reflect.Value).Set": ext۰reflect۰Value۰Set, "(reflect.Value).Set": ext۰reflect۰Value۰Set,
"(reflect.Value).String": ext۰reflect۰Value۰String, "(reflect.Value).String": ext۰reflect۰Value۰String,
"(reflect.Value).Type": ext۰reflect۰Value۰Type, "(reflect.Value).Type": ext۰reflect۰Value۰Type,
"(reflect.Value).Uint": ext۰reflect۰Value۰Uint, "(reflect.Value).Uint": ext۰reflect۰Value۰Uint,
"(reflect.error).Error": ext۰reflect۰error۰Error, "(reflect.error).Error": ext۰reflect۰error۰Error,
"(reflect.rtype).Bits": ext۰reflect۰rtype۰Bits, "(reflect.rtype).Bits": ext۰reflect۰rtype۰Bits,
"(reflect.rtype).Elem": ext۰reflect۰rtype۰Elem, "(reflect.rtype).Elem": ext۰reflect۰rtype۰Elem,
"(reflect.rtype).Field": ext۰reflect۰rtype۰Field, "(reflect.rtype).Field": ext۰reflect۰rtype۰Field,
"(reflect.rtype).In": ext۰reflect۰rtype۰In, "(reflect.rtype).In": ext۰reflect۰rtype۰In,
"(reflect.rtype).Kind": ext۰reflect۰rtype۰Kind, "(reflect.rtype).Kind": ext۰reflect۰rtype۰Kind,
"(reflect.rtype).NumField": ext۰reflect۰rtype۰NumField, "(reflect.rtype).NumField": ext۰reflect۰rtype۰NumField,
"(reflect.rtype).NumIn": ext۰reflect۰rtype۰NumIn, "(reflect.rtype).NumIn": ext۰reflect۰rtype۰NumIn,
"(reflect.rtype).NumMethod": ext۰reflect۰rtype۰NumMethod, "(reflect.rtype).NumMethod": ext۰reflect۰rtype۰NumMethod,
"(reflect.rtype).NumOut": ext۰reflect۰rtype۰NumOut, "(reflect.rtype).NumOut": ext۰reflect۰rtype۰NumOut,
"(reflect.rtype).Out": ext۰reflect۰rtype۰Out, "(reflect.rtype).Out": ext۰reflect۰rtype۰Out,
"(reflect.rtype).Size": ext۰reflect۰rtype۰Size, "(reflect.rtype).Size": ext۰reflect۰rtype۰Size,
"(reflect.rtype).String": ext۰reflect۰rtype۰String, "(reflect.rtype).String": ext۰reflect۰rtype۰String,
"bytes.init": ext۰nop, // avoid asm dependency "bytes.init": ext۰nop, // avoid asm dependency
"bytes.Equal": ext۰bytes۰Equal, "bytes.Equal": ext۰bytes۰Equal,
"bytes.IndexByte": ext۰bytes۰IndexByte, "bytes.IndexByte": ext۰bytes۰IndexByte,
"hash/crc32.haveSSE42": ext۰crc32۰haveSSE42, "hash/crc32.haveSSE42": ext۰crc32۰haveSSE42,
"internal/cpu.cpuid": ext۰cpu۰cpuid, "internal/cpu.cpuid": ext۰cpu۰cpuid,
"math.Abs": ext۰math۰Abs, "internal/syscall/unix.syscall_fcntl": ext۰syscall۰unix۰syscall_fcntl,
"math.Exp": ext۰math۰Exp, "math.Abs": ext۰math۰Abs,
"math.Float32bits": ext۰math۰Float32bits, "math.Exp": ext۰math۰Exp,
"math.Float32frombits": ext۰math۰Float32frombits, "math.Float32bits": ext۰math۰Float32bits,
"math.Float64bits": ext۰math۰Float64bits, "math.Float32frombits": ext۰math۰Float32frombits,
"math.Float64frombits": ext۰math۰Float64frombits, "math.Float64bits": ext۰math۰Float64bits,
"math.Ldexp": ext۰math۰Ldexp, "math.Float64frombits": ext۰math۰Float64frombits,
"math.Log": ext۰math۰Log, "math.Ldexp": ext۰math۰Ldexp,
"math.Min": ext۰math۰Min, "math.Log": ext۰math۰Log,
"math.hasSSE4": ext۰math۰hasSSE4, "math.Min": ext۰math۰Min,
"math.hasVectorFacility": ext۰math۰hasVectorFacility, "math.hasSSE4": ext۰math۰hasSSE4,
"os.runtime_args": ext۰os۰runtime_args, "math.hasVectorFacility": ext۰math۰hasVectorFacility,
"os.runtime_beforeExit": ext۰nop, "os.runtime_args": ext۰os۰runtime_args,
"os/signal.init": ext۰nop, "os.runtime_beforeExit": ext۰nop,
"reflect.New": ext۰reflect۰New, "os/signal.init": ext۰nop,
"reflect.SliceOf": ext۰reflect۰SliceOf, "reflect.New": ext۰reflect۰New,
"reflect.TypeOf": ext۰reflect۰TypeOf, "reflect.SliceOf": ext۰reflect۰SliceOf,
"reflect.ValueOf": ext۰reflect۰ValueOf, "reflect.TypeOf": ext۰reflect۰TypeOf,
"reflect.Zero": ext۰reflect۰Zero, "reflect.ValueOf": ext۰reflect۰ValueOf,
"reflect.init": ext۰reflect۰Init, "reflect.Zero": ext۰reflect۰Zero,
"reflect.valueInterface": ext۰reflect۰valueInterface, "reflect.init": ext۰reflect۰Init,
"runtime.Breakpoint": ext۰runtime۰Breakpoint, "reflect.valueInterface": ext۰reflect۰valueInterface,
"runtime.Caller": ext۰runtime۰Caller, "runtime.Breakpoint": ext۰runtime۰Breakpoint,
"runtime.Callers": ext۰runtime۰Callers, "runtime.Caller": ext۰runtime۰Caller,
"runtime.FuncForPC": ext۰runtime۰FuncForPC, "runtime.Callers": ext۰runtime۰Callers,
"runtime.GC": ext۰runtime۰GC, "runtime.FuncForPC": ext۰runtime۰FuncForPC,
"runtime.GOMAXPROCS": ext۰runtime۰GOMAXPROCS, "runtime.GC": ext۰runtime۰GC,
"runtime.Goexit": ext۰runtime۰Goexit, "runtime.GOMAXPROCS": ext۰runtime۰GOMAXPROCS,
"runtime.Gosched": ext۰runtime۰Gosched, "runtime.Goexit": ext۰runtime۰Goexit,
"runtime.init": ext۰nop, "runtime.Gosched": ext۰runtime۰Gosched,
"runtime.KeepAlive": ext۰nop, "runtime.init": ext۰nop,
"runtime.NumCPU": ext۰runtime۰NumCPU, "runtime.KeepAlive": ext۰nop,
"runtime.NumGoroutine": ext۰runtime۰NumGoroutine, "runtime.NumCPU": ext۰runtime۰NumCPU,
"runtime.ReadMemStats": ext۰runtime۰ReadMemStats, "runtime.NumGoroutine": ext۰runtime۰NumGoroutine,
"runtime.SetFinalizer": ext۰nop, // ignore "runtime.ReadMemStats": ext۰runtime۰ReadMemStats,
"(*runtime.Func).Entry": ext۰runtime۰Func۰Entry, "runtime.SetFinalizer": ext۰nop, // ignore
"(*runtime.Func).FileLine": ext۰runtime۰Func۰FileLine, "(*runtime.Func).Entry": ext۰runtime۰Func۰Entry,
"(*runtime.Func).Name": ext۰runtime۰Func۰Name, "(*runtime.Func).FileLine": ext۰runtime۰Func۰FileLine,
"runtime.environ": ext۰runtime۰environ, "(*runtime.Func).Name": ext۰runtime۰Func۰Name,
"runtime.getgoroot": ext۰runtime۰getgoroot, "runtime.environ": ext۰runtime۰environ,
"strings.init": ext۰nop, // avoid asm dependency "runtime.getgoroot": ext۰runtime۰getgoroot,
"strings.Count": ext۰strings۰Count, "strings.init": ext۰nop, // avoid asm dependency
"strings.Index": ext۰strings۰Index, "strings.Count": ext۰strings۰Count,
"strings.IndexByte": ext۰strings۰IndexByte, "strings.Index": ext۰strings۰Index,
"sync.runtime_Semacquire": ext۰nop, // unimplementable "strings.IndexByte": ext۰strings۰IndexByte,
"sync.runtime_Semrelease": ext۰nop, // unimplementable "sync.runtime_Semacquire": ext۰nop, // unimplementable
"sync.runtime_Syncsemcheck": ext۰nop, // unimplementable "sync.runtime_Semrelease": ext۰nop, // unimplementable
"sync.runtime_notifyListCheck": ext۰nop, "sync.runtime_Syncsemcheck": ext۰nop, // unimplementable
"sync.runtime_registerPoolCleanup": ext۰nop, "sync.runtime_notifyListCheck": ext۰nop,
"sync/atomic.AddInt32": ext۰atomic۰AddInt32, "sync.runtime_registerPoolCleanup": ext۰nop,
"sync/atomic.AddUint32": ext۰atomic۰AddUint32, "sync/atomic.AddInt32": ext۰atomic۰AddInt32,
"sync/atomic.CompareAndSwapInt32": ext۰atomic۰CompareAndSwapInt32, "sync/atomic.AddUint32": ext۰atomic۰AddUint32,
"sync/atomic.CompareAndSwapUint32": ext۰atomic۰CompareAndSwapUint32, "sync/atomic.CompareAndSwapInt32": ext۰atomic۰CompareAndSwapInt32,
"sync/atomic.LoadInt32": ext۰atomic۰LoadInt32, "sync/atomic.CompareAndSwapUint32": ext۰atomic۰CompareAndSwapUint32,
"sync/atomic.LoadUint32": ext۰atomic۰LoadUint32, "sync/atomic.LoadInt32": ext۰atomic۰LoadInt32,
"sync/atomic.StoreInt32": ext۰atomic۰StoreInt32, "sync/atomic.LoadUint32": ext۰atomic۰LoadUint32,
"sync/atomic.StoreUint32": ext۰atomic۰StoreUint32, "sync/atomic.StoreInt32": ext۰atomic۰StoreInt32,
"sync/atomic.AddInt64": ext۰atomic۰AddInt64, "sync/atomic.StoreUint32": ext۰atomic۰StoreUint32,
"sync/atomic.AddUint64": ext۰atomic۰AddUint64, "sync/atomic.AddInt64": ext۰atomic۰AddInt64,
"sync/atomic.CompareAndSwapInt64": ext۰atomic۰CompareAndSwapInt64, "sync/atomic.AddUint64": ext۰atomic۰AddUint64,
"sync/atomic.CompareAndSwapUint64": ext۰atomic۰CompareAndSwapUint64, "sync/atomic.CompareAndSwapInt64": ext۰atomic۰CompareAndSwapInt64,
"sync/atomic.LoadInt64": ext۰atomic۰LoadInt64, "sync/atomic.CompareAndSwapUint64": ext۰atomic۰CompareAndSwapUint64,
"sync/atomic.LoadUint64": ext۰atomic۰LoadUint64, "sync/atomic.LoadInt64": ext۰atomic۰LoadInt64,
"sync/atomic.StoreInt64": ext۰atomic۰StoreInt64, "sync/atomic.LoadUint64": ext۰atomic۰LoadUint64,
"sync/atomic.StoreUint64": ext۰atomic۰StoreUint64, "sync/atomic.StoreInt64": ext۰atomic۰StoreInt64,
"(*sync/atomic.Value).Load": ext۰atomic۰ValueLoad, "sync/atomic.StoreUint64": ext۰atomic۰StoreUint64,
"(*sync/atomic.Value).Store": ext۰atomic۰ValueStore, "(*sync/atomic.Value).Load": ext۰atomic۰ValueLoad,
"testing.MainStart": ext۰testing۰MainStart, "(*sync/atomic.Value).Store": ext۰atomic۰ValueStore,
"time.Sleep": ext۰time۰Sleep, "testing.MainStart": ext۰testing۰MainStart,
"time.now": ext۰time۰now, "time.Sleep": ext۰time۰Sleep,
"time.now": ext۰time۰now,
} { } {
externals[k] = v externals[k] = v
} }
@ -500,6 +501,10 @@ func ext۰cpu۰cpuid(fr *frame, args []value) value {
return tuple{uint32(0), uint32(0), uint32(0), uint32(0)} return tuple{uint32(0), uint32(0), uint32(0), uint32(0)}
} }
func ext۰syscall۰unix۰syscall_fcntl(fr *frame, args []value) value {
return tuple{int(0), wrapError(nil)}
}
// Pretend: type runtime.Func struct { entry *ssa.Function } // Pretend: type runtime.Func struct { entry *ssa.Function }
func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value { func ext۰runtime۰Func۰FileLine(fr *frame, args []value) value {