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
I noticed that when using capture_coverage() and profiling is not enabled (via -Cinstrument-coverage), the result isn't empty. Is there a way to detect if the binary was instrumented in the first place?
My use case is moving minicov from a cfg to a crate feature in wasm-bindgen-test. But preferably enabling the crate feature, shouldn't cause a bunch of files being written when running the tests when not intending to measure test coverage.
Users would usually enable the cfg in RUSTFLAGS explicitly, but the crate feature is intended to get it closer to regular Rust targets, not requiring any additional flags (apart from -Zno-profiler-runtime) and maybe enabling it by default in the future. But if detection can't happen during runtime, it would still require --feature wasm-bindgen-test/minicov to get it enabled, which defeats the purpose.
The text was updated successfully, but these errors were encountered:
Apparently __llvm_profile_get_num_counters() does the trick. Presumably a bunch of other functions could fulfill the same purpose, e.g. __llvm_profile_get_counters_size() or __llvm_profile_get_num_bitmap_bytes().
There are a bunch of ways we could expose this:
Check in capture_coverage() beforehand and return an appropriate error.
Expose a function called is_enabled().
Expose directly, e.g. counters().
I think returning an error sounds like the most appropriate solution. Let me know if this in scope!
I noticed that when using
capture_coverage()
and profiling is not enabled (via-Cinstrument-coverage
), the result isn't empty. Is there a way to detect if the binary was instrumented in the first place?My use case is moving
minicov
from acfg
to a crate feature inwasm-bindgen-test
. But preferably enabling the crate feature, shouldn't cause a bunch of files being written when running the tests when not intending to measure test coverage.Users would usually enable the
cfg
inRUSTFLAGS
explicitly, but the crate feature is intended to get it closer to regular Rust targets, not requiring any additional flags (apart from-Zno-profiler-runtime
) and maybe enabling it by default in the future. But if detection can't happen during runtime, it would still require--feature wasm-bindgen-test/minicov
to get it enabled, which defeats the purpose.The text was updated successfully, but these errors were encountered: