Skip to content

Commit f1e8e2b

Browse files
committed
add note on how to build wasi
1 parent 41a9cd4 commit f1e8e2b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/tests/running.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,35 @@ coordinate running tests (see [src/bootstrap/src/core/build_steps/test.rs]).
342342
> **TODO**
343343
>
344344
> - Is there any support for using an iOS emulator?
345-
> - It's also unclear to me how the wasm or asm.js tests are run.
346345
347346
[armhf-gnu]: https://github.com/rust-lang/rust/tree/master/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile
348347
[QEMU]: https://www.qemu.org/
349348
[remote-test-client]: https://github.com/rust-lang/rust/tree/master/src/tools/remote-test-client
350349
[remote-test-server]: https://github.com/rust-lang/rust/tree/master/src/tools/remote-test-server
351350
[src/bootstrap/src/core/build_steps/test.rs]: https://github.com/rust-lang/rust/blob/master/src/bootstrap/src/core/build_steps/test.rs
352351

352+
## Testing tests on wasi (wasm32-wasip1)
353+
354+
Some tests are specific to wasm targets.
355+
To run theste tests, you have to pass `--target wasm32-wasip1` to `x test`.
356+
Additionally, you need the wasi sdk.
357+
Follow the install instructions from the [wasi sdk repository] to get a sysroot on your computer.
358+
On the [wasm32-wasip1 target support page] a minimum version is specified that your sdk must be able to build.
359+
Some cmake commands that take a while and give a lot of very concerning c++ warnings...
360+
Then, in `bootstrap.toml`, point to the sysroot like so:
361+
362+
```
363+
[target.wasm32-wasip1]
364+
wasi-root = "<wasi-sdk ___location>/build/sysroot/install/share/wasi-sysroot"
365+
```
366+
367+
In my case I git-cloned it next to my rust folder, so it was `../wasi-sdk/build/....`
368+
Now, tests should just run, you don't have to set up anything else.
369+
370+
[wasi sdk repository]: https://github.com/WebAssembly/wasi-sdk
371+
[wasm32-wasip1 target support page]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasip1.md#building-the-target.
372+
373+
353374
## Running rustc_codegen_gcc tests
354375

355376
First thing to know is that it only supports linux x86_64 at the moment. We will

0 commit comments

Comments
 (0)