Skip to content

Commit 8910b47

Browse files
author
MarcoFalke
committed
Merge bitcoin#9768: [qa] Add logging to test_framework.py
64c0800 Use logging in individual tests (John Newbery) 38ad281 Use logging in test_framework/comptool.py (John Newbery) ff19073 Use logging in test_framework/blockstore.py (John Newbery) 2a9c7c7 Use logging in test_framework/util.py (John Newbery) b0dec4a Remove manual debug settings in qa tests. (John Newbery) af1363c Always enable debug log and microsecond logging for test nodes. (John Newbery) 6d0e325 Use logging in mininode.py (John Newbery) 553a976 Add logging to p2p-segwit.py (John Newbery) 0e6d23d Add logging to test_framework.py (John Newbery) Tree-SHA512: 42ee2acbf444ec32d796f930f9f6e272da03c75e93d974a126d4ea9b2dbaa77cc57ab5e63ce3fd33d609049d884eb8d9f65272c08922d10f8db69d4a60ad05a3
2 parents 5703dff + 64c0800 commit 8910b47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+398
-394
lines changed

qa/rpc-tests/abandonconflict.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def __init__(self):
2323

2424
def setup_network(self):
2525
self.nodes = []
26-
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"]))
27-
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug","-logtimemicros"]))
26+
self.nodes.append(start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.00001"]))
27+
self.nodes.append(start_node(1, self.options.tmpdir))
2828
connect_nodes(self.nodes[0], 1)
2929

3030
def run_test(self):
@@ -81,7 +81,7 @@ def run_test(self):
8181
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
8282
# TODO: redo with eviction
8383
stop_node(self.nodes[0],0)
84-
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
84+
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
8585

8686
# Verify txs no longer in mempool
8787
assert_equal(len(self.nodes[0].getrawmempool()), 0)
@@ -107,7 +107,7 @@ def run_test(self):
107107

108108
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
109109
stop_node(self.nodes[0],0)
110-
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"])
110+
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.00001"])
111111
assert_equal(len(self.nodes[0].getrawmempool()), 0)
112112
assert_equal(self.nodes[0].getbalance(), balance)
113113

@@ -127,7 +127,7 @@ def run_test(self):
127127

128128
# Remove using high relay fee again
129129
stop_node(self.nodes[0],0)
130-
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
130+
self.nodes[0]=start_node(0, self.options.tmpdir, ["-minrelaytxfee=0.0001"])
131131
assert_equal(len(self.nodes[0].getrawmempool()), 0)
132132
newbalance = self.nodes[0].getbalance()
133133
assert_equal(newbalance, balance - Decimal("24.9996"))
@@ -158,9 +158,9 @@ def run_test(self):
158158
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
159159
newbalance = self.nodes[0].getbalance()
160160
#assert_equal(newbalance, balance - Decimal("10"))
161-
print("If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer")
162-
print("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
163-
print(str(balance) + " -> " + str(newbalance) + " ?")
161+
self.log.info("If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer")
162+
self.log.info("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
163+
self.log.info(str(balance) + " -> " + str(newbalance) + " ?")
164164

165165
if __name__ == '__main__':
166166
AbandonConflictTest().main()

qa/rpc-tests/assumevalid.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def setup_network(self):
7373
# we need to pre-mine a block with an invalid transaction
7474
# signature so we can pass in the block hash as assumevalid.
7575
self.nodes = []
76-
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
76+
self.nodes.append(start_node(0, self.options.tmpdir))
7777

7878
def run_test(self):
7979

@@ -146,14 +146,14 @@ def run_test(self):
146146

147147
# Start node1 and node2 with assumevalid so they accept a block with a bad signature.
148148
self.nodes.append(start_node(1, self.options.tmpdir,
149-
["-debug", "-assumevalid=" + hex(block102.sha256)]))
149+
["-assumevalid=" + hex(block102.sha256)]))
150150
node1 = BaseNode() # connects to node1
151151
connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1], node1))
152152
node1.add_connection(connections[1])
153153
node1.wait_for_verack()
154154

155155
self.nodes.append(start_node(2, self.options.tmpdir,
156-
["-debug", "-assumevalid=" + hex(block102.sha256)]))
156+
["-assumevalid=" + hex(block102.sha256)]))
157157
node2 = BaseNode() # connects to node2
158158
connections.append(NodeConn('127.0.0.1', p2p_port(2), self.nodes[2], node2))
159159
node2.add_connection(connections[2])

qa/rpc-tests/bip65-cltv-p2p.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self):
4343
def setup_network(self):
4444
# Must set the blockversion for this test
4545
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
46-
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=3']],
46+
extra_args=[['-whitelist=127.0.0.1', '-blockversion=3']],
4747
binary=[self.options.testbinary])
4848

4949
def run_test(self):

qa/rpc-tests/bip68-112-113-p2p.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self):
9999
def setup_network(self):
100100
# Must set the blockversion for this test
101101
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
102-
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=4']],
102+
extra_args=[['-whitelist=127.0.0.1', '-blockversion=4']],
103103
binary=[self.options.testbinary])
104104

105105
def run_test(self):

qa/rpc-tests/bip68-sequence.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def __init__(self):
2424

