From d44f05ff576f7319d2074c65e1d9cedca4ec6e87 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 4 Aug 2022 13:44:31 +0000 Subject: [PATCH] `test.py`: start Bitcoin daemon only when required --- test/test.py | 6 +++--- test/test_py_d/ts_base.py | 1 + test/test_py_d/ts_main.py | 1 + test/test_py_d/ts_misc.py | 2 ++ test/test_py_d/ts_ref.py | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/test.py b/test/test.py index e87e56e0..6c240d0b 100755 --- a/test/test.py +++ b/test/test.py @@ -657,7 +657,7 @@ class TestSuiteRunner(object): if not quiet: bmsg('Executing ' + m) - if not self.daemon_started and network_id not in ('eth','etc','xmr'): + if (not self.daemon_started) and self.gm.get_cls_by_gname(gname).need_daemon: start_test_daemons(network_id,remove_datadir=True) self.daemon_started = True @@ -943,10 +943,10 @@ try: tr = TestSuiteRunner(data_dir,trash_dir) tr.run_tests(usr_args) tr.warn_skipped() - if network_id not in ('eth','etc','xmr'): + if tr.daemon_started: stop_test_daemons(network_id) except KeyboardInterrupt: - if network_id not in ('eth','etc','xmr'): + if tr.daemon_started: stop_test_daemons(network_id) tr.warn_skipped() die(1,'\ntest.py exiting at user request') diff --git a/test/test_py_d/ts_base.py b/test/test_py_d/ts_base.py index 2ec9ae3d..e334a83d 100755 --- a/test/test_py_d/ts_base.py +++ b/test/test_py_d/ts_base.py @@ -34,6 +34,7 @@ class TestSuiteBase(object): networks = () segwit_opts_ok = False color = False + need_daemon = False def __init__(self,trunner,cfgs,spawn): from mmgen.protocol import init_proto_from_opts diff --git a/test/test_py_d/ts_main.py b/test/test_py_d/ts_main.py index 4a2ff920..3cf69f30 100755 --- a/test/test_py_d/ts_main.py +++ b/test/test_py_d/ts_main.py @@ -72,6 +72,7 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared): passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet') segwit_opts_ok = True color = True + need_daemon = True cmd_group = ( ('walletgen_dfl_wallet', (15,'wallet generation (default wallet)',[[[],15]])), ('subwalletgen_dfl_wallet', (15,'subwallet generation (default wallet)',[[[pwfile],15]])), diff --git a/test/test_py_d/ts_misc.py b/test/test_py_d/ts_misc.py index 94b3c5b4..ce632522 100755 --- a/test/test_py_d/ts_misc.py +++ b/test/test_py_d/ts_misc.py @@ -34,6 +34,7 @@ class TestSuiteMisc(TestSuiteBase): cmd_group = ( ('rpc_backends', 'RPC backends'), ) + need_daemon = True def rpc_backends(self): backends = g.autoset_opts['rpc_backend'][1] @@ -173,6 +174,7 @@ class TestSuiteRefTX(TestSuiteMain,TestSuiteBase): segwit_opts_ok = False passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet') tmpdir_nums = [31,32,33,34] + need_daemon = True cmd_group = ( ('ref_tx_addrgen1', (31,'address generation (legacy)', [[[],1]])), ('ref_tx_addrgen2', (32,'address generation (compressed)', [[[],1]])), diff --git a/test/test_py_d/ts_ref.py b/test/test_py_d/ts_ref.py index 193ac858..9fca5f99 100755 --- a/test/test_py_d/ts_ref.py +++ b/test/test_py_d/ts_ref.py @@ -37,6 +37,7 @@ class TestSuiteRef(TestSuiteBase,TestSuiteShared): tmpdir_nums = [8] networks = ('btc','btc_tn','ltc','ltc_tn') passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet') + need_daemon = True sources = { 'ref_addrfile': '98831F3A{}[1,31-33,500-501,1010-1011]{}.addrs', 'ref_segwitaddrfile':'98831F3A{}-S[1,31-33,500-501,1010-1011]{}.addrs',