From f8bf349fa6ea9533f1e7699403573e569581cc42 Mon Sep 17 00:00:00 2001 From: L3nn0x Date: Mon, 10 Jul 2023 23:06:22 +0100 Subject: [PATCH] Use CARGO_TARGET_DIR for target directory (#1056) --- src/llvm_tools.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/llvm_tools.rs b/src/llvm_tools.rs index d246206b7..f7dc2401b 100644 --- a/src/llvm_tools.rs +++ b/src/llvm_tools.rs @@ -222,9 +222,15 @@ mod tests { assert_eq!(lcovs.len(), 0); #[cfg(unix)] - let binary_path = "target/debug/rust-code-coverage-sample"; + let binary_path = format!( + "{}/debug/rust-code-coverage-sample", + std::env::var("CARGO_TARGET_DIR").unwrap_or("target".to_string()) + ); #[cfg(windows)] - let binary_path = "target/debug/rust-code-coverage-sample.exe"; + let binary_path = format!( + "{}/debug/rust-code-coverage-sample.exe", + std::env::var("CARGO_TARGET_DIR").unwrap_or("target".to_string()) + ); let lcovs = profraws_to_lcov( &[tmp_path.join("default.profraw")],