Browse Source

minor cleanups and changes

The MMGen Project 3 years ago
parent
commit
d8c564537f
3 changed files with 17 additions and 38 deletions
  1. 1 1
      mmgen/daemon.py
  2. 15 36
      test/test.py
  3. 1 1
      test/test_py_d/ts_xmrwallet.py

+ 1 - 1
mmgen/daemon.py

@@ -696,7 +696,7 @@ class parity_daemon(openethereum_daemon):
 	exec_fn = 'parity'
 
 class geth_daemon(ethereum_daemon):
-	daemon_data = _dd('Geth', 1010007, '1.10.7')
+	daemon_data = _dd('Geth', 1010009, '1.10.9')
 	version_pat = r'Geth/v(\d+)\.(\d+)\.(\d+)'
 	exec_fn = 'geth'
 	use_pidfile = False

+ 15 - 36
test/test.py

@@ -148,26 +148,6 @@ if not ('resume' in _uopts or 'skip_deps' in _uopts):
 	try: os.unlink(data_dir)
 	except: pass
 
-def add_cmdline_opts():
-	"""
-	These are set automatically now when g.test_suite == True:
-	  --data-dir in opts.init()
-	  --daemon-data-dir and --rpc-port by CoinDaemon()
-	"""
-	def get_coin():
-		return (_uopts.get('coin') or 'btc').lower()
-
-	network_id = get_coin().lower() + ('_tn' if _uopts.get('testnet') else '')
-
-	sys.argv.insert(1,'--data-dir=' + data_dir)
-	sys.argv.insert(1,'--daemon-data-dir=test/daemons/' + get_coin())
-	from mmgen.daemon import CoinDaemon
-	sys.argv.insert(1,'--rpc-port={}'.format(
-		CoinDaemon(network_id,test_suite=True).rpc_port
-	))
-
-# add_cmdline_opts()
-
 opts.UserOpts._reset_ok += ('skip_deps','no_daemon_autostart','names','no_timings')
 
 # step 2: opts.init will create new data_dir in ./test (if not 'resume' or 'skip_deps'):
@@ -656,8 +636,11 @@ class TestSuiteRunner(object):
 			self.log_fd = None
 
 		if opt.coverage:
-			self.coverdir,self.accfile = init_coverage()
-			omsg(f'INFO → Writing coverage files to {self.coverdir!r}')
+			coverdir,accfile = init_coverage()
+			omsg(f'INFO → Writing coverage files to {coverdir!r}')
+			self.pre_args = ['python3','-m','trace','--count','--coverdir='+coverdir,'--file='+accfile]
+		else:
+			self.pre_args = ['python3'] if g.platform == 'win' else []
 
 		if opt.pexpect_spawn:
 			omsg(f'INFO → Using pexpect.spawn() for real terminal emulation')
@@ -675,18 +658,17 @@ class TestSuiteRunner(object):
 		if extra_desc:
 			desc += ' ' + extra_desc
 
-		if not opt.system:
-			cmd = os.path.relpath(os.path.join(repo_root,cmd_dir,cmd))
-		elif g.platform == 'win':
-			cmd = os.path.join('/mingw64','opt','bin',cmd)
-
-		args = [cmd] + self.passthru_opts + self.ts.extra_spawn_args + args
+		cmd_path = (
+			cmd if opt.system # opt.system is broken for main test group with overlay tree
+			else os.path.relpath(os.path.join(repo_root,cmd_dir,cmd)) )
 
-		if not no_exec_wrapper:
-			args = ['scripts/exec_wrapper.py'] + args
-
-		if g.platform == 'win':
-			args = ['python3'] + args
+		args = (
+			self.pre_args +
+			([] if no_exec_wrapper else ['scripts/exec_wrapper.py']) +
+			[cmd_path] +
+			self.passthru_opts +
+			self.ts.extra_spawn_args +
+			args )
 
 		for i in args:
 			if not isinstance(i,str):
@@ -694,9 +676,6 @@ class TestSuiteRunner(object):
 					self.ts.test_name,
 					args ))
 
-		if opt.coverage:
-			args = ['python3','-m','trace','--count','--coverdir='+self.coverdir,'--file='+self.accfile] + args
-
 		qargs = ['{q}{}{q}'.format( a, q = "'" if ' ' in a else '' ) for a in args]
 		cmd_disp = ' '.join(qargs).replace('\\','/') # for mingw
 

+ 1 - 1
test/test_py_d/ts_xmrwallet.py

@@ -158,7 +158,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 					3. Exit the test here, start the SSH SOCKS proxy manually by entering the
 					   following command, and restart the test:
 
-							 {' '.join(a+b2)}
+					      {' '.join(a+b2)}
 				""",indent='    ',strip_char='\t'))
 
 				if keypress_confirm('Continue?'):