mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Add Travis fedpeg test with downloaded bitcoind
This commit is contained in:
parent
f084479091
commit
2a7039f13d
6 changed files with 42 additions and 8 deletions
13
.travis.yml
13
.travis.yml
|
|
@ -159,3 +159,16 @@ jobs:
|
|||
RUN_FUNCTIONAL_TESTS=false
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
|
||||
|
||||
# x86_64 Linux w/ single fedpeg test that uses upstream bitcoind as mainchain
|
||||
- stage: test
|
||||
env: >-
|
||||
HOST=x86_64-unknown-linux-gnu
|
||||
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
|
||||
NO_DEPENDS=1
|
||||
RUN_UNIT_TESTS=false
|
||||
RUN_BITCOIN_TESTS=false
|
||||
RUN_FUNCTIONAL_TESTS=false
|
||||
RUN_FEDPEG_BITCOIND_TEST=true
|
||||
GOAL="install"
|
||||
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=no --disable-tests --disable-bench CPPFLAGS=-DDEBUG_LOCKORDER"
|
||||
|
|
|
|||
|
|
@ -71,3 +71,13 @@ if [ "$RUN_BITCOIN_TESTS" = "true" ]; then
|
|||
DOCKER_EXEC test/bitcoin_functional/functional/test_runner.py --combinedlogslen=4000 --coverage --quiet --failfast ${extended}
|
||||
END_FOLD
|
||||
fi
|
||||
|
||||
if [ "$RUN_FEDPEG_BITCOIND_TEST" = "true" ]; then
|
||||
BEGIN_FOLD fedpeg-bitcoind-test
|
||||
BITCOIND_VERSION=0.17.1
|
||||
BITCOIND_ARCH=x86_64-linux-gnu
|
||||
DOCKER_EXEC curl -O https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz
|
||||
DOCKER_EXEC tar -zxf bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz
|
||||
DOCKER_EXEC test/functional/feature_fedpeg.py --parent_bitcoin --parent_binpath $(pwd)/bitcoin-$BITCOIND_VERSION/bin/bitcoind
|
||||
END_FOLD
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ class CCustomParams : public CRegTestParams {
|
|||
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentpubkeyprefix", 111));
|
||||
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-parentscriptprefix", 196));
|
||||
parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
|
||||
parent_blech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
|
||||
parent_blech32_hrp = args.GetArg("-parent_blech32_hrp", "bcrt");
|
||||
|
||||
base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-blindedprefix", 4));
|
||||
|
||||
|
|
|
|||
|
|
@ -38,16 +38,22 @@ class FedPegTest(BitcoinTestFramework):
|
|||
|
||||
self.nodes = []
|
||||
# Setup parent nodes
|
||||
parent_chain = "regtest" if self.options.parent_bitcoin else "parent"
|
||||
parent_chain = "parent" if not self.options.parent_bitcoin else "regtest"
|
||||
parent_binary = [self.options.parent_binpath] if self.options.parent_binpath != "" else None
|
||||
for n in range(2):
|
||||
extra_args = [
|
||||
"-printtoconsole=0",
|
||||
"-port="+str(p2p_port(n)),
|
||||
"-rpcport="+str(rpc_port(n))
|
||||
]
|
||||
if self.options.parent_bitcoin:
|
||||
# bitcoind can't read elements.conf config files
|
||||
extra_args.extend([
|
||||
"-regtest=1",
|
||||
"-printtoconsole=0",
|
||||
"-server=1",
|
||||
"-discover=0",
|
||||
"-keypool=1",
|
||||
"-listenonion=0",
|
||||
"-addresstype=legacy", # To make sure bitcoind gives back p2pkh no matter version
|
||||
])
|
||||
else:
|
||||
|
|
@ -58,7 +64,7 @@ class FedPegTest(BitcoinTestFramework):
|
|||
"-signblockscript=51", # OP_TRUE
|
||||
])
|
||||
|
||||
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary)
|
||||
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary, chain_in_args=[not self.options.parent_bitcoin])
|
||||
self.start_node(n)
|
||||
print("Node {} started".format(n))
|
||||
|
||||
|
|
@ -86,6 +92,8 @@ class FedPegTest(BitcoinTestFramework):
|
|||
'-mainchainrpchost=127.0.0.1',
|
||||
'-mainchainrpcport=%s' % rpc_port(n),
|
||||
'-recheckpeginblockinterval=15', # Long enough to allow failure and repair before timeout
|
||||
'-parentpubkeyprefix=111',
|
||||
'-parentscriptprefix=196',
|
||||
]
|
||||
if not self.options.parent_bitcoin:
|
||||
extra_args.extend([
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
|
||||
# Public helper methods. These can be accessed by the subclass test scripts.
|
||||
|
||||
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, binary=None):
|
||||
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, binary=None, chain_in_args=None):
|
||||
"""Instantiate TestNode objects"""
|
||||
if self.bind_to_localhost_only:
|
||||
extra_confs = [["bind=127.0.0.1"]] * num_nodes
|
||||
|
|
@ -292,13 +292,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
binary = [self.options.bitcoind] * num_nodes
|
||||
if chain is None:
|
||||
chain = [self.chain] * num_nodes
|
||||
if chain_in_args is None:
|
||||
chain_in_args = [True] * num_nodes
|
||||
assert_equal(len(extra_confs), num_nodes)
|
||||
assert_equal(len(extra_args), num_nodes)
|
||||
assert_equal(len(binary), num_nodes)
|
||||
assert_equal(len(chain), num_nodes)
|
||||
for i in range(num_nodes):
|
||||
numnode = len(self.nodes)
|
||||
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), chain[i], rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
|
||||
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), chain[i], rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli, chain_in_args=chain_in_args[i]))
|
||||
|
||||
def start_node(self, i, *args, **kwargs):
|
||||
"""Start a bitcoind"""
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class TestNode():
|
|||
To make things easier for the test writer, any unrecognised messages will
|
||||
be dispatched to the RPC connection."""
|
||||
|
||||
def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False):
|
||||
def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cli, mocktime, coverage_dir, extra_conf=None, extra_args=None, use_cli=False, chain_in_args=True):
|
||||
self.index = i
|
||||
self.datadir = datadir
|
||||
self.stdout_dir = os.path.join(self.datadir, "stdout")
|
||||
|
|
@ -77,7 +77,6 @@ class TestNode():
|
|||
self.args = [
|
||||
self.binary,
|
||||
"-datadir=" + self.datadir,
|
||||
"-chain=" + self.chain,
|
||||
"-logtimemicros",
|
||||
"-debug",
|
||||
"-debugexclude=libevent",
|
||||
|
|
@ -85,6 +84,8 @@ class TestNode():
|
|||
"-mocktime=" + str(mocktime),
|
||||
"-uacomment=testnode%d" % i
|
||||
]
|
||||
if chain_in_args:
|
||||
self.args += ["-chain=" + self.chain]
|
||||
|
||||
self.cli = TestNodeCLI(bitcoin_cli, self.datadir, self.chain)
|
||||
self.use_cli = use_cli
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue