Skip to content

Conversation

@andstepan
Copy link

This commit changes how the CARGO_BIN_EXE_coreutils environment variable is read. Previously, it was read using the env! macro, which returns the value of the variable as exposed by cargo during compilation.

The problem with that is that it renders the process of testing for cross compiled targets, similar to what build systems like Yocto do, more difficult.

The solution to this is to read said variable at runtime and if it is not defined, to default to the version offered by cargo. This way ensures that first of all, current functionality remains unchanged and that the code can be more easily cross compiled and tested in environments outside of cargo.

Also, this commit closes #9246 .

@ycongal-smile

// Use the ctor attribute to run this function before any tests
#[ctor::ctor]
fn init() {
let cargo_bin_exe_location =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment why we do that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

This commit changes how the `CARGO_BIN_EXE_coreutils` environment variable
is read. Previously, it was read using the `env!` macro, which returns the
value of the variable as exposed by cargo during compilation.

The problem with that is that it renders the process of testing for cross
compiled targets, similar to what build systems like Yocto do, more
difficult.

The solution to this is to read said variable at runtime and if it is not
defined, to default to the version offered by cargo. This way ensures that
first of all, current functionality remains unchanged and that the code can
be more easily cross compiled and tested in environments outside of cargo.

Also, this commit closes uutils#9246 .

Signed-off-by: Andreas Stergiopoulos <andreas.stergiopoulos@smile.fr>
@andstepan andstepan force-pushed the fix/read-bin-from-environment branch from 542ab53 to 2974bec Compare November 18, 2025 10:41
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

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.

tests.rs: statically defined CARGO_BIN_EXE_coreutils causes all integration tests to fail on Yocto ptest-cargo

2 participants