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

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