Closed manuranga closed 2 years ago
wasm-interp
tool when run with the command $ wasm-interp test.wasm --run-all-exports --trace
did not produce an output and needed a .wasm
file to run the tool. So in order to run the tests the .wat
files should be converted to .wasm
format first and then run through the wasm-interp
tool.
The tool wasmer provides a tool which can take a .wat as the input and runs it without the explicit need to convert to wasm
format.
wasmer main.wat -i add 10 5
Wasmer can also generate a .exe file for the .wat
file.
However it doesn't seem like they provide a command line flag to import functions. Importing function can be done like this. Either through a python, C/C++, Rust or Go script.
Wasmer looks like a good choice to me, please also evaluate other options. Can we use V8?
Added three new files.
.wat
file is converted to .wasm
using the wasm-opt tool in Binaryen. The generated wasm
file is run through the main.js
file which provides console.log
as an import function.
Since the wasm-opt
tool is used currently the path to it is hard-coded in the wsub.mk file.
The make test wat=true
command is used to run the tests for the wback
. make test wat=false
command can be used to run the tests for nback
.
Run the compiler with --outWat
flag to generate webassembly.
bal run -- [path-to-file] --outWat
Updated the makefiles to include following commands.
make testwat
: run wasm
testsmake testll
: run ll
testsmake test
: run both wasm
and ll
tests.make -j2 test
: run both wasm
and ll
tests parallely.wasm-opt
tool is used to convert wat to wasm.
To find the path to the wasm-opt
created a shell script which search the $HOME
directory for a wasm-opt tool.
Updated the Github action files to,
Current test runner in
nballerina/test
dir compiles and runll
files. Extend this to runwat
files.