2525
def setup_network(self):
2626
self.nodes = []
27-
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"]))
28-
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-acceptnonstdtxn=0"]))
27+
self.nodes.append(start_node(0, self.options.tmpdir))
28+
self.nodes.append(start_node(1, self.options.tmpdir, ["-acceptnonstdtxn=0"]))
2929
self.is_network_split = False
3030
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]
3131
connect_nodes(self.nodes[0], 1)
@@ -34,26 +34,26 @@ def run_test(self):
3434
# Generate some coins
3535
self.nodes[0].generate(110)
3636

37-
print("Running test disable flag")
37+
self.log.info("Running test disable flag")
3838
self.test_disable_flag()
3939

40-
print("Running test sequence-lock-confirmed-inputs")
40+
self.log.info("Running test sequence-lock-confirmed-inputs")
4141
self.test_sequence_lock_confirmed_inputs()
4242

43-
print("Running test sequence-lock-unconfirmed-inputs")
43+
self.log.info("Running test sequence-lock-unconfirmed-inputs")
4444
self.test_sequence_lock_unconfirmed_inputs()
4545

46-
print("Running test BIP68 not consensus before versionbits activation")
46+
self.log.info("Running test BIP68 not consensus before versionbits activation")
4747
self.test_bip68_not_consensus()
4848

49-
print("Activating BIP68 (and 112/113)")
49+
self.log.info("Activating BIP68 (and 112/113)")
5050
self.activateCSV()
5151

52-
print("Verifying nVersion=2 transactions are standard.")
53-
print("Note that with current versions of bitcoin software, nVersion=2 transactions are always standard (independent of BIP68 activation status).")
52+
self.log.info("Verifying nVersion=2 transactions are standard.")
53+
self.log.info("Note that nVersion=2 transactions are always standard (independent of BIP68 activation status).")
5454
self.test_version2_relay()
5555

56-
print("Passed\n")
56+
self.log.info("Passed")
5757

5858
# Test that BIP68 is not in effect if tx version is 1, or if
5959
# the first sequence bit is set.

qa/rpc-tests/bip9-softforks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self):
3535

3636
def setup_network(self):
3737
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
38-
extra_args=[['-debug', '-whitelist=127.0.0.1']],
38+
extra_args=[['-whitelist=127.0.0.1']],
3939
binary=[self.options.testbinary])
4040

4141
def run_test(self):

qa/rpc-tests/bipdersig-p2p.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self):
5050
def setup_network(self):
5151
# Must set the blockversion for this test
5252
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
53-
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=2']],
53+
extra_args=[['-whitelist=127.0.0.1', '-blockversion=2']],
5454
binary=[self.options.testbinary])
5555

5656
def run_test(self):

qa/rpc-tests/bumpfee.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self):
2626
self.setup_clean_chain = True
2727

2828
def setup_network(self, split=False):
29-
extra_args = [["-debug", "-prematurewitness", "-walletprematurewitness", "-walletrbf={}".format(i)]
29+
extra_args = [["-prematurewitness", "-walletprematurewitness", "-walletrbf={}".format(i)]
3030
for i in range(self.num_nodes)]
3131
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args)
3232

@@ -45,7 +45,7 @@ def run_test(self):
4545
rbf_node_address = rbf_node.getnewaddress()
4646

4747
# fund rbf node with 10 coins of 0.001 btc (100,000 satoshis)
48-
print("Mining blocks...")
48+
self.log.info("Mining blocks...")
4949
peer_node.generate(110)
5050
self.sync_all()
5151
for i in range(25):
@@ -55,7 +55,7 @@ def run_test(self):
5555
self.sync_all()
5656
assert_equal(rbf_node.getbalance(), Decimal("0.025"))
5757

58-
print("Running tests")
58+
self.log.info("Running tests")
5959
dest_address = peer_node.getnewaddress()
6060
test_small_output_fails(rbf_node, dest_address)
6161
test_dust_to_fee(rbf_node, dest_address)
@@ -70,7 +70,7 @@ def run_test(self):
7070
test_unconfirmed_not_spendable(rbf_node, rbf_node_address)
7171
test_bumpfee_metadata(rbf_node, dest_address)
7272
test_locked_wallet_fails(rbf_node, dest_address)
73-
print("Success")
73+
self.log.info("Success")
7474

7575

7676
def test_simple_bumpfee_succeeds(rbf_node, peer_node, dest_address):

qa/rpc-tests/fundrawtransaction.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ def setup_network(self, split=False):
3434
self.sync_all()
3535

3636
def run_test(self):
37-
print("Mining blocks...")
38-
3937
min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
4038
# This test is not meant to test fee estimation and we'd like
4139
# to be sure all txs are sent at a consistent desired feerate

qa/rpc-tests/getblocktemplate_longpoll.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self):
2929
self.setup_clean_chain = False
3030

3131
def run_test(self):
32-
print("Warning: this test will take about 70 seconds in the best case. Be patient.")
32+
self.log.info("Warning: this test will take about 70 seconds in the best case. Be patient.")
3333
self.nodes[0].generate(10)
3434
templat = self.nodes[0].getblocktemplate()
3535
longpollid = templat['longpollid']

0 commit comments

Comments
 (0)