Skip to content

Commit 993698c

Browse files
committed
Fix bug in integration tests with profile that is not dev or release
1 parent 940de44 commit 993698c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/cli_tests.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ mod integration_tests {
126126

127127
/// Helper function to get the path to the binary
128128
fn get_binary_path() -> String {
129-
let target_dir = std::env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string());
130-
let profile = if cfg!(debug_assertions) {
131-
"debug"
132-
} else {
133-
"release"
134-
};
135-
format!("{}/{}/trustworthiness_checker", target_dir, profile)
129+
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not defined");
130+
let path = Path::new(&out_dir);
131+
let tc_dir_path = path
132+
.parent()
133+
.and_then(|p| p.parent())
134+
.and_then(|p| p.parent())
135+
.expect("OUT_DIR too shallow");
136+
let tc_dir = tc_dir_path.to_str().expect("Invalid UTF-8 in path");
137+
format!("{}/trustworthiness_checker", tc_dir)
136138
}
137139

138140
/// Helper function to run the CLI with given arguments and return output

0 commit comments

Comments
 (0)