Skip to content

Commit cd0abcd

Browse files
committed
bitcoind-tests: find the bitcoind executable no matter where we are running from
1 parent bf98e2a commit cd0abcd

File tree

1 file changed

+8
-2
lines changed
  • bitcoind-tests/tests/setup

1 file changed

+8
-2
lines changed

bitcoind-tests/tests/setup/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ pub fn setup() -> BitcoinD {
1111
// Create env var BITCOIND_EXE_PATH to point to the ../bitcoind/bin/bitcoind binary
1212
let key = "BITCOIND_EXE";
1313
if std::env::var(key).is_err() {
14-
let curr_dir_path = std::env::current_dir().unwrap();
15-
let bitcoind_path = curr_dir_path.join("bin").join("bitcoind");
14+
let mut root_path = std::env::current_dir().unwrap();
15+
while std::fs::metadata(root_path.join("LICENSE")).is_err() {
16+
if !root_path.pop() {
17+
panic!("Could not find LICENSE file; do not know where repo root is.");
18+
}
19+
}
20+
21+
let bitcoind_path = root_path.join("bitcoind-tests").join("bin").join("bitcoind");
1622
std::env::set_var(key, bitcoind_path);
1723
}
1824

0 commit comments

Comments
 (0)