Browse Source

`test.py`: start Bitcoin daemon only when required

The MMGen Project 2 years ago
parent
commit
d44f05ff57
5 changed files with 8 additions and 3 deletions
  1. 3 3
      test/test.py
  2. 1 0
      test/test_py_d/ts_base.py
  3. 1 0
      test/test_py_d/ts_main.py
  4. 2 0
      test/test_py_d/ts_misc.py
  5. 1 0
      test/test_py_d/ts_ref.py

+ 3 - 3
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')

+ 1 - 0
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

+ 1 - 0
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]])),

+ 2 - 0
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]])),

+ 1 - 0
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',