tests: allow rpc-tests to get filenames for bitcoind and bitcoin-cli from the environment
This will allow for windows tests to run with bitcoind.exe and bitcoin-cli.exe
This commit is contained in:
parent
f635269cd1
commit
7a41614aa2
6 changed files with 19 additions and 14 deletions
|
@ -18,13 +18,14 @@
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $0 path_to_binaries"
|
echo "Usage: $0 path_to_binaries"
|
||||||
echo "e.g. $0 ../../src"
|
echo "e.g. $0 ../../src"
|
||||||
|
echo "Env vars BITCOIND and BITCOINCLI may be used to specify the exact binaries used"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -f
|
set -f
|
||||||
|
|
||||||
BITCOIND=${1}/bitcoind
|
BITCOIND=${BITCOIND:-${1}/bitcoind}
|
||||||
CLI=${1}/bitcoin-cli
|
CLI=${BITCOINCLI:-${1}/bitcoin-cli}
|
||||||
|
|
||||||
DIR="${BASH_SOURCE%/*}"
|
DIR="${BASH_SOURCE%/*}"
|
||||||
SENDANDWAIT="${DIR}/send.sh"
|
SENDANDWAIT="${DIR}/send.sh"
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $0 path_to_binaries"
|
echo "Usage: $0 path_to_binaries"
|
||||||
echo "e.g. $0 ../../src"
|
echo "e.g. $0 ../../src"
|
||||||
|
echo "Env vars BITCOIND and BITCOINCLI may be used to specify the exact binaries used"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -f
|
set -f
|
||||||
|
|
||||||
BITCOIND=${1}/bitcoind
|
BITCOIND=${BITCOIND:-${1}/bitcoind}
|
||||||
CLI=${1}/bitcoin-cli
|
CLI=${BITCOINCLI:-${1}/bitcoin-cli}
|
||||||
|
|
||||||
DIR="${BASH_SOURCE%/*}"
|
DIR="${BASH_SOURCE%/*}"
|
||||||
SENDANDWAIT="${DIR}/send.sh"
|
SENDANDWAIT="${DIR}/send.sh"
|
||||||
|
|
|
@ -85,11 +85,11 @@ def initialize_chain(test_dir):
|
||||||
# Create cache directories, run bitcoinds:
|
# Create cache directories, run bitcoinds:
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
datadir=initialize_datadir("cache", i)
|
datadir=initialize_datadir("cache", i)
|
||||||
args = [ "bitcoind", "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
args = [ os.getenv("BITCOIND", "bitcoind"), "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||||
if i > 0:
|
if i > 0:
|
||||||
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
bitcoind_processes[i] = subprocess.Popen(args)
|
||||||
subprocess.check_call([ "bitcoin-cli", "-datadir="+datadir,
|
subprocess.check_call([ os.getenv("BITCOINCLI", "bitcoin-cli"), "-datadir="+datadir,
|
||||||
"-rpcwait", "getblockcount"], stdout=devnull)
|
"-rpcwait", "getblockcount"], stdout=devnull)
|
||||||
devnull.close()
|
devnull.close()
|
||||||
rpcs = []
|
rpcs = []
|
||||||
|
@ -150,11 +150,11 @@ def start_node(i, dir, extra_args=None, rpchost=None):
|
||||||
Start a bitcoind and return RPC connection to it
|
Start a bitcoind and return RPC connection to it
|
||||||
"""
|
"""
|
||||||
datadir = os.path.join(dir, "node"+str(i))
|
datadir = os.path.join(dir, "node"+str(i))
|
||||||
args = [ "bitcoind", "-datadir="+datadir, "-keypool=1", "-discover=0" ]
|
args = [ os.getenv("BITCOIND", "bitcoind"), "-datadir="+datadir, "-keypool=1", "-discover=0" ]
|
||||||
if extra_args is not None: args.extend(extra_args)
|
if extra_args is not None: args.extend(extra_args)
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
bitcoind_processes[i] = subprocess.Popen(args)
|
||||||
devnull = open("/dev/null", "w+")
|
devnull = open("/dev/null", "w+")
|
||||||
subprocess.check_call([ "bitcoin-cli", "-datadir="+datadir] +
|
subprocess.check_call([ os.getenv("BITCOINCLI", "bitcoin-cli"), "-datadir="+datadir] +
|
||||||
_rpchost_to_args(rpchost) +
|
_rpchost_to_args(rpchost) +
|
||||||
["-rpcwait", "getblockcount"], stdout=devnull)
|
["-rpcwait", "getblockcount"], stdout=devnull)
|
||||||
devnull.close()
|
devnull.close()
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $0 path_to_binaries"
|
echo "Usage: $0 path_to_binaries"
|
||||||
echo "e.g. $0 ../../src"
|
echo "e.g. $0 ../../src"
|
||||||
|
echo "Env vars BITCOIND and BITCOINCLI may be used to specify the exact binaries used"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -f
|
set -f
|
||||||
|
|
||||||
BITCOIND=${1}/bitcoind
|
BITCOIND=${BITCOIND:-${1}/bitcoind}
|
||||||
CLI=${1}/bitcoin-cli
|
CLI=${BITCOINCLI:-${1}/bitcoin-cli}
|
||||||
|
|
||||||
DIR="${BASH_SOURCE%/*}"
|
DIR="${BASH_SOURCE%/*}"
|
||||||
SENDANDWAIT="${DIR}/send.sh"
|
SENDANDWAIT="${DIR}/send.sh"
|
||||||
|
|
|
@ -36,11 +36,12 @@
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $0 path_to_binaries"
|
echo "Usage: $0 path_to_binaries"
|
||||||
echo "e.g. $0 ../../src"
|
echo "e.g. $0 ../../src"
|
||||||
|
echo "Env vars BITCOIND and BITCOINCLI may be used to specify the exact binaries used"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BITCOIND=${1}/bitcoind
|
BITCOIND=${BITCOIND:-${1}/bitcoind}
|
||||||
CLI=${1}/bitcoin-cli
|
CLI=${BITCOINCLI:-${1}/bitcoin-cli}
|
||||||
|
|
||||||
DIR="${BASH_SOURCE%/*}"
|
DIR="${BASH_SOURCE%/*}"
|
||||||
SENDANDWAIT="${DIR}/send.sh"
|
SENDANDWAIT="${DIR}/send.sh"
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
echo "Usage: $0 path_to_binaries"
|
echo "Usage: $0 path_to_binaries"
|
||||||
echo "e.g. $0 ../../src"
|
echo "e.g. $0 ../../src"
|
||||||
|
echo "Env vars BITCOIND and BITCOINCLI may be used to specify the exact binaries used"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -f
|
set -f
|
||||||
|
|
||||||
BITCOIND=${1}/bitcoind
|
BITCOIND=${BITCOIND:-${1}/bitcoind}
|
||||||
CLI=${1}/bitcoin-cli
|
CLI=${BITCOINCLI:-${1}/bitcoin-cli}
|
||||||
|
|
||||||
DIR="${BASH_SOURCE%/*}"
|
DIR="${BASH_SOURCE%/*}"
|
||||||
SENDANDWAIT="${DIR}/send.sh"
|
SENDANDWAIT="${DIR}/send.sh"
|
||||||
|
|
Loading…
Reference in a new issue