-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from nyonson/harden-regtest-script
Harden regtest script
- Loading branch information
Showing
4 changed files
with
59 additions
and
130 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,48 @@ | ||
bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters --rpcport=18443 --rpcuser=test --rpcpassword=b324 --rest=1 --server=1 --listen=1 --v2transport=1 & | ||
sleep 1 | ||
cargo test regtest_handshake -- --nocapture | ||
sleep 1 | ||
## In case of failure this will stop core anyway. | ||
bitcoin-cli --chain=regtest --rpcuser=test --rpcpassword=b324 stop | ||
#!/usr/bin/env bash | ||
# | ||
# Test a handshake with a running bitcoin daemon. | ||
|
||
# Exit immediately if a command exits with a non-zero status. | ||
set -e | ||
|
||
BITCOIND_PID="" | ||
|
||
cleanup() { | ||
echo "Cleaning up..." | ||
if [ -n "$BITCOIND_PID" ]; then | ||
bitcoin-cli --chain=regtest --rpcuser=test --rpcpassword=b324 stop | ||
# Wait for the bitcoind process to stop. | ||
wait $BITCOIND_PID | ||
fi | ||
} | ||
|
||
# Ensure the bitcoind process is cleaned up if this script is killed for any reason. | ||
trap cleanup EXIT | ||
|
||
start_bitcoind() { | ||
bitcoind --chain=regtest --txindex --blockfilterindex --peerblockfilters \ | ||
--rpcport=18443 --rpcuser=test --rpcpassword=b324 --rest=1 \ | ||
--server=1 --listen=1 --v2transport=1 & | ||
BITCOIND_PID=$! | ||
|
||
echo "Waiting for bitcoind to start..." | ||
until bitcoin-cli --chain=regtest --rpcuser=test --rpcpassword=b324 getblockchaininfo &>/dev/null | ||
do | ||
sleep 1 | ||
done | ||
echo "bitcoind started." | ||
} | ||
|
||
run_tests() { | ||
cargo test regtest_handshake -- --ignored --nocapture | ||
TEST_EXIT_CODE=$? | ||
return $TEST_EXIT_CODE | ||
} | ||
|
||
main() { | ||
start_bitcoind | ||
run_tests | ||
return $? | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters