Skip to content

test(suidhelper): fix zero e2e coverage on main.rs (LLVM_PROFILE_FILE scrub) + privileged-job upload - #60

Merged
markovejnovic merged 3 commits into
mainfrom
test/broken-codecov
Jul 8, 2026
Merged

test(suidhelper): fix zero e2e coverage on main.rs (LLVM_PROFILE_FILE scrub) + privileged-job upload#60
markovejnovic merged 3 commits into
mainfrom
test/broken-codecov

Conversation

@markovejnovic

Copy link
Copy Markdown
Contributor

Why

Codecov reports 0% on native/suidhelper/src/main.rs despite the e2e suite executing the real binary. Root cause: the e2e tests spawn the helper with .env_clear(), which strips the LLVM_PROFILE_FILE variable cargo-llvm-cov uses to collect the instrumented child's profile — every e2e execution counted nothing. Verified locally: CI's exact coverage command yields main.rs LF:41 LH:0.

What

  • tests/e2e/support.rs — dedups the four per-file spawn helpers; scrubs the env but re-propagates only LLVM_PROFILE_FILE (%p in the pattern keeps child profiles distinct). Local coverage: main.rs LH 0 → 14 unprivileged.
  • tests/e2e/version.rs — pins the version self-report wire contract (Hyper.SuidHelper.Expected parses this JSON and compares checksum_blake3; shape drift breaks helper verification at install time).
  • ci.yml (suidhelper-privileged) — the root-gated e2e paths (tool dispatch, sys-test, jail build) only execute in this job; it now runs under cargo llvm-cov nextest and uploads under the existing rust flag (codecov merges per commit).

Expected residual uncoverage (permanent, by design)

The Command::Jailer arm in main.rs: success path execves (process image replaced — profile never flushed) and failure path exits via libc::_exit(2) (bypasses atexit). Plus the Command::Version => unreachable!() arm. These lines can never show coverage from any test.

Plan: docs/superpowers/plans/2026-07-08-rust-e2e-coverage.md

The e2e suite spawns the helper with env_clear(), which also stripped
the llvm-cov profile path -- the instrumented child never wrote its
.profraw where collection looks, so src/main.rs reported 0% coverage
despite being executed by every e2e test. Dedup the four per-file spawn
helpers into tests/e2e/support.rs, which re-propagates only
LLVM_PROFILE_FILE (%p keeps child profiles distinct).
Root-gated e2e paths (tool dispatch, sys-test, jail build) only execute
in this job; running them under plain nextest meant they never counted.
Uploads under the existing rust flag; codecov merges per commit.
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Test Results

  4 files  ±0  164 suites  +1   1m 32s ⏱️ -4s
472 tests +1  472 ✅ +1    0 💤 ±0  0 ❌ ±0 
799 runs  +1  472 ✅ +1  327 💤 ±0  0 ❌ ±0 

Results for commit afcb233. ± Comparison against base commit 5b5068f.

@markovejnovic
markovejnovic merged commit 323c033 into main Jul 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant