-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add selective coverage instrumentation for crates #387
Comments
I guess you can use
|
Seems not. I want to disable coverage instrumentation for some heavy math libs and tokio, otherwise tests fail because some components time out. It can be done here, if I read code correctly. Line 177 in 8a8fd85
|
My understanding is that excluding the application of |
I've solved it with this RUSTC_WRAPPER #!/usr/bin/env python3
import os
import sys
blacklist = ["25519", "tokio"]
def main():
# The first argument is the path to rustc, followed by its arguments
args = sys.argv[1:]
# coverage is necessary only for our project
crate_name = get_crate_name(args)
if any(crate in crate_name for crate in blacklist):
try:
instrument_coverage_index = args.index("instrument-coverage")
del args[instrument_coverage_index]
del args[instrument_coverage_index - 1]
except ValueError:
pass
# Execute rustc with the potentially modified arguments
os.execvp(args[0], args)
def get_crate_name(args):
for i, arg in enumerate(args):
if arg == "--crate-name":
return args[i + 1]
return ""
if __name__ == "__main__":
main()
|
Ah, RUSTC_WRAPPER is a nice way to go. Making the |
This tool already has
--exclude-from-report
, does it make sense to add black/white lists for toggling instrumentation on and off?Like
--enable-coverage-for crate1 --enable-coverage-for crate2
or--disable coverage-for tokio
The text was updated successfully, but these errors were encountered: