Documentation
¶
Overview ¶
Package enginetest contains tests common to any wasm.Engine implementation. Defining these as top-level functions is less burden than copy/pasting the implementations, while still allowing test caching to operate.
In simplest case, dispatch:
func TestModuleEngine_Call(t *testing.T) { enginetest.RunTestModuleEngineCall(t, NewEngine) }
Some tests using the Compiler Engine may need to guard as they use compiled features:
func TestModuleEngine_Call(t *testing.T) { requireSupportedOSArch(t) enginetest.RunTestModuleEngineCall(t, NewEngine) }
Note: These tests intentionally avoid using wasm.Store as it is important to know both the dependencies and the capabilities at the wasm.Engine abstraction.
Index ¶
- func RunTestEngineMemoryGrowInRecursiveCall(t *testing.T, et EngineTester)
- func RunTestEngineNewModuleEngine(t *testing.T, et EngineTester)
- func RunTestModuleEngineBeforeListenerGlobals(t *testing.T, et EngineTester)
- func RunTestModuleEngineBeforeListenerStackIterator(t *testing.T, et EngineTester)
- func RunTestModuleEngineCall(t *testing.T, et EngineTester)
- func RunTestModuleEngineCallHostFn(t *testing.T, et EngineTester)
- func RunTestModuleEngineCallWithStack(t *testing.T, et EngineTester)
- func RunTestModuleEngineLookupFunction(t *testing.T, et EngineTester)
- func RunTestModuleEngineMemory(t *testing.T, et EngineTester)
- func RunTestModuleEngineStackIteratorOffset(t *testing.T, et EngineTester)
- func RunTestModuleEngine_Call_Errors(t *testing.T, et EngineTester)
- type EngineTester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunTestEngineMemoryGrowInRecursiveCall ¶ added in v1.1.0
func RunTestEngineMemoryGrowInRecursiveCall(t *testing.T, et EngineTester)
RunTestEngineMemoryGrowInRecursiveCall ensures that it's safe to grow memory in the recursive Wasm calls.
func RunTestEngineNewModuleEngine ¶ added in v1.1.0
func RunTestEngineNewModuleEngine(t *testing.T, et EngineTester)
func RunTestModuleEngineBeforeListenerGlobals ¶ added in v1.1.0
func RunTestModuleEngineBeforeListenerGlobals(t *testing.T, et EngineTester)
This tests that the Globals provided by the Engine to the Before hook of the listener is properly able to read the values of the globals.
func RunTestModuleEngineBeforeListenerStackIterator ¶ added in v1.1.0
func RunTestModuleEngineBeforeListenerStackIterator(t *testing.T, et EngineTester)
RunTestModuleEngineBeforeListenerStackIterator tests that the StackIterator provided by the Engine to the Before hook of the listener is properly able to walk the stack. As an example, it validates that the following call stack is properly walked:
- f1(2,3,4) [no return, no local]
- calls f2(no arg) [1 return, 1 local]
- calls f3(5) [1 return, no local]
- calls f4(6) [1 return, HOST]
func RunTestModuleEngineCall ¶ added in v1.1.0
func RunTestModuleEngineCall(t *testing.T, et EngineTester)
func RunTestModuleEngineCallHostFn ¶ added in v1.1.0
func RunTestModuleEngineCallHostFn(t *testing.T, et EngineTester)
func RunTestModuleEngineCallWithStack ¶ added in v1.1.0
func RunTestModuleEngineCallWithStack(t *testing.T, et EngineTester)
func RunTestModuleEngineLookupFunction ¶ added in v1.1.0
func RunTestModuleEngineLookupFunction(t *testing.T, et EngineTester)
func RunTestModuleEngineMemory ¶ added in v1.1.0
func RunTestModuleEngineMemory(t *testing.T, et EngineTester)
RunTestModuleEngineMemory shows that the byte slice returned from api.Memory Read is not a copy, rather a re-slice of the underlying memory. This allows both host and Wasm to see each other's writes, unless one side changes the capacity of the slice.
Known cases that change the slice capacity: * Host code calls append on a byte slice returned by api.Memory Read * Wasm code calls wasm.OpcodeMemoryGrowName and this changes the capacity (by default, it will).
func RunTestModuleEngineStackIteratorOffset ¶ added in v1.2.0
func RunTestModuleEngineStackIteratorOffset(t *testing.T, et EngineTester)
func RunTestModuleEngine_Call_Errors ¶
func RunTestModuleEngine_Call_Errors(t *testing.T, et EngineTester)
Types ¶
type EngineTester ¶
type EngineTester interface { NewEngine(enabledFeatures api.CoreFeatures) wasm.Engine ListenerFactory() experimental.FunctionListenerFactory }