Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travis fedpeg test with downloaded bitcoind #533

Merged
merged 1 commit into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
instagibbs marked this conversation as resolved.
Show resolved Hide resolved
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"
10 changes: 10 additions & 0 deletions .travis/test_06_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops


base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetArg("-blindedprefix", 4));

Expand Down
14 changes: 11 additions & 3 deletions test/functional/feature_fedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,22 @@ def setup_network(self, split=False):

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:
Expand All @@ -58,7 +64,7 @@ def setup_network(self, split=False):
"-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))

Expand Down Expand Up @@ -86,6 +92,8 @@ def setup_network(self, split=False):
'-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([
Expand Down
6 changes: 4 additions & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def run_test(self):

# 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
Expand All @@ -292,13 +292,15 @@ def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, chain=None, bin
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"""
Expand Down
5 changes: 3 additions & 2 deletions test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -77,14 +77,15 @@ def __init__(self, i, datadir, chain, *, rpchost, timewait, bitcoind, bitcoin_cl
self.args = [
self.binary,
"-datadir=" + self.datadir,
"-chain=" + self.chain,
"-logtimemicros",
"-debug",
"-debugexclude=libevent",
"-debugexclude=leveldb",
"-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
Expand Down