Wasm-Exprgen
This is a tool to generate random WebAssembly programs using csmith and emscripten.
Requirements
- Install node.js & npm version 0.10.17 and above
- Install Python 2.x
- Install WebAssembly Interpreter compiler dependencies (Optional)
- Install Compiler
- Windows
- Visual Studio 2010 or above, tested on Visual Studio 2015
- cmake
- Linux
- gcc:
sudo apt-get install build-essential
- cmake:
sudo apt-get install cmake
- m4:
sudo apt-get install m4
- gcc:
- Windows
For more details on how to build Emscripten from source refer to Emscripten Toolchain requirements
Setup
# Initialize submodule
git submodule update --init
# Install required modules for build scripts
npm install --production
Building tools
npm run build-tools
Usage
The following command will run csmith to generate a .c file then it runs emscripten to compile and generate WebAssembly from it. It is possible for csmith to generate code that is not supported by llvm.
npm run gen
At this point, if it successfully built in llvm, there should be a a series of test.*
files in the output
directory.