rust-lang / rust-lang/rust

Coverage 0% when `opt-level = 3` and `aarch64-linux-android`

Open
#139,907 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-code-coverage C-bug O-android T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

BUG

Coverage 0% when opt-level = 3 and aarch64-linux-android

reproduce

reproduce code
$ fd -tf -H -X tail -n +1
==> ./rust-toolchain.toml <==
[toolchain]
channel = "nightly-2025-04-14"
targets = [
    "aarch64-linux-android",
    "aarch64-unknown-linux-gnu",
    "x86_64-unknown-linux-gnu", 
]
components = ["llvm-tools"]

==> ./.cargo/config.toml <==
# android-ndk 28
[target.aarch64-linux-android]
linker = "/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang"
ar = "/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
runner = "/home/vscode/script/runner-ssh-aarch64-linux-android.sh"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
runner = "/home/vscode/script/runner-ssh-aarch64-unknown-linux-gnu.sh"

[profile.x_release_o2]
inherits = "release"
opt-level = 2

[profile.x_release_o3]
inherits = "release"


==> ./Cargo.toml <==
[package]
name = "reproduce"
version = "0.1.0"
edition = "2021"

[dependencies]

==> ./src/lib.rs <==
pub fn add(left: u64, right: u64) -> u64 {
    left + right
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let result = add(2, 2);
        assert_eq!(result, 4);
    }
}

actual

Coverage 0% when opt-level = 3 and aarch64-linux-android

$ run_cov_test x_release_o3 aarch64-linux-android

running 1 test
test tests::it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/tmp/reproduce/src/lib.rs           3                 3     0.00%           2                 2     0.00%           7                 7     0.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                               3                 3     0.00%           2                 2     0.00%           7                 7     0.00%           0                 0         -

Coverage 100% when not opt-level = 3 and aarch64-linux-android

$ run_cov_test x_release_o2 aarch64-linux-android

running 1 test
test tests::it_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/tmp/reproduce/src/lib.rs           3                 0   100.00%           2                 0   100.00%           7                 0   100.00%           0                 0         -
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                               3                 0   100.00%           2                 0   100.00%           7                 0   100.00%           0                 0         -

Every below combo, coverage is 100% like above.

run_cov_test x_release_o2 aarch64-linux-android
# run_cov_test x_release_o3 aarch64-linux-android
run_cov_test x_release_o2 aarch64-unknown-linux-gnu
run_cov_test x_release_o3 aarch64-unknown-linux-gnu
run_cov_test x_release_o2 x86_64-unknown-linux-gnu
run_cov_test x_release_o3 x86_64-unknown-linux-gnu

expected

Coverage should be 100% when opt-level = 3 and aarch64-linux-android.

version

channel = "nightly-2025-04-14"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the commands in the report, using rust-toolchain.toml, .cargo/config.toml, Cargo.toml, and src/lib.rs. Compare run_cov_test for x_release_o2 and x_release_o3 on aarch64-linux-android, then verify that the optimized configuration reports 100% coverage like the other target and optimization combinations.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.