Skip to content

Commit 125a63d

Browse files
authored
docs/WebAssembly.md: add Wasm stdlib testing steps (#85947)
Added instructions for building and running Wasm stdlib tests, including filtering options and environment variable usage.
1 parent 956dc0c commit 125a63d

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/WebAssembly.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,46 @@ tools, and also builds WasmKit to execute stdlib tests:
3030

3131
On macOS it's also best to avoid cross-compiling host tools from arm64 to x86 and vice versa, add this option to avoid that: `--infer-cross-compile-hosts-on-darwin=false`.
3232

33+
If you need to only run compiler/stdlib tests after building everything with the `build-script` command listed above, switch to the build directory first:
34+
35+
```
36+
cd build/Ninja-RelWithDebInfoAssert
37+
```
38+
39+
Then run the compiler and stdlib test suite via `ninja` (assuming your host is arm64 macOS, adjust paths accordingly otherwise):
40+
41+
```
42+
PATH="$(pwd)/wasmkit-macosx-arm64/bin:$(pwd)/llvm-macosx-arm64/bin:$PATH" \
43+
ninja check-swift-wasi-wasm32-custom check-swift-embedded-wasi -C wasmstdlib-macosx-arm64
44+
```
45+
46+
Filter to a subset of tests you'd like to run with `LIT_FILTER`. Here's an example to run only tests with `embedded` in their file path:
47+
48+
```
49+
LIT_FILTER='(embedded)' PATH="$(pwd)/wasmkit-macosx-arm64/bin:$(pwd)/llvm-macosx-arm64/bin:$PATH" \
50+
ninja check-swift-wasi-wasm32-custom check-swift-embedded-wasi -C wasmstdlib-macosx-arm64
51+
```
52+
53+
Filter out tests you don't want to run with `LIT_FILTER_OUT`. Here's an example that excludes tests containing `KeyPath` in their file path:
54+
55+
```
56+
LIT_FILTER_OUT='(KeyPath)' PATH="$(pwd)/wasmkit-macosx-arm64/bin:$(pwd)/llvm-macosx-arm64/bin:$PATH" \
57+
ninja check-swift-wasi-wasm32-custom check-swift-embedded-wasi -C wasmstdlib-macosx-arm64
58+
```
59+
60+
Values passed to these environment variables are regular expressions, thus to exclude both `embedded` and `KeyPath`
61+
use `|` regex operator:
62+
63+
```
64+
LIT_FILTER_OUT='(embedded|KeyPath)' PATH="$(pwd)/wasmkit-macosx-arm64/bin:$(pwd)/llvm-macosx-arm64/bin:$PATH" \
65+
ninja check-swift-wasi-wasm32-custom check-swift-embedded-wasi -C wasmstdlib-macosx-arm64
66+
```
67+
68+
3369
## Building Swift SDK for WebAssembly
3470

3571
The [Swift SDK](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0387-cross-compilation-destinations.md)
36-
for WebAssembly is built and tested using the following command:
72+
for WebAssembly is built and tested using the following command (exclude `--sccache` if it's not installed or build caching is not needed):
3773

3874
```bash
3975
./utils/build-script --sccache --build-wasm-stdlib --wasmkit --install-llvm --install-swift --swiftpm --install-swiftpm \

0 commit comments

Comments
 (0)