Debian Codegraph @

internal/integration_test/fuzz/wazerolib/validate.go

raw symbols SCIP
1 package main
2
3 import (
4 "context"
5
6 "github.com/tetratelabs/wazero"
7 "github.com/tetratelabs/wazero/api"
8 "github.com/tetratelabs/wazero/experimental"
9 )
10
11 // Ensure that validation and compilation do not panic!
12 func tryCompile(wasmBin []byte) {
13 ctx := context.Background()
14 r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfigCompiler().
15 WithCoreFeatures(api.CoreFeaturesV2|experimental.CoreFeaturesThreads))
16 defer func() {
17 if err := r.Close(context.Background()); err != nil {
18 panic(err)
19 }
20 }()
21 compiled, err := r.CompileModule(ctx, wasmBin)
22 if err == nil {
23 if err := compiled.Close(context.Background()); err != nil {
24 panic(err)
25 }
26 }
27 }