wasi-libc
wasi-libc copied to clipboard
test: add tests for pthread API
This change runs the pthread tests available in libc-test
when THREAD_MODEL=posix
. This is currently a work-in-progress, since there are custom build steps necessary to get this all to (mostly) work. Currently this might look like:
$ cd test
$ make run THREAD_MODEL=posix \
ENGINE=~/Code/wasmtime/target/debug/wasmtime \
CC=~/Code/llvm-project/build/bin/clang
What are the current issues?
- this requires a special build of Wasmtime that includes the
wasi-threads
implementation; this is shown above as built from source - under
THREAD_MODEL=posix
, this requires Clang to understand the--export-memory
flag which, though merged in https://reviews.llvm.org/D135898, is not available for download yet (but can be built from latest source as shown above) - not all of the tests yet pass and some do not build: this is to be expected in several cases (PI? robust?) but there is perhaps more that can be done here to enable more of the pthread API. Only the working tests are included in this commit.
cc: @loganek, I had forgotten about https://github.com/WebAssembly/wasi-threads/pull/11 (sorry!) but perhaps some of the tests here can be adapted for use there in the spec? Also, note here how much more complex the "build and run" scripting must be to get working examples.
i needed https://github.com/WebAssembly/wasi-libc/pull/372 for tls tests to pass on toywasm. isn't it the case for wasmtime?
Note to self: this should get moved to wasi-sdk.