wazevo: adds test harness for v2 spectests (#1683)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
9
internal/integration_test/spectest/v2/spectest.go
Normal file
9
internal/integration_test/spectest/v2/spectest.go
Normal 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
|
||||
Reference in New Issue
Block a user