wazevo: adds test harness for v2 spectests (#1683)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Takeshi Yoneda
2023-09-05 07:39:45 +09:00
committed by GitHub
parent 7b51812bcc
commit f5adeffde8
3 changed files with 30 additions and 8 deletions

View File

@@ -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

View File

@@ -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))
}

View File

@@ -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