Skip to content

Commit f3ea97e

Browse files
committed
Enhance executable path resolution for performance tests to support target-specific builds
1 parent db2d64d commit f3ea97e

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

crates/pet/tests/e2e_performance.rs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,23 +321,41 @@ fn get_pet_executable() -> PathBuf {
321321
.unwrap()
322322
.join("target");
323323

324-
// Prefer release build for performance tests
325-
let release_exe = if cfg!(windows) {
326-
target_dir.join("release").join("pet.exe")
327-
} else {
328-
target_dir.join("release").join("pet")
329-
};
324+
let exe_name = if cfg!(windows) { "pet.exe" } else { "pet" };
325+
326+
// When building with --target <triple>, cargo outputs to target/<triple>/release/
327+
// Check for target-specific builds first (used in CI)
328+
let target_triples = [
329+
"x86_64-pc-windows-msvc",
330+
"x86_64-unknown-linux-musl",
331+
"x86_64-apple-darwin",
332+
"aarch64-apple-darwin",
333+
];
334+
335+
// Check target-specific release builds first
336+
for triple in target_triples {
337+
let target_release_exe = target_dir.join(triple).join("release").join(exe_name);
338+
if target_release_exe.exists() {
339+
return target_release_exe;
340+
}
341+
}
330342

343+
// Fall back to standard release build (no --target flag)
344+
let release_exe = target_dir.join("release").join(exe_name);
331345
if release_exe.exists() {
332346
return release_exe;
333347
}
334348

335-
// Fall back to debug build
336-
if cfg!(windows) {
337-
target_dir.join("debug").join("pet.exe")
338-
} else {
339-
target_dir.join("debug").join("pet")
349+
// Check target-specific debug builds
350+
for triple in target_triples {
351+
let target_debug_exe = target_dir.join(triple).join("debug").join(exe_name);
352+
if target_debug_exe.exists() {
353+
return target_debug_exe;
354+
}
340355
}
356+
357+
// Fall back to standard debug build
358+
target_dir.join("debug").join(exe_name)
341359
}
342360

343361
/// Get a temporary cache directory for tests

0 commit comments

Comments
 (0)