tarpaulin: proc-macro crate in workspace unexpectently exits
Describe the bug Workspaces with a proc-macro crate fail to execute tests (The failure happens when execution of the test exe begins, but before any test starts) with the following error:
2024-10-28T15:58:05.678629Z INFO cargo_tarpaulin::process_handling: running D:\a\rust-ci-testing\rust-ci-testing\target\debug\deps\rust_proc_macro-6ef64dc17f0828ce.exe
2024-10-28T15:58:05.678931Z INFO cargo_tarpaulin::process_handling: Setting LLVM_PROFILE_FILE
2024-10-28T15:58:05.686895Z ERROR cargo_tarpaulin: Test failed during run
Error: "Test failed during run"
Error: Process completed with exit code 1.
I can only reproduce on a github action windows-latest runner (but 100% of the time). It does not happen on ubuntu-latest image (even with the --engine llvm flag) and it does not happen on windows locally. it fails with or without any tests actually in the crate. It fails with engine llvm and --no-dead-code
I tried adding tests to see if that helped any, but it continued to fail. I also tried adding tests as described in #326 but it continues to fail.
I am currently on:
cargo-tarpaulin 0.31.2
1.80.0
To Reproduce I have set up a repo with a CI job that hits the issue: Javagedes/rust-ci-testing with an example run here: action/Run Tests
Expected behavior I would expect the test harness to not unexpectedly fail without running any tests.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (6 by maintainers)
For me setting dynamic libraries path environment variable manually worked as a workaround:
LD_LIBRARY_PATH="$(rustc --print=target-libdir)" cargo tarpaulin -o htmlNote that name of the env variable differs depending on operating system: https://doc.rust-lang.org/cargo/reference/environment-variables.html#dynamic-library-paths
Thanks for the tip @dkaluza I’ve just done a PR to get tarpaulin to automate this process for people here https://github.com/xd009642/tarpaulin/pull/1680 if anyone wants to try it out (I’ll be trying it later) 👀
Oh one thing that another person with the issue has confirmed is that
--exclude <PROC_MACRO_CRATE>also works to solve the issue as a stop gapLocally (Rust 1.83, Fedora Linux, amd64) I see these messages right before the test failure.
serde_with_macrosis a proc-macro crate.I do not see the link message on GitHub Actions (Source).
Since this is a linking issue, this change sounds relevant: “The sysroot no longer contains the std dynamic library in its top-level lib/ dir.” https://github.com/rust-lang/rust/pull/131188
The issue does not appear with Rust 1.82. The version of tarpaulin (0.31.2 or 0.31.3) does not make a difference.
Yup, separate issue, figured I’d bring it up though. I’ll get that sorted next morning as I’m practically asleep right now. (Just had to wake up briefly, going back to sleep)
Interesting, I’ve noticed a similar failure in tarpaulin CI start 5 days ago - but only on the nightly mac builds. I think it’s unrelated or something a bit different so if you want to open a new issue I’ll close this one
I tried it and the fix worked fine for me.
The issue seems to be related to https://github.com/rust-lang/rust/pull/131188
The searched libstd version is no longer available in sysroot since v1.83
Output from --dump-traces: tarpaulin_20241129173337.json