wasm-micro-runtime/samples/wasi-threads
Wenyong Huang 9b9ae0cfac
Update cmake files and wamr-test-suites to support collect code coverage (#1992)
Support collecting code coverage with wamr-test-suites script by using
lcov and genhtml tools, eg.:
  cd tests/wamr-test-suites
  ./test_wamr.sh -s spec -b -P -C

The default code coverage and html files are generated at:
  tests/wamr-test-suites/workspace/wamr.lcov
  tests/wamr-test-suites/workspace/wamr-lcov.zip

And update wamr-test-suites scripts to support testing GC spec cases to
avoid frequent synchronization conflicts between branch main and dev/gc.
2023-02-28 17:38:18 +08:00
..
wasm-apps Update cmake files and wamr-test-suites to support collect code coverage (#1992) 2023-02-28 17:38:18 +08:00
CMakeLists.txt Create a placeholder for WASI threads implementation (#1783) 2022-12-06 21:11:27 +08:00
README.md thread-mgr: Fix spread "wasi proc exit" exception and atomic.wait issues (#1988) 2023-02-24 20:05:39 +08:00

"WASI threads" sample introduction

Currently, since the wasi-sdk does not have thread support in the latest release, make sure to have wasi-libc installed. Build it with threads enabled, e.g.

make \
    AR=/opt/wasi-sdk/bin/llvm-ar \
    NM=/opt/wasi-sdk/bin/llvm-nm \
    CC=/opt/wasi-sdk/bin/clang \
    THREAD_MODEL=posix

Build and run the samples

$ mkdir build
$ cd build
$ cmake -DWASI_SYSROOT=/path/to/wasi-libc/sysroot ..
$ make
...
$ ./iwasm wasm-apps/no_pthread.wasm
...
$ ./iwasm wasm-apps/exception_propagation.wasm

Run samples in AOT mode

$ ../../../wamr-compiler/build/wamrc \
    --enable-multi-thread \
    -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
$ ./iwasm wasm-apps/no_pthread.aot