qa: finish the python3 port far enough to build the shared test chain
Follow-up to5e0a70683, which got start_node() working. Three more defects sat behind it: - initialize_chain() builds the 4-node cache with its own daemon invocation, which5e0a70683did not touch. It therefore still omitted -regtest (so those cache nodes ran on MAINNET) and -asmap (so they refused to start at all). Every test that uses the cache -- which is most of the wallet suite -- died there. - reindex.py and getblocktemplate_longpoll.py each carried a single python2 print statement, which is the whole reason they would not even parse under python3. Shebangs updated to match. The suite still does not pass: initialize_chain hits a remaining py2 str+int concatenation, and getblocktemplate.py reaches a real test assertion. Both are beyond this commit, but the harness now gets far enough to start nodes, answer RPC and begin building the shared chain, which it could not do before.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2016-2024 The Hush developers
|
# Copyright (c) 2016-2024 The Hush developers
|
||||||
# Copyright (c) 2014 The Bitcoin Core developers
|
# Copyright (c) 2014 The Bitcoin Core developers
|
||||||
# Distributed under the GPLv3 software license, see the accompanying
|
# Distributed under the GPLv3 software license, see the accompanying
|
||||||
@@ -52,7 +52,7 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
print "Warning: this test will take about 70 seconds in the best case. Be patient."
|
print("Warning: this test will take about 70 seconds in the best case. Be patient.")
|
||||||
self.nodes[0].generate(10)
|
self.nodes[0].generate(10)
|
||||||
templat = self.nodes[0].getblocktemplate()
|
templat = self.nodes[0].getblocktemplate()
|
||||||
longpollid = templat['longpollid']
|
longpollid = templat['longpollid']
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2014 The Bitcoin Core developers
|
# Copyright (c) 2014 The Bitcoin Core developers
|
||||||
# Copyright (c) 2016-2024 The Hush developers
|
# Copyright (c) 2016-2024 The Hush developers
|
||||||
# Released under the GPLv3
|
# Released under the GPLv3
|
||||||
@@ -28,7 +28,7 @@ class ReindexTest(BitcoinTestFramework):
|
|||||||
wait_bitcoinds()
|
wait_bitcoinds()
|
||||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex", "-checkblockindex=1"])
|
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug", "-reindex", "-checkblockindex=1"])
|
||||||
assert_equal(self.nodes[0].getblockcount(), 3)
|
assert_equal(self.nodes[0].getblockcount(), 3)
|
||||||
print "Success"
|
print("Success")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ReindexTest().main()
|
ReindexTest().main()
|
||||||
|
|||||||
@@ -145,7 +145,13 @@ def initialize_chain(test_dir):
|
|||||||
# Create cache directories, run hushds:
|
# Create cache directories, run hushds:
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
datadir=initialize_datadir("cache", i)
|
datadir=initialize_datadir("cache", i)
|
||||||
args = [ os.getenv("BITCOIND", "dragonxd"), "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
# Same two requirements as start_node(): -regtest must be a command-line flag (the
|
||||||
|
# conf key is ignored, and without it this cache node runs on MAINNET), and -asmap
|
||||||
|
# must be absolute or dragonxd refuses to start.
|
||||||
|
args = [ os.getenv("BITCOIND", "dragonxd"), "-regtest", "-connect=0", "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||||
|
_am = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../asmap.dat")
|
||||||
|
if os.path.exists(_am):
|
||||||
|
args.append("-asmap=" + os.path.realpath(_am))
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user