Continues #10082
TestNode is a class responsible for all state related to a bitcoind node under test. It stores local state, is responsible for tracking the bitcoind process and delegates unrecognised messages to the RPC connection.
This commit changes start_nodes and stop_nodes to start and stop the bitcoind nodes in parallel, making test setup and teardown much faster.
On my vm, this changeset reduces total test_runner runtime for the base set of tests (including building the cache) from 263s to 195s (a 25% speedup). Note that the time reported by test_runner does not include time spent building the cache:
with TestNode:
0→ date +"%T" ; ./test_runner.py -q ; date +"%T"
112:48:04
2..................................................................................................................................................................................................................................................................................................................................
3TEST | STATUS | DURATION
4
5abandonconflict.py | ✓ Passed | 12 s
6bip68-112-113-p2p.py | ✓ Passed | 19 s
7blockchain.py | ✓ Passed | 8 s
8bumpfee.py | ✓ Passed | 13 s
9decodescript.py | ✓ Passed | 3 s
10disablewallet.py | ✓ Passed | 3 s
11disconnect_ban.py | ✓ Passed | 6 s
12fundrawtransaction.py | ✓ Passed | 37 s
13getchaintips.py | ✓ Passed | 4 s
14httpbasics.py | ✓ Passed | 3 s
15import-rescan.py | ✓ Passed | 4 s
16importmulti.py | ✓ Passed | 6 s
17importprunedfunds.py | ✓ Passed | 3 s
18invalidblockrequest.py | ✓ Passed | 4 s
19invalidtxrequest.py | ✓ Passed | 4 s
20keypool.py | ✓ Passed | 7 s
21listsinceblock.py | ✓ Passed | 4 s
22listtransactions.py | ✓ Passed | 33 s
23mempool_limit.py | ✓ Passed | 4 s
24mempool_persist.py | ✓ Passed | 15 s
25mempool_reorg.py | ✓ Passed | 4 s
26mempool_resurrect_test.py | ✓ Passed | 3 s
27mempool_spendcoinbase.py | ✓ Passed | 3 s
28merkle_blocks.py | ✓ Passed | 3 s
29multi_rpc.py | ✓ Passed | 4 s
30net.py | ✓ Passed | 3 s
31nulldummy.py | ✓ Passed | 3 s
32p2p-compactblocks.py | ✓ Passed | 28 s
33p2p-fullblocktest.py | ✓ Passed | 126 s
34p2p-leaktests.py | ✓ Passed | 8 s
35p2p-mempool.py | ✓ Passed | 3 s
36p2p-segwit.py | ✓ Passed | 59 s
37p2p-versionbits-warning.py | ✓ Passed | 8 s
38preciousblock.py | ✓ Passed | 3 s
39prioritise_transaction.py | ✓ Passed | 5 s
40proxy_test.py | ✓ Passed | 3 s
41rawtransactions.py | ✓ Passed | 9 s
42receivedby.py | ✓ Passed | 19 s
43reindex.py | ✓ Passed | 12 s
44rest.py | ✓ Passed | 9 s
45rpcnamedargs.py | ✓ Passed | 3 s
46segwit.py | ✓ Passed | 7 s
47sendheaders.py | ✓ Passed | 24 s
48signmessages.py | ✓ Passed | 3 s
49signrawtransactions.py | ✓ Passed | 3 s
50txn_clone.py | ✓ Passed | 4 s
51txn_doublespend.py --mineblock | ✓ Passed | 4 s
52uptime.py | ✓ Passed | 3 s
53wallet-accounts.py | ✓ Passed | 3 s
54wallet-dump.py | ✓ Passed | 7 s
55wallet-encryption.py | ✓ Passed | 8 s
56wallet-hd.py | ✓ Passed | 15 s
57wallet.py | ✓ Passed | 31 s
58walletbackup.py | ✓ Passed | 104 s
59zapwallettxes.py | ✓ Passed | 9 s
60zmq_test.py | ○ Skipped | 0 s
61
62ALL | ✓ Passed | 735 s (accumulated)
63Runtime: 189 s
64
6512:51:19
master:
0→ date +"%T" ; ./test_runner.py -q ; date +"%T"
112:40:13
2..........................................................................................................................................................................................................................................................................................................................................................................................................................................
3TEST | STATUS | DURATION
4
5abandonconflict.py | ✓ Passed | 15 s
6bip68-112-113-p2p.py | ✓ Passed | 19 s
7blockchain.py | ✓ Passed | 8 s
8bumpfee.py | ✓ Passed | 20 s
9decodescript.py | ✓ Passed | 3 s
10disablewallet.py | ✓ Passed | 3 s
11disconnect_ban.py | ✓ Passed | 8 s
12fundrawtransaction.py | ✓ Passed | 36 s
13getchaintips.py | ✓ Passed | 11 s
14httpbasics.py | ✓ Passed | 7 s
15import-rescan.py | ✓ Passed | 16 s
16importmulti.py | ✓ Passed | 10 s
17importprunedfunds.py | ✓ Passed | 5 s
18invalidblockrequest.py | ✓ Passed | 4 s
19invalidtxrequest.py | ✓ Passed | 3 s
20keypool.py | ✓ Passed | 7 s
21listsinceblock.py | ✓ Passed | 11 s
22listtransactions.py | ✓ Passed | 37 s
23mempool_limit.py | ✓ Passed | 4 s
24mempool_persist.py | ✓ Passed | 23 s
25mempool_reorg.py | ✓ Passed | 7 s
26mempool_resurrect_test.py | ✓ Passed | 3 s
27mempool_spendcoinbase.py | ✓ Passed | 3 s
28merkle_blocks.py | ✓ Passed | 10 s
29multi_rpc.py | ✓ Passed | 6 s
30net.py | ✓ Passed | 6 s
31nulldummy.py | ✓ Passed | 3 s
32p2p-compactblocks.py | ✓ Passed | 30 s
33p2p-fullblocktest.py | ✓ Passed | 126 s
34p2p-leaktests.py | ✓ Passed | 8 s
35p2p-mempool.py | ✓ Passed | 3 s
36p2p-segwit.py | ✓ Passed | 62 s
37p2p-versionbits-warning.py | ✓ Passed | 8 s
38preciousblock.py | ✓ Passed | 8 s
39prioritise_transaction.py | ✓ Passed | 7 s
40proxy_test.py | ✓ Passed | 10 s
41rawtransactions.py | ✓ Passed | 15 s
42receivedby.py | ✓ Passed | 28 s
43reindex.py | ✓ Passed | 12 s
44rest.py | ✓ Passed | 12 s
45rpcnamedargs.py | ✓ Passed | 3 s
46segwit.py | ✓ Passed | 12 s
47sendheaders.py | ✓ Passed | 26 s
48signmessages.py | ✓ Passed | 3 s
49signrawtransactions.py | ✓ Passed | 3 s
50txn_clone.py | ✓ Passed | 10 s
51txn_doublespend.py --mineblock | ✓ Passed | 10 s
52uptime.py | ✓ Passed | 3 s
53wallet-accounts.py | ✓ Passed | 3 s
54wallet-dump.py | ✓ Passed | 6 s
55wallet-encryption.py | ✓ Passed | 8 s
56wallet-hd.py | ✓ Passed | 18 s
57wallet.py | ✓ Passed | 69 s
58walletbackup.py | ✓ Passed | 130 s
59zapwallettxes.py | ✓ Passed | 15 s
60zmq_test.py | ○ Skipped | 0 s
61
62ALL | ✓ Passed | 936 s (accumulated)
63Runtime: 242 s
64
6512:44:36