-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #[no_coverage]
to the test harness's fn main
#111042
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
Ideally the instrumentor would also be fixed to not emit invalid/confusing mappings. (For example, #97368 managed to fix one problem, but ended up exposing a more subtle problem.) But I think adding |
This comment has been minimized.
This comment has been minimized.
@rustbot label +A-code-coverage +A-libtest |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#109540 (std docs: edit `PathBuf::set_file_name` example) - rust-lang#110093 (Add 64-bit `time_t` support on 32-bit glibc Linux to `set_times`) - rust-lang#110987 (update wasi_clock_time_api ref.) - rust-lang#111038 (Leave promoteds untainted by errors when borrowck fails) - rust-lang#111042 (Add `#[no_coverage]` to the test harness's `fn main`) - rust-lang#111057 (Make sure the implementation of TcpStream::as_raw_fd is fully inlined) - rust-lang#111065 (Explicitly document how Send and Sync relate to references) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
In the fuchsia build, I'm seeing a new error pop up that I think is caused by this PR:
that's truncated a bit, but I also have the full output Details
The test it's trying to compile is https://cs.opensource.google/fuchsia/fuchsia/+/main:src/sys/test_runners/rust/test_data/no-rust-tests/src/lib.rs (an empty file) so it sort of intuitively makes sense how adding Is that something that's obvious to you? I wasn't able to reproduce this for Linux, and something about the upstream-distributed libstd for fuchsia seems to be incompatible with coverage (not sure what that's about, the fuchsia-built toolchain before this PR works fine for coverage). And for some reason |
This doesn't ring any bells, unfortunately. My best guess is that some Fuchsia-specific code in the compiler accidentally assumes that every instrumented build contains at least one instrumented function. Now that the test entry point is not instrumented, it's possible for an empty test file to have no instrumented functions, exposing a latent bug in that Fuchsia-specific code. |
For example, there might be a loop (explicit or implicit) over all instrumented functions that has a side-effect of properly setting up the profiler runtime for the resulting binary. Now that there are zero instrumented functions, that setup would no longer happen, so the binary ends up in an unlinkable state. |
Also related: #102900 |
There are two main motivations for adding
#[no_coverage]
to the test harness's entry point:llvm-cov
and result in strange coverage reports.Fixes #110749.