Collection of small C/C++ test cases for the WASIX toolchain.
Each test lives in its own directory with a Makefile and a test.sh script.
The mmap-anon test demonstrates anonymous memory mapping using mmap.
clang-19andclang++-19emccandem++(for Emscripten builds)- a WASIX sysroot – set the
WASIX_SYSROOTenvironment variable to its path wasmer(override withWASMERenv var)wasm-toolsorwabt(optional, for inspecting generated modules)
Run bash lib/setup-wasix.sh once to install the toolchain, then execute
bash test.sh. Ensure WASIX_SYSROOT=/wasix-sysroot is set in the environment.
Before running any make files, prepend the repository's lib/wrappers/ directory
to your PATH and select which wrapper to use:
# WASIX build
export PATH="$(pwd)/lib/wrappers:$PATH"
export CC=wasix-clang CXX=wasix-clang++ LD=wasix-clangFor an Emscripten build use emscripten/emscripten++ instead.
Alternatively:
- Ensure
WASIX_SYSROOTpoints to your WASIX installation. - Prepend
lib/wrappers/toPATHand setCC,CXX, andLDto the desired wrapper (wasix-clangoremscripten). - If
tputerrors appear when running the tests, exportTERM=xtermto provide a basic terminal description. - Execute
bash test.shin the repository root. The script iterates over all subdirectories and invokes their individualtest.shfiles. - Use
bash clean.shto remove build artifacts.
You may also run the test.sh inside a specific test directory to build and run
just that test.
When contributing code, run bash test.sh before creating a pull request to verify that all tests still pass.
- extern-threadlocal-nopic
- extern-threadlocal
- extern-variable
- helloworld
- minimal-threadlocal
- simple-dynamic-lib
- simple-shared-lib
- weak-symbol-undefined
- dynamic-tls-dtor
Run bash create-test.sh <new-test-name> to create a new test directory based on
the helloworld example. Adjust the generated files as necessary.
Sometimes you want to test a grid of multiple properties. For this simple test grid generators are supported.
Create a test folder, but add a test-grid.sh instead of a test.sh. The test-grid.sh is expected to create test folders in the folder where it is located. Usually this is done by having one template test folder and copying that with slight modifications to real test folders. Name your template test folder template or add a .template file to your template test folder, to prevent it from beeing discovered as a test itself.
Keep in mind that test grids are only regenerated when you pass regenerate-grids to the test runnes.