[Proposal] Add support for wasm-pack test
#337
Labels
C-enhancement
Category: A new feature or an improvement for an existing one
wasm-pack test
#337
Follows up from #221.
I'm currently working on generating profraw data from
wasm-pack test
: rustwasm/wasm-bindgen#3782TLDR: It will be possible to generate a
wasm.profraw
with the following command:I would to add support for this operation in
cargo-llvm-cov
and would therefore like to discuss what the interface and the implementation for this should look like.Interface
For the interface, I propose adding a
--wasm
flag tollvm-cov test
which then runswasm-pack test
instead ofcargo test
.Implementation
If the
--wasm
flag is present in thellvm-cov test
command, then we execute the command written above and dump the profraw in the usualllvm-cov-target/
.LLVM currently isn't able to read the debuginfo from the .wasm, which is why we use
--emit=llvm-ir
in theRUSTFLAGS
. We now need to generate a native.o
withclang
, sollvm-cov
can map the hits in the profdata back to lines in the source code.Merging the profdata should work just before.
Reporting needs to additionally pass our generated
.o
as-object
tollvm-cov
.Let me know what you think! I'm happy to submit a PR if this looks good to everyone.
The text was updated successfully, but these errors were encountered: