From c9ddf5f9d162e5a6d81104458ca7d432398811b5 Mon Sep 17 00:00:00 2001 From: 0z5a Date: Sat, 24 Oct 2026 19:22:44 +0200 Subject: [PATCH] test(cargo-oxide): keep an inherited CARGO_TARGET_DIR out of the configured-target test cargo_json_selects_custom_bin_in_configured_target_dir checks that the binary lands under build.target-dir from .cargo/config.toml. When the test process has CARGO_TARGET_DIR set (a common local and CI setting), Cargo uses that instead and the assertion fails. Remove the variable for the child build. Signed-off-by: 0z5a --- cuda-oxide/crates/cargo-oxide/src/commands/tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cuda-oxide/crates/cargo-oxide/src/commands/tests.rs b/cuda-oxide/crates/cargo-oxide/src/commands/tests.rs index 59647d3a78..9218e7cd6c 100644 --- a/cuda-oxide/crates/cargo-oxide/src/commands/tests.rs +++ b/cuda-oxide/crates/cargo-oxide/src/commands/tests.rs @@ -769,7 +769,11 @@ path = "src/main.rs" .unwrap(); let mut cmd = Command::new("cargo"); - cmd.args(["build", "--release"]).current_dir(&root); + // CARGO_TARGET_DIR takes precedence over build.target-dir, so an + // inherited value would bypass the configured directory under test. + cmd.args(["build", "--release"]) + .current_dir(&root) + .env_remove("CARGO_TARGET_DIR"); let binary = run_cargo_build_for_executable(&mut cmd, &root, None).unwrap(); assert!(binary.exists());