Skip to content

non-nextest bin look up code for tests is broken #2917

@epage

Description

@epage

.or_else(|| env::var_os(format!("CARGO_BIN_EXE_{name}")))
.map(PathBuf::from)
.unwrap_or_else(|| lookup_cargo_bin(name))
}
/// Look up the path to a cargo-built binary within an integration test.
///
/// Makes assumptions about Cargo.
fn lookup_cargo_bin(name: &str) -> PathBuf {
let file_name = format!("{}{}", name, std::env::consts::EXE_SUFFIX);
let target_dir = target_dir();
target_dir.join(file_name)
}
// Adapted from
// https://github.com/rust-lang/cargo/blob/485670b3983b52289a2f353d589c57fae2f60f82/tests/testsuite/support/mod.rs#L507
fn target_dir() -> PathBuf {
env::current_exe()
.ok()
.map(|mut path| {
path.pop();
if path.ends_with("deps") {
path.pop();
}
path
})
.unwrap()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions