From 87c5f7e0f0bafa883341f7048029b19ae23193e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rayan=20Hassa=C3=AFne?= Date: Thu, 26 Nov 2026 15:40:58 +0100 Subject: [PATCH] test: find the rustqc binary at compile time in integration tests The integration tests read CARGO_BIN_EXE_rustqc at run time, which Cargo only sets in newer versions. On the MSRV toolchain (1.88) the variable is missing, the fallback looks for target/debug/rustqc, and all integration tests fail. Cargo always provides it at compile time for integration tests, so use env!(). Co-Authored-By: Claude Opus 5.5 --- tests/integration_test.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 699b7af..1f1e593 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -14,24 +14,11 @@ use rust_htslib::bam::header::HeaderRecord; /// Helper: get the path to the rustqc binary. /// -/// Uses the `CARGO_BIN_EXE_rustqc` env var when available (set by cargo test), -/// otherwise falls back to building and using `target/debug/rustqc`. +/// Cargo sets `CARGO_BIN_EXE_rustqc` at compile time for integration tests, so +/// the path is always available. (At run time the variable is only set by newer +/// Cargo versions, which made these tests fail on the MSRV toolchain.) fn rustqc_binary() -> String { - // cargo test sets this for integration tests automatically - if let Ok(path) = std::env::var("CARGO_BIN_EXE_rustqc") { - return path; - } - - // Fallback: build and use debug binary - let status = Command::new("cargo") - .args(["build"]) - .status() - .expect("Failed to run cargo build"); - assert!(status.success(), "cargo build failed"); - - let path = Path::new("target/debug/rustqc"); - assert!(path.exists(), "Binary not found at {:?}", path); - path.to_str().unwrap().to_string() + env!("CARGO_BIN_EXE_rustqc").to_string() } /// Helper: run rustqc rna on test data and return the output directory