aboutsummaryrefslogtreecommitdiffhomepage
path: root/main_test.go
diff options
context:
space:
mode:
authorTakeshi Yoneda <[email protected]>2020-09-30 04:58:03 +0900
committerGitHub <[email protected]>2020-09-29 21:58:03 +0200
commitf50ad3585d084b17f7754f4b3cb0d42661fee036 (patch)
treeaf67bd0e7bcf470cf703ffa70fa6ee7b48e7bdb5 /main_test.go
parentd39c7abb4d618b817e8ae0bd77eb54c7ba3a61bb (diff)
downloadtinygo-f50ad3585d084b17f7754f4b3cb0d42661fee036.tar.gz
tinygo-f50ad3585d084b17f7754f4b3cb0d42661fee036.zip
support WASI target (#1373)
* initial commit for WASI support * merge "time" package with wasi build tag * override syscall package with wasi build tag * create runtime_wasm_{js,wasi}.go files * create syscall_wasi.go file * create time/zoneinfo_wasi.go file as the replacement of zoneinfo_js.go * add targets/wasi.json target * set visbility hidden for runtime extern variables Accodring to the WASI docs (https://github.com/WebAssembly/WASI/blob/master/design/application-abi.md#current-unstable-abi), none of exports of WASI executable(Command) should no be accessed. v0.19.0 of bytecodealliance/wasmetime, which is often refered to as the reference implementation of WASI, does not accept any exports except functions and the only limited variables like "table", "memory". * merge syscall_{baremetal,wasi}.go * fix js target build * mv wasi functions to syscall/wasi && implement sleepTicks * WASI: set visibility hidden for globals variables * mv back syscall/wasi/* to runtime package * WASI: add test * unexport wasi types * WASI test: fix wasmtime path * stop changing visibility of runtime.alloc * use GOOS=linux, GOARCH=arm for wasi target Signed-off-by: mathetake <[email protected]> * WASI: fix build tags for os/runtime packages Signed-off-by: mathetake <[email protected]> * run WASI test only on Linux Signed-off-by: mathetake <[email protected]> * set InternalLinkage instead of changing visibility Signed-off-by: mathetake <[email protected]>
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/main_test.go b/main_test.go
index f66117b90..ac01baafa 100644
--- a/main_test.go
+++ b/main_test.go
@@ -98,6 +98,10 @@ func TestCompiler(t *testing.T) {
runPlatTests("wasm", matches, t)
})
}
+
+ t.Run("WASI", func(t *testing.T) {
+ runPlatTests("wasi", matches, t)
+ })
}
}
@@ -109,7 +113,6 @@ func runPlatTests(target string, matches []string, t *testing.T) {
t.Run(filepath.Base(path), func(t *testing.T) {
t.Parallel()
-
runTest(path, target, t)
})
}
@@ -161,6 +164,11 @@ func runTest(path, target string, t *testing.T) {
PrintSizes: "",
WasmAbi: "js",
}
+
+ if target == "wasi" {
+ config.WasmAbi = "generic"
+ }
+
binary := filepath.Join(tmpdir, "test")
err = runBuild("./"+path, binary, config)
if err != nil {