You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/src/wasm-bindgen-test/coverage.md
+38-17
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,11 @@ Currently it is particularly difficult to [deliver compile-line arguments to pro
22
22
23
23
Make sure you are using `RUSTFLAGS=-Cinstrument-coverage -Zno-profiler-runtime`.
24
24
25
-
Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted. Clang must use the same LLVM version that Rustc is using, which can be checkd by calling `rustc +nightly -vV`.
25
+
Due to the current limitation of `llvm-cov`, we can't collect profiling symbols from the generated `.wasm` files. Instead, we can grab them from the LLVM IR with `--emit=llvm-ir` by using Clang. Additionally, the emitted LLVM IR files by Rust contain invalid code that can't be parsed by Clang, so they need to be adjusted.
26
+
27
+
At the time of writing Rust Nightly uses LLVM v19, however [minicov] only supports LLVM v18. Usage of Clang or any LLVM tools must match the version used by [minicov].
28
+
29
+
[minicov]: https://crates.io/crates/minicov
26
30
27
31
### Arguments to the test runner
28
32
@@ -43,6 +47,8 @@ This feature relies on the [minicov] crate, which provides a profiling runtime f
43
47
44
48
### Example
45
49
50
+
This adapts code taken from the [Rustc book], see that for more examples and general information on test coverage as well.
51
+
46
52
```sh
47
53
# Run the tests:
48
54
# - `CARGO_HOST_RUSTFLAGS` to pass the configuration to `wasm-bindgen-macro`.
0 commit comments