Moves test-only symbols out of wazero package (#597)
This moves the compiler support flag out of the public package as it was only put there for tests. This also files modgen under the testing subdir so that it isn't mistaken for main code. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
|
||||
package wazero
|
||||
|
||||
// CompilerSupported returns whether the compiler is supported in this environment.
|
||||
const CompilerSupported = true
|
||||
|
||||
// NewRuntimeConfig returns NewRuntimeConfigCompiler
|
||||
func NewRuntimeConfig() RuntimeConfig {
|
||||
return NewRuntimeConfigCompiler()
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
package wazero
|
||||
|
||||
// CompilerSupported returns whether the compiler is supported in this environment.
|
||||
const CompilerSupported = false
|
||||
|
||||
// NewRuntimeConfig returns NewRuntimeConfigInterpreter
|
||||
func NewRuntimeConfig() RuntimeConfig {
|
||||
return NewRuntimeConfigInterpreter()
|
||||
|
||||
@@ -6,6 +6,9 @@ var (
|
||||
newArchContext func() archContext
|
||||
)
|
||||
|
||||
// IsSupported returns whether the compiler is supported on this architecture.
|
||||
const IsSupported = isSupported
|
||||
|
||||
// nativecall is used by callEngine.execWasmFunction and the entrypoint to enter the compiled native code.
|
||||
// codeSegment is the pointer to the initial instruction of the compiled native code.
|
||||
// ce is "*callEngine" as uintptr.
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||
)
|
||||
|
||||
const isSupported = true
|
||||
|
||||
// init initializes variables for the amd64 architecture
|
||||
func init() {
|
||||
newArchContext = newArchContextImpl
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||
)
|
||||
|
||||
const isSupported = true
|
||||
|
||||
// init initializes variables for the arm64 architecture
|
||||
func init() {
|
||||
newArchContext = newArchContextImpl
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
"github.com/tetratelabs/wazero/internal/wazeroir"
|
||||
)
|
||||
|
||||
const isSupported = false
|
||||
|
||||
// archContext is empty on an unsupported architecture.
|
||||
type archContext struct{}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/tetratelabs/wazero"
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
"github.com/tetratelabs/wazero/internal/engine/compiler"
|
||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||
"github.com/tetratelabs/wazero/internal/wasm"
|
||||
"github.com/tetratelabs/wazero/sys"
|
||||
@@ -46,7 +47,7 @@ var tests = map[string]func(t *testing.T, r wazero.Runtime){
|
||||
}
|
||||
|
||||
func TestEngineCompiler(t *testing.T) {
|
||||
if !wazero.CompilerSupported {
|
||||
if !compiler.IsSupported {
|
||||
t.Skip()
|
||||
}
|
||||
runAllTests(t, tests, wazero.NewRuntimeConfigCompiler())
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/tetratelabs/wazero"
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
"github.com/tetratelabs/wazero/internal/engine/compiler"
|
||||
"github.com/tetratelabs/wazero/internal/testing/hammer"
|
||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||
"github.com/tetratelabs/wazero/sys"
|
||||
@@ -18,7 +19,7 @@ var hammers = map[string]func(t *testing.T, r wazero.Runtime){
|
||||
}
|
||||
|
||||
func TestEngineCompiler_hammer(t *testing.T) {
|
||||
if !wazero.CompilerSupported {
|
||||
if !compiler.IsSupported {
|
||||
t.Skip()
|
||||
}
|
||||
runAllTests(t, hammers, wazero.NewRuntimeConfigCompiler())
|
||||
|
||||
Reference in New Issue
Block a user