test(suidhelper): fix zero e2e coverage on main.rs (LLVM_PROFILE_FILE scrub) + privileged-job upload - #60
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Codecov reports 0% on
native/suidhelper/src/main.rsdespite the e2e suite executing the real binary. Root cause: the e2e tests spawn the helper with.env_clear(), which strips theLLVM_PROFILE_FILEvariable cargo-llvm-cov uses to collect the instrumented child's profile — every e2e execution counted nothing. Verified locally: CI's exact coverage command yieldsmain.rs LF:41 LH:0.What
tests/e2e/support.rs— dedups the four per-file spawn helpers; scrubs the env but re-propagates onlyLLVM_PROFILE_FILE(%pin the pattern keeps child profiles distinct). Local coverage: main.rs LH 0 → 14 unprivileged.tests/e2e/version.rs— pins theversionself-report wire contract (Hyper.SuidHelper.Expectedparses this JSON and compareschecksum_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 undercargo llvm-cov nextestand uploads under the existingrustflag (codecov merges per commit).Expected residual uncoverage (permanent, by design)
The
Command::Jailerarm inmain.rs: success pathexecves (process image replaced — profile never flushed) and failure path exits vialibc::_exit(2)(bypasses atexit). Plus theCommand::Version => unreachable!()arm. These lines can never show coverage from any test.Plan:
docs/superpowers/plans/2026-07-08-rust-e2e-coverage.md