poorna2152 / nballerina

WebAssembly Backend for the nBallerina compiler
https://ballerina.io/
Apache License 2.0
4 stars 0 forks source link

Extend the test runner to `wback` #10

Closed manuranga closed 2 years ago

manuranga commented 2 years ago

Current test runner in nballerina/test dir compiles and run ll files. Extend this to run wat files.

poorna2152 commented 2 years ago
manuranga commented 2 years ago

Wasmer looks like a good choice to me, please also evaluate other options. Can we use V8?

poorna2152 commented 2 years ago

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

poorna2152 commented 2 years ago

Updated the makefiles to include following commands.

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,