Allow rpc python tests to be run standalone
That is, without having to launch with test_runner.py. There are several places where the BITCOIND environment variable determines the executable, but the default is "bitcoind"; change the default to "src/zcashd". This does require running the test from the top-level directory. Also change the environment variable from BITCOIND to ZCASHD. This could conceivable break someone, but it just makes too much sense not to do.
This commit is contained in:
parent
230ae805af
commit
c5752c7ea2
|
@ -22,3 +22,10 @@ Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- The `boost` and `native_b2` dependencies have been updated to version 1.79.0
|
- The `boost` and `native_b2` dependencies have been updated to version 1.79.0
|
||||||
|
|
||||||
|
Tests
|
||||||
|
-----
|
||||||
|
|
||||||
|
- The environment variable that allows users of the rpc (Python) tests to
|
||||||
|
override the default path to the `zcashd` executable has been changed
|
||||||
|
from `BITCOIND` to `ZCASHD`.
|
||||||
|
|
|
@ -273,8 +273,8 @@ def run_tests(test_list, src_dir, build_dir, exeext, jobs=1, enable_coverage=Fal
|
||||||
BOLD = ('\033[0m', '\033[1m')
|
BOLD = ('\033[0m', '\033[1m')
|
||||||
|
|
||||||
#Set env vars
|
#Set env vars
|
||||||
if "BITCOIND" not in os.environ:
|
if "ZCASHD" not in os.environ:
|
||||||
os.environ["BITCOIND"] = build_dir + '/src/zcashd' + exeext
|
os.environ["ZCASHD"] = build_dir + '/src/zcashd' + exeext
|
||||||
|
|
||||||
tests_dir = src_dir + '/qa/rpc-tests/'
|
tests_dir = src_dir + '/qa/rpc-tests/'
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
from test_framework.mininode import NodeConn, NodeConnCB, NetworkThread, \
|
from test_framework.mininode import NodeConn, NodeConnCB, NetworkThread, \
|
||||||
EarlyDisconnectError, CInv, msg_inv, mininode_lock
|
EarlyDisconnectError, CInv, msg_inv, mininode_lock
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import start_nodes, p2p_port
|
from test_framework.util import ZCASHD_BINARY, start_nodes, p2p_port
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
@ -82,7 +82,7 @@ class TestManager(NodeConnCB):
|
||||||
class MaxBlocksInFlightTest(BitcoinTestFramework):
|
class MaxBlocksInFlightTest(BitcoinTestFramework):
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
parser.add_option("--testbinary", dest="testbinary",
|
parser.add_option("--testbinary", dest="testbinary",
|
||||||
default=os.getenv("BITCOIND", "bitcoind"),
|
default=os.getenv("ZCASHD", ZCASHD_BINARY),
|
||||||
help="Binary to test max block requests behavior")
|
help="Binary to test max block requests behavior")
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from test_framework.mininode import ( \
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import ( \
|
from test_framework.util import ( \
|
||||||
assert_equal, initialize_chain_clean, \
|
ZCASHD_BINARY, assert_equal, initialize_chain_clean, \
|
||||||
start_node, stop_node, \
|
start_node, stop_node, \
|
||||||
p2p_port, \
|
p2p_port, \
|
||||||
)
|
)
|
||||||
|
@ -115,7 +115,7 @@ class MaxUploadTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
parser.add_option("--testbinary", dest="testbinary",
|
parser.add_option("--testbinary", dest="testbinary",
|
||||||
default=os.getenv("BITCOIND", "zcashd"),
|
default=os.getenv("ZCASHD", ZCASHD_BINARY),
|
||||||
help="zcashd binary to test")
|
help="zcashd binary to test")
|
||||||
|
|
||||||
def setup_chain(self):
|
def setup_chain(self):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from test_framework.mininode import CBlockHeader, CInv, NodeConn, NodeConnCB, \
|
||||||
mininode_lock
|
mininode_lock
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal, \
|
from test_framework.util import assert_equal, \
|
||||||
start_node, p2p_port
|
start_node, p2p_port, ZCASHD_BINARY
|
||||||
from test_framework.blocktools import create_block, create_coinbase
|
from test_framework.blocktools import create_block, create_coinbase
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -114,8 +114,8 @@ class TestNode(NodeConnCB):
|
||||||
class AcceptBlockTest(BitcoinTestFramework):
|
class AcceptBlockTest(BitcoinTestFramework):
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
parser.add_option("--testbinary", dest="testbinary",
|
parser.add_option("--testbinary", dest="testbinary",
|
||||||
default=os.getenv("BITCOIND", "bitcoind"),
|
default=os.getenv("ZCASHD", ZCASHD_BINARY),
|
||||||
help="bitcoind binary to test")
|
help="zcashd binary to test")
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
|
@ -15,6 +15,7 @@ import traceback
|
||||||
|
|
||||||
from .authproxy import JSONRPCException
|
from .authproxy import JSONRPCException
|
||||||
from .util import (
|
from .util import (
|
||||||
|
ZCASHD_BINARY,
|
||||||
initialize_chain,
|
initialize_chain,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
connect_nodes_bi,
|
connect_nodes_bi,
|
||||||
|
@ -194,11 +195,11 @@ class ComparisonTestFramework(BitcoinTestFramework):
|
||||||
|
|
||||||
def add_options(self, parser):
|
def add_options(self, parser):
|
||||||
parser.add_option("--testbinary", dest="testbinary",
|
parser.add_option("--testbinary", dest="testbinary",
|
||||||
default=os.getenv("BITCOIND", "bitcoind"),
|
default=os.getenv("ZCASHD", ZCASHD_BINARY),
|
||||||
help="bitcoind binary to test")
|
help="zcashd binary to test")
|
||||||
parser.add_option("--refbinary", dest="refbinary",
|
parser.add_option("--refbinary", dest="refbinary",
|
||||||
default=os.getenv("BITCOIND", "bitcoind"),
|
default=os.getenv("ZCASHD", ZCASHD_BINARY),
|
||||||
help="bitcoind binary to use for reference nodes (if any)")
|
help="zcashd binary to use for reference nodes (if any)")
|
||||||
|
|
||||||
def setup_network(self):
|
def setup_network(self):
|
||||||
self.nodes = start_nodes(
|
self.nodes = start_nodes(
|
||||||
|
|
|
@ -27,6 +27,8 @@ import errno
|
||||||
from . import coverage
|
from . import coverage
|
||||||
from .authproxy import AuthServiceProxy, JSONRPCException
|
from .authproxy import AuthServiceProxy, JSONRPCException
|
||||||
|
|
||||||
|
ZCASHD_BINARY = os.path.join('src', 'zcashd')
|
||||||
|
|
||||||
DEFAULT_FEE = Decimal('0.00001')
|
DEFAULT_FEE = Decimal('0.00001')
|
||||||
DEFAULT_FEE_ZATS = 1000
|
DEFAULT_FEE_ZATS = 1000
|
||||||
|
|
||||||
|
@ -261,7 +263,7 @@ def initialize_chain(test_dir, num_nodes, cachedir):
|
||||||
# Create cache directories, run bitcoinds:
|
# Create cache directories, run bitcoinds:
|
||||||
for i in range(MAX_NODES):
|
for i in range(MAX_NODES):
|
||||||
datadir=initialize_datadir(cachedir, i)
|
datadir=initialize_datadir(cachedir, i)
|
||||||
args = [ os.getenv("BITCOIND", "bitcoind"), "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
args = [ os.getenv("ZCASHD", ZCASHD_BINARY), "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||||
args.extend([
|
args.extend([
|
||||||
'-nuparams=5ba81b19:1', # Overwinter
|
'-nuparams=5ba81b19:1', # Overwinter
|
||||||
'-nuparams=76b809bb:1', # Sapling
|
'-nuparams=76b809bb:1', # Sapling
|
||||||
|
@ -353,7 +355,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
||||||
"""
|
"""
|
||||||
datadir = os.path.join(dirname, "node"+str(i))
|
datadir = os.path.join(dirname, "node"+str(i))
|
||||||
if binary is None:
|
if binary is None:
|
||||||
binary = os.getenv("BITCOIND", "bitcoind")
|
binary = os.getenv("ZCASHD", ZCASHD_BINARY)
|
||||||
args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ]
|
args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ]
|
||||||
args.extend([
|
args.extend([
|
||||||
'-nuparams=5ba81b19:1', # Overwinter
|
'-nuparams=5ba81b19:1', # Overwinter
|
||||||
|
|
Loading…
Reference in New Issue