ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / ca / cargo-benchcmp / fix-test-binary-path.patch
blobf4643e670ce6425e5968db20e93175625f7d790e
1 --- a/tests/integration.rs
2 +++ b/tests/integration.rs
3 @@ -16,20 +16,13 @@ impl CommandUnderTest {
4 fn new() -> CommandUnderTest {
5 // To find the directory where the built binary is, we walk up the directory tree of the test binary until the
6 // parent is "target/".
7 - let mut binary_path = env::current_exe().expect("need current binary path to find binary to test");
8 - loop {
9 - {
10 - let parent = binary_path.parent();
11 - if parent.is_none() {
12 - panic!("Failed to locate binary path from original path: {:?}", env::current_exe());
13 - }
14 - let parent = parent.unwrap();
15 - if parent.is_dir() && parent.file_name().unwrap() == "target" {
16 - break;
17 - }
18 - }
19 - binary_path.pop();
20 - }
21 + let mut binary_path = PathBuf::from(
22 + env::current_dir()
23 + .unwrap()
24 + .join("target")
25 + .join("@shortTarget@")
26 + .join(env!("cargoBuildType")),
27 + );
29 binary_path.push(
30 if cfg!(target_os = "windows") {