Skip to content

Commit fb73306

Browse files
committed
avoid setting {BITCOIND,ELEMENTSD}_EXE in setup
The logic of setting the env var inside the setup prevents user of other OS like nixos to run the tests (because the included binary are not working on nixos). Setting those env vars is meant to be done in the dev environment not in the code. With this users with `bitcoind` and `elementsd` in their PATH will work too. The CI script will set the variables only if they are not already set. (Allowing Nixos users to override and run it locally)
1 parent 9898534 commit fb73306

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

bitcoind-tests/tests/setup/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ pub mod test_util;
1717
// We are not using pegins right now, but it might be required in case in future
1818
// if we extend the tests to check pegins etc.
1919
pub fn setup(validate_pegin: bool) -> (ElementsD, Option<BitcoinD>, elements::BlockHash) {
20-
// Lookup bitcoind binary path
21-
let curr_dir = std::env::current_dir().unwrap();
22-
let bitcoind_path = curr_dir.join("bin/bitcoind");
23-
let elementsd_path = curr_dir.join("bin/elementsd");
24-
25-
std::env::set_var("BITCOIND_EXE", bitcoind_path);
26-
std::env::set_var("ELEMENTSD_EXE", elementsd_path);
27-
2820
let mut bitcoind = None;
2921
if validate_pegin {
3022
let bitcoind_exe = bitcoind::exe_path().unwrap();

contrib/test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ fi
2222

2323
# Test bitcoind integration tests if told to (this only works with the stable toolchain)
2424
if [ "$DO_BITCOIND_TESTS" = true ]; then
25+
26+
BITCOIND_EXE_DEFAULT="$(git rev-parse --show-toplevel)/bitcoind-tests/bin/bitcoind"
27+
ELEMENTSD_EXE_DEFAULT="$(git rev-parse --show-toplevel)/bitcoind-tests/bin/elementsd"
28+
2529
cd bitcoind-tests
30+
31+
BITCOIND_EXE=${BITCOIND_EXE:=${BITCOIND_EXE_DEFAULT}} \
32+
ELEMENTSD_EXE=${ELEMENTSD_EXE:=${ELEMENTSD_EXE_DEFAULT}} \
2633
cargo test --verbose
2734

2835
# Exit integration tests, do not run other tests.

0 commit comments

Comments
 (0)