mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
MERGE-FIX: Adapt bitcoin_functional
This commit is contained in:
parent
449ac89f39
commit
71723f794f
5 changed files with 48 additions and 17 deletions
|
|
@ -23,7 +23,8 @@ class FilelockTest(BitcoinTestFramework):
|
|||
self.log.info("Using datadir {}".format(datadir))
|
||||
|
||||
self.log.info("Check that we can't start a second bitcoind instance using the same datadir")
|
||||
expected_msg = "Error: Cannot obtain a lock on data directory {}. Bitcoin Core is probably already running.".format(datadir)
|
||||
# ELEMENTS:
|
||||
expected_msg = "Error: Cannot obtain a lock on data directory {}. Elements Core is probably already running.".format(datadir)
|
||||
self.nodes[1].assert_start_raises_init_error(extra_args=['-datadir={}'.format(self.nodes[0].datadir), '-noserver'], expected_msg=expected_msg)
|
||||
|
||||
if self.is_wallet_compiled():
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [])
|
||||
|
||||
# Test `createrawtransaction` invalid extra parameters
|
||||
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [], {}, 0, False, 'foo')
|
||||
# ELEMENTS:
|
||||
#assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [], {}, 0, False, 'foo')
|
||||
|
||||
# Test `createrawtransaction` invalid `inputs`
|
||||
txid = '1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000'
|
||||
|
|
|
|||
|
|
@ -119,8 +119,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
help="The seed to use for assigning port numbers (default: current process id)")
|
||||
parser.add_argument("--coveragedir", dest="coveragedir",
|
||||
help="Write tested RPC commands into this directory")
|
||||
# ELEMENTS:
|
||||
parser.add_argument("--configfile", dest="configfile",
|
||||
default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"),
|
||||
default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../../config.ini"),
|
||||
help="Location of the test framework config file (default: %(default)s)")
|
||||
parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
|
||||
help="Attach a python debugger if test fails")
|
||||
|
|
@ -137,8 +138,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
self.options.bitcoind = os.getenv("BITCOIND", default=config["environment"]["BUILDDIR"] + '/src/bitcoind' + config["environment"]["EXEEXT"])
|
||||
self.options.bitcoincli = os.getenv("BITCOINCLI", default=config["environment"]["BUILDDIR"] + '/src/bitcoin-cli' + config["environment"]["EXEEXT"])
|
||||
self.options.bitcoind = os.getenv("BITCOIND", default=config["environment"]["BUILDDIR"] + '/src/elementsd' + config["environment"]["EXEEXT"])
|
||||
self.options.bitcoincli = os.getenv("BITCOINCLI", default=config["environment"]["BUILDDIR"] + '/src/elements-cli' + config["environment"]["EXEEXT"])
|
||||
|
||||
os.environ['PATH'] = os.pathsep.join([
|
||||
os.path.join(config['environment']['BUILDDIR'], 'src'),
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ def initialize_datadir(dirname, n):
|
|||
datadir = get_datadir_path(dirname, n)
|
||||
if not os.path.isdir(datadir):
|
||||
os.makedirs(datadir)
|
||||
with open(os.path.join(datadir, "bitcoin.conf"), 'w', encoding='utf8') as f:
|
||||
with open(os.path.join(datadir, "elements.conf"), 'w', encoding='utf8') as f:
|
||||
f.write("regtest=1\n")
|
||||
f.write("[regtest]\n")
|
||||
f.write("port=" + str(p2p_port(n)) + "\n")
|
||||
|
|
@ -302,6 +302,26 @@ def initialize_datadir(dirname, n):
|
|||
f.write("discover=0\n")
|
||||
f.write("listenonion=0\n")
|
||||
f.write("printtoconsole=0\n")
|
||||
# Elements:
|
||||
f.write("con_blocksubsidy=5000000000\n")
|
||||
f.write("con_connect_coinbase=0\n")
|
||||
f.write("con_has_parent_chain=0\n")
|
||||
f.write("parentgenesisblockhash=0\n")
|
||||
f.write("anyonecanspendaremine=0\n")
|
||||
f.write("con_blockheightinheader=0\n")
|
||||
f.write("con_elementsmode=0\n")
|
||||
f.write("con_signed_blocks=0\n")
|
||||
f.write("multi_data_permitted=0\n")
|
||||
f.write("walletrbf=0\n") # Default is 1 in Elements
|
||||
f.write("con_bip34height=100000000\n")
|
||||
f.write("con_bip65height=1351\n")
|
||||
f.write("con_bip66height=1251\n")
|
||||
f.write("con_genesis_style=bitcoin\n")
|
||||
f.write("con_csv_deploy_start=0\n") # Default is -1 (always active)
|
||||
f.write("blindedaddresses=0\n")
|
||||
f.write("pubkeyprefix=111\n")
|
||||
f.write("scriptprefix=196\n")
|
||||
f.write("bech32_hrp=bcrt\n")
|
||||
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
|
||||
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
|
||||
return datadir
|
||||
|
|
@ -310,15 +330,15 @@ def get_datadir_path(dirname, n):
|
|||
return os.path.join(dirname, "node" + str(n))
|
||||
|
||||
def append_config(datadir, options):
|
||||
with open(os.path.join(datadir, "bitcoin.conf"), 'a', encoding='utf8') as f:
|
||||
with open(os.path.join(datadir, "elements.conf"), 'a', encoding='utf8') as f:
|
||||
for option in options:
|
||||
f.write(option + "\n")
|
||||
|
||||
def get_auth_cookie(datadir):
|
||||
user = None
|
||||
password = None
|
||||
if os.path.isfile(os.path.join(datadir, "bitcoin.conf")):
|
||||
with open(os.path.join(datadir, "bitcoin.conf"), 'r', encoding='utf8') as f:
|
||||
if os.path.isfile(os.path.join(datadir, "elements.conf")):
|
||||
with open(os.path.join(datadir, "elements.conf"), 'r', encoding='utf8') as f:
|
||||
for line in f:
|
||||
if line.startswith("rpcuser="):
|
||||
assert user is None # Ensure that there is only one rpcuser line
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ BASE_SCRIPTS = [
|
|||
# vv Tests less than 30s vv
|
||||
'wallet_keypool_topup.py',
|
||||
'interface_zmq.py',
|
||||
'interface_bitcoin_cli.py',
|
||||
# ELEMENTS:
|
||||
#'interface_bitcoin_cli.py',
|
||||
'mempool_resurrect.py',
|
||||
'wallet_txn_doublespend.py --mineblock',
|
||||
'wallet_txn_clone.py',
|
||||
|
|
@ -121,7 +122,8 @@ BASE_SCRIPTS = [
|
|||
'wallet_disableprivatekeys.py --usecli',
|
||||
'interface_http.py',
|
||||
'rpc_psbt.py',
|
||||
'rpc_users.py',
|
||||
# ELEMENTS:
|
||||
#'rpc_users.py',
|
||||
'feature_proxy.py',
|
||||
'rpc_signrawtransaction.py',
|
||||
'wallet_groups.py',
|
||||
|
|
@ -176,12 +178,14 @@ BASE_SCRIPTS = [
|
|||
'feature_uacomment.py',
|
||||
'feature_filelock.py',
|
||||
'p2p_unrequested_blocks.py',
|
||||
'feature_includeconf.py',
|
||||
# ELEMENTS:
|
||||
#'feature_includeconf.py',
|
||||
'rpc_scantxoutset.py',
|
||||
'feature_logging.py',
|
||||
'p2p_node_network_limited.py',
|
||||
'feature_blocksdir.py',
|
||||
'feature_config_args.py',
|
||||
# ELEMENTS:
|
||||
#'feature_config_args.py',
|
||||
'rpc_help.py',
|
||||
'feature_help.py',
|
||||
# Don't append tests at the end to avoid merge conflicts
|
||||
|
|
@ -233,7 +237,8 @@ def main():
|
|||
|
||||
# Read config generated by configure.
|
||||
config = configparser.ConfigParser()
|
||||
configfile = os.path.abspath(os.path.dirname(__file__)) + "/../config.ini"
|
||||
# ELEMENTS:
|
||||
configfile = os.path.abspath(os.path.dirname(__file__)) + "/../../config.ini"
|
||||
config.read_file(open(configfile, encoding="utf8"))
|
||||
|
||||
passon_args.append("--configfile=%s" % configfile)
|
||||
|
|
@ -303,7 +308,8 @@ def main():
|
|||
if args.help:
|
||||
# Print help for test_runner.py, then print help of the first script (with args removed) and exit.
|
||||
parser.print_help()
|
||||
subprocess.check_call([sys.executable, os.path.join(config["environment"]["SRCDIR"], 'test', 'functional', test_list[0].split()[0]), '-h'])
|
||||
# ELEMENTS:
|
||||
subprocess.check_call([sys.executable, os.path.join(config["environment"]["SRCDIR"], 'test', 'bitcoin_functional', 'functional', test_list[0].split()[0]), '-h'])
|
||||
sys.exit(0)
|
||||
|
||||
check_script_list(src_dir=config["environment"]["SRCDIR"], fail_on_warn=args.ci)
|
||||
|
|
@ -340,7 +346,8 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
|
|||
if os.path.isdir(cache_dir):
|
||||
print("%sWARNING!%s There is a cache directory here: %s. If tests fail unexpectedly, try deleting the cache directory." % (BOLD[1], BOLD[0], cache_dir))
|
||||
|
||||
tests_dir = src_dir + '/test/functional/'
|
||||
# ELEMENTS:
|
||||
tests_dir = src_dir + '/test/bitcoin_functional/functional/'
|
||||
|
||||
flags = ['--cachedir={}'.format(cache_dir)] + args
|
||||
|
||||
|
|
@ -571,7 +578,8 @@ def check_script_list(*, src_dir, fail_on_warn):
|
|||
|
||||
Check that there are no scripts in the functional tests directory which are
|
||||
not being run by pull-tester.py."""
|
||||
script_dir = src_dir + '/test/functional/'
|
||||
# ELEMENTS:
|
||||
script_dir = src_dir + '/test/bitcoin_functional/functional/'
|
||||
python_files = set([test_file for test_file in os.listdir(script_dir) if test_file.endswith(".py")])
|
||||
missed_tests = list(python_files - set(map(lambda x: x.split()[0], ALL_SCRIPTS + NON_SCRIPTS)))
|
||||
if len(missed_tests) != 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue