Skip to content

Commit

Permalink
only compile wasm with darwin and linux for now
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
Adrian Cole committed Aug 4, 2022
1 parent 868ec94 commit a949b30
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions wasm_exec/internal/compilertest/compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ func compileJsWasm(t *testing.T, goSrc string) []byte {
if err != nil {
t.Skip("Skipping tests due to missing Go binary: ", err)
}
// For some reason, windows and freebsd fail to compile with exit status 1.
if os := runtime.GOOS; os != "darwin" && os != "linux" {
t.Skip("Skipping tests due to not yet supported OS: ", os)
}

workDir := t.TempDir()

bin := "out.wasm"
goArgs := []string{"build", "-o", bin, "."}
err = os.WriteFile(filepath.Join(workDir, "main.go"), []byte(goSrc), 0o600)
require.NoError(t, err)

Expand All @@ -105,7 +107,8 @@ func compileJsWasm(t *testing.T, goSrc string) []byte {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

cmd := exec.CommandContext(ctx, goBin, goArgs...) //nolint:gosec
bin := "out.wasm"
cmd := exec.CommandContext(ctx, goBin, "build", "-o", bin, ".") //nolint:gosec
cmd.Env = append(os.Environ(), "GOOS=js", "GOARCH=wasm")
cmd.Dir = workDir
out, err := cmd.CombinedOutput()
Expand Down

0 comments on commit a949b30

Please sign in to comment.