Skip to content

Conversation

sylvestre
Copy link
Contributor

No description provided.

@sylvestre sylvestre changed the title Cov2 try to bring back coverage Feb 8, 2025
@RenjiSann
Copy link
Collaborator

It seems that nextest won't forward LLVM_PROFILE_FILE to the environment of the binary, and after reading the doc, I can't find a way to do it.
Maybe we're missing out something, or there is a feature to be added to nextest

@RenjiSann
Copy link
Collaborator

RenjiSann commented Mar 4, 2025

I have a question regarding the build of the test insfrastructure.

Are the coreutils binaries directly embedded in the test executable, or are they called separately ? My guess is the second, but I may be wrong.

Ideally, we'd only instrument the build of the coreutils, so calling the test executable does not produce a trace by itself.
However, I'm not sure how to specifically do this.

Additionally, I realized that nextest actually seems to forward LLVM_PROFILE_FILE to the test executable (which we're not interested in for coverage). However, the test harness does not forward it further to the coreutil call, but that's something we could fix with a workaround in new_ucmd!() :

#[macro_export]
macro_rules! new_ucmd {
    () => {
        let mut cmd = TestScenario::new(util_name!()).ucmd();
        if let Some(val) = std::env::var("LLVM_PROFILE_FILE") {
            cmd.env("LLVM_PROFILE_FILE", val);
        };
        cmd
    };
}

EDIT

Maybe it's a better idea to add it here directly.

@sylvestre sylvestre deleted the cov2 branch July 28, 2025 14:49
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.

2 participants