Skip to content

Commit dd322eb

Browse files
committed
Intergration test setup
Update PR to bitcoin 0.27.1 fee fixup
1 parent 73f68ff commit dd322eb

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed

contrib/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,16 @@ if [ "$DO_BENCH" = true ]
4949
then
5050
cargo bench --features="unstable compiler"
5151
fi
52+
53+
# Run Integration tests if told so
54+
if [ -n "$BITCOINVERSION" ]; then
55+
set -e
56+
cd integration_test
57+
curl https://bitcoincore.org/bin/bitcoin-core-$BITCOINVERSION/bitcoin-$BITCOINVERSION-x86_64-linux-gnu.tar.gz | tar xvzf - bitcoin-$BITCOINVERSION/bin/bitcoind # will abort if the check fails.
58+
sha256sum --check bitcoin-core-$BITCOINVERSION.sha256sum
59+
export PATH=$PATH:$(pwd)/bitcoin-$BITCOINVERSION/bin
60+
./run.sh
61+
# Cleanups
62+
rm -rf bitcoin-$BITCOINVERSION
63+
exit 0
64+
fi

integration_test/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "integration_test"
3+
version = "0.1.0"
4+
authors = ["Steven Roose <steven@stevenroose.org>", "Sanket K <sanket1729@gmail.com>"]
5+
6+
[dependencies]
7+
miniscript = {path = "../"}
8+
9+
# Until 0.26 support is released on rust-bitcoincore-rpc
10+
bitcoincore-rpc = "0.14.0"
11+
bitcoin = "0.27.1"
12+
log = "0.4"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
28f0bffa7aff8e03db0a568420d6a01db115ee95bb07a94fe213074b6e3fc9f9 bitcoin-0.20.0/bin/bitcoind
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4aebceb3caf83f27bd3dd9030da637bacc836912a65a896860dc0252d0ebfad9 ./bitcoin-22.0/bin/bitcoind

integration_test/run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
TESTDIR=/tmp/rust_miniscript_test
4+
5+
rm -rf ${TESTDIR}
6+
mkdir -p ${TESTDIR}/1
7+
8+
# To kill any remaining open bitcoind.
9+
killall -9 bitcoind
10+
11+
echo $PATH
12+
13+
FALLBACKFEEARG=""
14+
if bitcoind -version | grep -q -e "v0\.2" -e "v2[2-9]"; then
15+
FALLBACKFEEARG="-fallbackfee=0.00001000"
16+
fi
17+
18+
bitcoind -regtest $FALLBACKFEEARG \
19+
-datadir=${TESTDIR}/1 \
20+
-rpcport=12348 \
21+
-server=1 \
22+
-printtoconsole=0 &
23+
PID1=$!
24+
25+
# Make sure it's listening.
26+
sleep 3
27+
28+
RPC_URL=http://localhost:12348 \
29+
RPC_COOKIE=${TESTDIR}/1/regtest/.cookie \
30+
cargo run
31+
32+
RESULT=$?
33+
34+
kill -9 $PID1
35+
rm -rf ${TESTDIR}
36+
exit $RESULT

integration_test/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//! # rust-miniscript integration test
2+
//!
3+
//! This is how some external user would use rust-miniscript
4+
5+
fn main() {
6+
()
7+
}

0 commit comments

Comments
 (0)