Skip to content

Commit

Permalink
bitcoind-tests: find the bitcoind executable no matter where we are r…
Browse files Browse the repository at this point in the history
…unning from
  • Loading branch information
apoelstra committed Apr 4, 2023
1 parent bf98e2a commit cd0abcd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bitcoind-tests/tests/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ pub fn setup() -> BitcoinD {
// Create env var BITCOIND_EXE_PATH to point to the ../bitcoind/bin/bitcoind binary
let key = "BITCOIND_EXE";
if std::env::var(key).is_err() {
let curr_dir_path = std::env::current_dir().unwrap();
let bitcoind_path = curr_dir_path.join("bin").join("bitcoind");
let mut root_path = std::env::current_dir().unwrap();
while std::fs::metadata(root_path.join("LICENSE")).is_err() {
if !root_path.pop() {
panic!("Could not find LICENSE file; do not know where repo root is.");
}
}

let bitcoind_path = root_path.join("bitcoind-tests").join("bin").join("bitcoind");
std::env::set_var(key, bitcoind_path);
}

Expand Down

0 comments on commit cd0abcd

Please sign in to comment.