Skip to content

Comments

Fix the compile-test tests for build.build-dir that's distinct from target-dir#16626

Open
jakubadamw wants to merge 1 commit intorust-lang:masterfrom
jakubadamw:issue-16567
Open

Fix the compile-test tests for build.build-dir that's distinct from target-dir#16626
jakubadamw wants to merge 1 commit intorust-lang:masterfrom
jakubadamw:issue-16567

Conversation

@jakubadamw
Copy link
Contributor

@jakubadamw jakubadamw commented Feb 24, 2026

Second attempt after the previous revert in #16623.
Fixes #16567.

This time I'm using an env var of the CARGO_BIN_EXE_* class, to determine the correct path to the clippy-driver executable. This is a simpler change that, conveniently enough, also fixes the build within rust-lang/rust. I verified that it does.

Also, extend the fix to CARGO_CLIPPY_PATH in tests/test_utils, which also fixes the dogfood tests in environments with a custom build.build-dir.

Over all, this fixes the compile-test tests and dogfood tests, which presently don't run when Cargo's build.build-dir is set to a path that's distinct from target-dir. Right now, the uitest harness assumes that clippy-driver (a final build artifact) is located in the parent directory of compile_test-… (an intermediate artifact or, rather, a dependency's final artifact), and that doesn't hold when build-dir is configured independently from target-dir, like so (in ~/.cargo/config.toml):

[build]
build-dir = "{cargo-cache-home}/build-artifacts/{workspace-path-hash}"

changelog: none

r? @samueltardieu

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 24, 2026
@rustbot

This comment was marked as outdated.

@jakubadamw jakubadamw changed the title Fix the compile-test tests when setting Cargo's build.build-dir setting to a path that's distinct from target-dir Fix the compile-test tests for build.build-dir that's distinct from target-dir Feb 24, 2026
@rustbot rustbot assigned samueltardieu and unassigned dswij Feb 24, 2026
@dswij

This comment was marked as outdated.

@rustbot

This comment was marked as outdated.

Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

Confirmed working in both my Clippy repo and in the compiler repo.

Can you please squash the commits?

View changes since this review

…ting to a path that's distinct from `target-dir`

In this approach, we're using the `CARGO_BIN_EXE_clippy-driver` env var, which is set to the appropriate absolute path,
invariant across the various possible `target-dir` and `build.build-dir` configurations.

Do the same for `CARGO_CLIPPY_PATH` in tests/test_utils/mod.rs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compile-test tests fail to run when using a custom build-dir

4 participants