wasi-libc icon indicating copy to clipboard operation
wasi-libc copied to clipboard

test: add tests for pthread API

Open abrown opened this issue 2 years ago • 3 comments

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.

abrown avatar Dec 20 '22 23:12 abrown

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.

abrown avatar Dec 22 '22 00:12 abrown

i needed https://github.com/WebAssembly/wasi-libc/pull/372 for tls tests to pass on toywasm. isn't it the case for wasmtime?

yamt avatar Dec 22 '22 04:12 yamt

Note to self: this should get moved to wasi-sdk.

abrown avatar Jul 11 '23 22:07 abrown