diff --git a/internal/engine/wazevo/e2e_test.go b/internal/engine/wazevo/e2e_test.go index 6fdd2712..d6021565 100644 --- a/internal/engine/wazevo/e2e_test.go +++ b/internal/engine/wazevo/e2e_test.go @@ -15,6 +15,7 @@ import ( "github.com/tetratelabs/wazero/internal/filecache" "github.com/tetratelabs/wazero/internal/integration_test/spectest" v1 "github.com/tetratelabs/wazero/internal/integration_test/spectest/v1" + v2 "github.com/tetratelabs/wazero/internal/integration_test/spectest/v2" "github.com/tetratelabs/wazero/internal/testing/binaryencoding" "github.com/tetratelabs/wazero/internal/testing/require" "github.com/tetratelabs/wazero/internal/wasm" @@ -113,6 +114,23 @@ func TestSpectestV1(t *testing.T) { } } +func TestSpectestV2(t *testing.T) { + config := wazero.NewRuntimeConfigCompiler().WithCoreFeatures(api.CoreFeaturesV2) + // Configure the new optimizing backend! + configureWazevo(config) + + for _, tc := range []struct { + name string + }{ + // {"conversions"}, includes non-trapping conversions. + } { + t.Run(tc.name, func(t *testing.T) { + spectest.RunCase(t, v2.Testcases, tc.name, context.Background(), config, + -1, 0, math.MaxInt) + }) + } +} + func TestE2E(t *testing.T) { type callCase struct { funcName string // defaults to testcases.ExportedFunctionName diff --git a/internal/integration_test/spectest/v2/spec_test.go b/internal/integration_test/spectest/v2/spec_test.go index d0f697f0..55cbfbed 100644 --- a/internal/integration_test/spectest/v2/spec_test.go +++ b/internal/integration_test/spectest/v2/spec_test.go @@ -1,8 +1,7 @@ -package spectest +package v2 import ( "context" - "embed" "testing" "github.com/tetratelabs/wazero" @@ -11,19 +10,15 @@ import ( "github.com/tetratelabs/wazero/internal/platform" ) -//go:embed testdata/*.wasm -//go:embed testdata/*.json -var testcases embed.FS - const enabledFeatures = api.CoreFeaturesV2 func TestCompiler(t *testing.T) { if !platform.CompilerSupported() { t.Skip() } - spectest.Run(t, testcases, context.Background(), wazero.NewRuntimeConfigCompiler().WithCoreFeatures(enabledFeatures)) + spectest.Run(t, Testcases, context.Background(), wazero.NewRuntimeConfigCompiler().WithCoreFeatures(enabledFeatures)) } func TestInterpreter(t *testing.T) { - spectest.Run(t, testcases, context.Background(), wazero.NewRuntimeConfigInterpreter().WithCoreFeatures(enabledFeatures)) + spectest.Run(t, Testcases, context.Background(), wazero.NewRuntimeConfigInterpreter().WithCoreFeatures(enabledFeatures)) } diff --git a/internal/integration_test/spectest/v2/spectest.go b/internal/integration_test/spectest/v2/spectest.go new file mode 100644 index 00000000..2fa70e03 --- /dev/null +++ b/internal/integration_test/spectest/v2/spectest.go @@ -0,0 +1,9 @@ +package v2 + +import "embed" + +// Testcases is exported for testing wazevo in internal/engine/wazevo. +// +//go:embed testdata/*.wasm +//go:embed testdata/*.json +var Testcases embed.FS