Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Skip tests if WASM isn't enabled
  • Loading branch information
kyleconroy committed Dec 5, 2023
commit 64b18c3d88790ba61e6924c690b13f058acf811f
1 change: 1 addition & 0 deletions internal/endtoend/case_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Exec struct {
Contexts []string `json:"contexts"`
Process string `json:"process"`
OS []string `json:"os"`
WASM bool `json:"wasm"`
Env map[string]string `json:"env"`
}

Expand Down
5 changes: 5 additions & 0 deletions internal/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/sqlc-dev/sqlc/internal/cmd"
"github.com/sqlc-dev/sqlc/internal/config"
"github.com/sqlc-dev/sqlc/internal/ext/wasm"
"github.com/sqlc-dev/sqlc/internal/opts"
)

Expand Down Expand Up @@ -169,6 +170,10 @@ func TestReplay(t *testing.T) {
}
}

if args.WASM && !wasm.Enabled() {
t.Skipf("wasm support not enabled")
}

if len(args.OS) > 0 {
if !slices.Contains(args.OS, runtime.GOOS) {
t.Skipf("unsupported os: %s", runtime.GOOS)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"wasm": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"wasm": true
}
4 changes: 4 additions & 0 deletions internal/ext/wasm/nowasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
"google.golang.org/grpc/status"
)

func Enabled() bool {
return false
}

func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error {
return status.Error(codes.FailedPrecondition, "sqlc built without wasmtime support")
}
Expand Down
4 changes: 4 additions & 0 deletions internal/ext/wasm/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import (
"github.com/sqlc-dev/sqlc/internal/plugin"
)

func Enabled() bool {
return true
}

// This version must be updated whenever the wasmtime-go dependency is updated
const wasmtimeVersion = `v14.0.0`

Expand Down