-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Coverage of #[no_mangle] functions in cdylib is missed #365
Comments
cdylib itself should be supported since cargo-llvm-cov works with PyO3 and proc macros (#304 #307) If it does not work, it is generally the case that the required environment variables are not propagated properly (#320 (comment)), or you are exiting in an unsupported way (#235), etc. That said, if the problem occurs only on Windows in particular, it may be a bug on the cargo-llvm-cov side regarding Windows-specific path handling. In any case, this issue needs a reproduction. It is always difficult to investigate an issue unless I can reproduce it on my end. |
Were you able to reproduce the issue? |
Thanks for the repro.
The first problems is that the The commands needed to get coverage correctly in complex cases involving multiple cargo commands are documented here and in your case would be: source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
cargo build
cargo test
cargo llvm-cov report --html The second problem is that your function uses Separate the main processes from the #[no_mangle]
pub unsafe fn sqlite3_foo_init(
+ db: *mut sqlite3,
+ err_msg: *mut *mut c_char,
+ api: *mut api_routines,
+) -> c_int {
+ _sqlite3_foo_init(db, err_msg, api)
+}
+
+unsafe fn _sqlite3_foo_init(
db: *mut sqlite3,
_err_msg: *mut *mut c_char, |
cdylib
crates
Is it possible to get coverage report for dynamic libraries? My use case is that I'm building a sqlite extension which I compile into a shared library using:
I already have a few tests where I test the library from within sqlite by making it load the compiled artifact as an extension. I just tried running
cargo llvm-cov
on those tests but the resulting coverage is completely empty.The text was updated successfully, but these errors were encountered: