test rename: test.py -> cmdtest.py

This commit is contained in:
The MMGen Project 2023-10-13 09:51:14 +00:00
commit 60ce46c768
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
32 changed files with 235 additions and 235 deletions

View file

@ -489,7 +489,7 @@ class Config(Lockable):
check_or_create_dir(self.data_dir)
if self.debug and gc.prog_name != 'test.py':
if self.debug and gc.prog_name != 'cmdtest.py':
self.verbose = True
self.quiet = False

View file

@ -78,8 +78,8 @@ def exec_wrapper_write_traceback(e,exit_val):
sys.stdout.write('{}\n{}\n'.format( c.yellow( '\n'.join(tb_lines) ), c.red(exc_line) ))
from test.include.common import test_py_error_fn
with open(test_py_error_fn,'w') as fp:
from test.include.common import cmdtest_py_error_fn
with open(cmdtest_py_error_fn,'w') as fp:
fp.write('\n'.join(tb_lines + [exc_line]))
print(c.blue('{} script exited with error').format(

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test/test.py: Test suite for the MMGen wallet system
test/cmdtest.py: Command test runner for the MMGen wallet system
"""
def check_segwit_opts():
@ -97,8 +97,8 @@ from mmgen.util import Msg,bmsg,die,suf,make_timestr,async_run
from test.include.common import (
set_globals,
test_py_log_fn,
test_py_error_fn,
cmdtest_py_log_fn,
cmdtest_py_error_fn,
mk_tmpdir,
cleandir,
iqmsg,
@ -111,7 +111,7 @@ from test.include.common import (
)
try:
os.unlink(os.path.join(repo_root,test_py_error_fn))
os.unlink(os.path.join(repo_root,cmdtest_py_error_fn))
except:
pass
@ -182,7 +182,7 @@ environment var
},
'code': {
'options': lambda proto,help_notes,s: s.format(
lf = test_py_log_fn
lf = cmdtest_py_log_fn
)
}
}
@ -204,7 +204,7 @@ cfg = Config(opts_data=opts_data)
set_globals(cfg)
from test.test_py_d.common import ( # this must be loaded after set_globals()
from test.cmdtest_py_d.common import ( # this must be loaded after set_globals()
get_file_with_ext,
confirm_continue
)
@ -226,7 +226,7 @@ if cfg.pexpect_spawn and sys.platform == 'win32':
die(1,'--pexpect-spawn option not supported on Windows platform, exiting')
if cfg.daemon_id and cfg.daemon_id in cfg.blacklisted_daemons.split():
die(1,f'test.py: daemon {cfg.daemon_id!r} blacklisted, exiting')
die(1,f'cmdtest.py: daemon {cfg.daemon_id!r} blacklisted, exiting')
network_id = cfg.coin.lower() + ('_tn' if cfg.testnet else '')
@ -260,7 +260,7 @@ else:
if cfg.skipping_deps:
cfg.no_daemon_autostart = True
from test.test_py_d.cfg import cfgs,fixup_cfgs
from test.cmdtest_py_d.cfg import cfgs,fixup_cfgs
for k in cfgs:
cfgs[k]['tmpdir'] = os.path.join('test','tmp',str(k))
@ -282,8 +282,8 @@ def list_cmds():
yield green('AVAILABLE COMMANDS:')
for gname in gm.cmd_groups:
ts = gm.gm_init_group(None,gname,None,None)
desc = ts.__doc__.strip() if ts.__doc__ else type(ts).__name__
tg = gm.gm_init_group(None,gname,None,None)
desc = tg.__doc__.strip() if tg.__doc__ else type(tg).__name__
d.append( (gname,desc,gm.cmd_list,gm.dpy_data) )
cw = max(max(len(k) for k in gm.dpy_data),cw)
@ -371,7 +371,7 @@ class CmdGroupMgr:
dpy_data = None
from test.test_py_d.cfg import cmd_groups_dfl,cmd_groups_extra
from test.cmdtest_py_d.cfg import cmd_groups_dfl,cmd_groups_extra
cmd_groups = cmd_groups_dfl.copy()
cmd_groups.update(cmd_groups_extra)
@ -422,7 +422,7 @@ class CmdGroupMgr:
if modname is None and 'modname' in kwargs:
modname = kwargs['modname']
import importlib
modpath = f'test.test_py_d.ts_{modname or gname}'
modpath = f'test.cmdtest_py_d.ct_{modname or gname}'
return getattr(importlib.import_module(modpath),clsname)
def create_group(self,gname,sg_name,full_data=False,modname=None,is3seed=False,add_dpy=False):
@ -540,8 +540,8 @@ class CmdGroupMgr:
return None
class TestSuiteRunner:
'test suite runner'
class CmdTestRunner:
'cmdtest.py test runner'
def __del__(self):
if cfg.log:
@ -560,9 +560,9 @@ class TestSuiteRunner:
self.deps_only = None
if cfg.log:
self.log_fd = open(test_py_log_fn,'a')
self.log_fd = open(cmdtest_py_log_fn,'a')
self.log_fd.write(f'\nLog started: {make_timestr()} UTC\n')
omsg(f'INFO → Logging to file {test_py_log_fn!r}')
omsg(f'INFO → Logging to file {cmdtest_py_log_fn!r}')
else:
self.log_fd = None
@ -586,7 +586,7 @@ class TestSuiteRunner:
'MMGEN_BOGUS_SEND': '1',
'MMGEN_TEST_SUITE_PEXPECT': '1',
'EXEC_WRAPPER_SPAWN':'1',
# if test.py itself is running under exec_wrapper, disable writing of traceback file for spawned script
# if cmdtest.py itself is running under exec_wrapper, disable writing of traceback file for spawned script
'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_EXEC_WRAPPER') else '1',
})
@ -611,7 +611,7 @@ class TestSuiteRunner:
direct_exec = False,
env = {}):
desc = self.ts.test_name if cfg.names else self.gm.dpy_data[self.ts.test_name][1]
desc = self.tg.test_name if cfg.names else self.gm.dpy_data[self.tg.test_name][1]
if extra_desc:
desc += ' ' + extra_desc
@ -624,7 +624,7 @@ class TestSuiteRunner:
([] if no_exec_wrapper else ['scripts/exec_wrapper.py']) +
[cmd_path] +
self.passthru_opts +
self.ts.extra_spawn_args +
self.tg.extra_spawn_args +
args )
qargs = ['{q}{}{q}'.format( a, q = "'" if ' ' in a else '' ) for a in args]
@ -633,14 +633,14 @@ class TestSuiteRunner:
if cfg.log:
self.log_fd.write('[{}][{}:{}] {}\n'.format(
proto.coin.lower(),
self.ts.group_name,
self.ts.test_name,
self.tg.group_name,
self.tg.test_name,
cmd_disp))
for i in args: # die only after writing log entry
if not isinstance(i,str):
die(2,'Error: missing input files in cmd line?:\nName: {}\nCmdline: {!r}'.format(
self.ts.test_name,
self.tg.test_name,
args ))
if not no_msg:
@ -668,7 +668,7 @@ class TestSuiteRunner:
send_delay = 0.4 if pexpect_spawn is True or cfg.buf_keypress else None
pexpect_spawn = pexpect_spawn if pexpect_spawn is not None else bool(cfg.pexpect_spawn)
spawn_env = dict(self.ts.spawn_env)
spawn_env = dict(self.tg.spawn_env)
spawn_env.update({
'MMGEN_HOLD_PROTECT_DISABLE': '' if send_delay else '1',
'MMGEN_TEST_SUITE_POPEN_SPAWN': '' if pexpect_spawn else '1',
@ -694,9 +694,9 @@ class TestSuiteRunner:
def init_group(self,gname,sg_name=None,cmd=None,quiet=False,do_clean=True):
ts_cls = CmdGroupMgr().load_mod(gname)
ct_cls = CmdGroupMgr().load_mod(gname)
if sys.platform == 'win32' and ts_cls.win_skip:
if sys.platform == 'win32' and ct_cls.win_skip:
omsg(f'Skipping test {gname!r} for Windows platform')
return False
@ -709,19 +709,19 @@ class TestSuiteRunner:
def gen_msg():
yield ('{g}:{c}' if cmd else 'test group {g!r}').format(g=gname,c=cmd)
if len(ts_cls.networks) != 1:
if len(ct_cls.networks) != 1:
yield f' for {proto.coin} {proto.network}'
if segwit_opt:
yield ' (--{})'.format( segwit_opt.replace('_','-') )
m = ''.join(gen_msg())
if segwit_opt and not ts_cls.segwit_opts_ok:
if segwit_opt and not ct_cls.segwit_opts_ok:
iqmsg('INFO → skipping ' + m)
return False
# 'networks = ()' means all networks allowed
nws = [(e.split('_')[0],'testnet') if '_' in e else (e,'mainnet') for e in ts_cls.networks]
nws = [(e.split('_')[0],'testnet') if '_' in e else (e,'mainnet') for e in ct_cls.networks]
if nws:
coin = proto.coin.lower()
nw = ('mainnet','testnet')[proto.testnet]
@ -733,7 +733,7 @@ class TestSuiteRunner:
return False
if do_clean:
clean(ts_cls.tmpdir_nums,clean_overlay=False)
clean(ct_cls.tmpdir_nums,clean_overlay=False)
if not quiet:
bmsg('Executing ' + m)
@ -742,14 +742,14 @@ class TestSuiteRunner:
start_test_daemons(network_id,remove_datadir=True)
self.daemon_started = True
self.ts = self.gm.gm_init_group(self,gname,sg_name,self.spawn_wrapper)
self.ts_clsname = type(self.ts).__name__
self.tg = self.gm.gm_init_group(self,gname,sg_name,self.spawn_wrapper)
self.ct_clsname = type(self.tg).__name__
# pass through opts from cmdline (po.user_opts)
self.passthru_opts = ['--{}{}'.format(
k.replace('_','-'),
'' if cfg._uopts[k] is True else '=' + cfg._uopts[k]
) for k in cfg._uopts if k in self.ts.base_passthru_opts + self.ts.passthru_opts]
) for k in cfg._uopts if k in self.tg.base_passthru_opts + self.tg.passthru_opts]
if cfg.resuming:
rc = cfg.resume or cfg.resume_after
@ -800,7 +800,7 @@ class TestSuiteRunner:
self.check_needs_rerun(cmdname,build=True)
except Exception as e: # allow calling of functions not in cmd_group
if isinstance(e,KeyError) and e.args[0] == cmdname:
ret = getattr(self.ts,cmdname)()
ret = getattr(self.tg,cmdname)()
if type(ret).__name__ == 'coroutine':
async_run(ret)
else:
@ -838,9 +838,9 @@ class TestSuiteRunner:
force_delete = False,
dpy = False):
self.ts.test_name = cmd
self.tg.test_name = cmd
if self.ts_clsname == 'TestSuiteMain' and testing_segwit and cmd not in self.ts.segwit_do:
if self.ct_clsname == 'CmdTestMain' and testing_segwit and cmd not in self.tg.segwit_do:
return False
rerun = root # force_delete is not passed to recursive call
@ -899,8 +899,8 @@ class TestSuiteRunner:
arg_list = [get_file_with_ext(cfgs[num]['tmpdir'],ext) for num,ext in d]
# remove shared_deps from arg list
if hasattr(self.ts,'shared_deps'):
arg_list = arg_list[:-len(self.ts.shared_deps)]
if hasattr(self.tg,'shared_deps'):
arg_list = arg_list[:-len(self.tg.shared_deps)]
if self.resume_cmd:
if cmd != self.resume_cmd:
@ -913,11 +913,11 @@ class TestSuiteRunner:
if cfg.profile:
start = time.time()
self.ts.test_name = cmd # NB: Do not remove, this needs to be set twice
self.tg.test_name = cmd # NB: Do not remove, this needs to be set twice
cdata = self.gm.dpy_data[cmd]
# self.ts.test_dpydata = cdata
self.ts.tmpdir_num = cdata[0]
# self.ts.cfg = cfgs[str(cdata[0])] # will remove this eventually
# self.tg.test_dpydata = cdata
self.tg.tmpdir_num = cdata[0]
# self.tg.cfg = cfgs[str(cdata[0])] # will remove this eventually
test_cfg = cfgs[str(cdata[0])]
for k in ( 'seed_len', 'seed_id',
'wpasswd', 'kapasswd',
@ -925,9 +925,9 @@ class TestSuiteRunner:
'bw_filename', 'bw_params', 'ref_bw_seed_id',
'addr_idx_list', 'pass_idx_list' ):
if k in test_cfg:
setattr(self.ts,k,test_cfg[k])
setattr(self.tg,k,test_cfg[k])
ret = getattr(self.ts,cmd)(*arg_list) # run the test
ret = getattr(self.tg,cmd)(*arg_list) # run the test
if type(ret).__name__ == 'coroutine':
ret = async_run(ret)
self.process_retval(cmd,ret)
@ -952,7 +952,7 @@ class TestSuiteRunner:
ok()
self.cmd_total += 1
elif ret == 'error':
die(2,red(f'\nTest {self.ts.test_name!r} failed'))
die(2,red(f'\nTest {self.tg.test_name!r} failed'))
elif ret in ('skip','silent'):
if ret == 'silent':
self.cmd_total += 1
@ -974,7 +974,7 @@ class TestSuiteRunner:
if not cfg.quiet:
omsg(f'Checking dependencies for {cmd!r}')
self.check_needs_rerun(self.ts,cmd)
self.check_needs_rerun(self.tg,cmd)
w = max(map(len,self.rebuild_list)) + 1
for cmd in self.rebuild_list:
@ -1029,7 +1029,7 @@ if cfg.pause:
from mmgen.exception import TestSuiteException,TestSuiteFatalException,TestSuiteSpawnedScriptException
try:
tr = TestSuiteRunner(data_dir,trash_dir)
tr = CmdTestRunner(data_dir,trash_dir)
tr.run_tests(cmd_args)
tr.warn_skipped()
if tr.daemon_started:
@ -1047,9 +1047,9 @@ except TestSuiteSpawnedScriptException as e:
# if spawned script is not running under exec_wrapper, output brief error msg:
if os.getenv('MMGEN_EXEC_WRAPPER'):
Msg(red(str(e)))
Msg(blue('test.py: spawned script exited with error'))
Msg(blue('cmdtest.py: spawned script exited with error'))
except Exception:
# if test.py itself is running under exec_wrapper, re-raise so exec_wrapper can handle exception:
# if cmdtest.py itself is running under exec_wrapper, re-raise so exec_wrapper can handle exception:
if os.getenv('MMGEN_EXEC_WRAPPER') or not os.getenv('MMGEN_IGNORE_TEST_PY_EXCEPTION'):
raise
die(1,red('Test script exited with error'))

View file

@ -9,7 +9,7 @@
# https://gitlab.com/mmgen/mmgen
"""
test.test_py_d.cfg: configuration data for test.py
test.cmdtest_py_d.cfg: configuration data for cmdtest.py
"""
import os
@ -18,33 +18,33 @@ from .common import pwfile,hincog_fn,incog_id_fn,randbool
from ..include.common import cfg
cmd_groups_dfl = {
'misc': ('TestSuiteMisc',{}),
'opts': ('TestSuiteOpts',{'full_data':True}),
'cfgfile': ('TestSuiteCfgFile',{'full_data':True}),
'helpscreens': ('TestSuiteHelp',{'modname':'misc','full_data':True}),
'main': ('TestSuiteMain',{'full_data':True}),
'conv': ('TestSuiteWalletConv',{'is3seed':True,'modname':'wallet'}),
'ref': ('TestSuiteRef',{}),
'ref3': ('TestSuiteRef3Seed',{'is3seed':True,'modname':'ref_3seed'}),
'ref3_addr': ('TestSuiteRef3Addr',{'is3seed':True,'modname':'ref_3seed'}),
'ref_altcoin': ('TestSuiteRefAltcoin',{}),
'seedsplit': ('TestSuiteSeedSplit',{}),
'tool': ('TestSuiteTool',{'full_data':True}),
'input': ('TestSuiteInput',{}),
'output': ('TestSuiteOutput',{'modname':'misc','full_data':True}),
'autosign': ('TestSuiteAutosign',{}),
'regtest': ('TestSuiteRegtest',{}),
# 'chainsplit': ('TestSuiteChainsplit',{}),
'ethdev': ('TestSuiteEthdev',{}),
'xmrwallet': ('TestSuiteXMRWallet',{}),
'xmr_autosign': ('TestSuiteXMRAutosign',{}),
'misc': ('CmdTestMisc',{}),
'opts': ('CmdTestOpts',{'full_data':True}),
'cfgfile': ('CmdTestCfgFile',{'full_data':True}),
'helpscreens': ('CmdTestHelp',{'modname':'misc','full_data':True}),
'main': ('CmdTestMain',{'full_data':True}),
'conv': ('CmdTestWalletConv',{'is3seed':True,'modname':'wallet'}),
'ref': ('CmdTestRef',{}),
'ref3': ('CmdTestRef3Seed',{'is3seed':True,'modname':'ref_3seed'}),
'ref3_addr': ('CmdTestRef3Addr',{'is3seed':True,'modname':'ref_3seed'}),
'ref_altcoin': ('CmdTestRefAltcoin',{}),
'seedsplit': ('CmdTestSeedSplit',{}),
'tool': ('CmdTestTool',{'full_data':True}),
'input': ('CmdTestInput',{}),
'output': ('CmdTestOutput',{'modname':'misc','full_data':True}),
'autosign': ('CmdTestAutosign',{}),
'regtest': ('CmdTestRegtest',{}),
# 'chainsplit': ('CmdTestChainsplit',{}),
'ethdev': ('CmdTestEthdev',{}),
'xmrwallet': ('CmdTestXMRWallet',{}),
'xmr_autosign': ('CmdTestXMRAutosign',{}),
}
cmd_groups_extra = {
'autosign_btc': ('TestSuiteAutosignBTC',{'modname':'autosign'}),
'autosign_live': ('TestSuiteAutosignLive',{'modname':'autosign'}),
'autosign_live_simulate': ('TestSuiteAutosignLiveSimulate',{'modname':'autosign'}),
'create_ref_tx': ('TestSuiteRefTX',{'modname':'misc','full_data':True}),
'autosign_btc': ('CmdTestAutosignBTC',{'modname':'autosign'}),
'autosign_live': ('CmdTestAutosignLive',{'modname':'autosign'}),
'autosign_live_simulate': ('CmdTestAutosignLiveSimulate',{'modname':'autosign'}),
'create_ref_tx': ('CmdTestRefTX',{'modname':'misc','full_data':True}),
}
cfgs = { # addr_idx_lists (except 31,32,33,34) must contain exactly 8 addresses

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.common: Shared routines and data for the test.py test suite
test.cmdtest_py_d.common: Shared routines and data for the cmdtest.py test suite
"""
import sys,os

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_autosign: Autosign tests for the test.py test suite
test.cmdtest_py_d.ct_autosign: Autosign tests for the cmdtest.py test suite
"""
import sys,os,shutil
@ -41,7 +41,7 @@ from ..include.common import (
)
from .common import ref_dir,dfl_words_file,dfl_bip39_file
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
from .input import stealth_mnemonic_entry
filedir_map = (
@ -88,7 +88,7 @@ def do_umount(mountpoint):
except:
pass
class TestSuiteAutosignBase(TestSuiteBase):
class CmdTestAutosignBase(CmdTestBase):
networks = ('btc',)
tmpdir_nums = [18]
color = True
@ -117,7 +117,7 @@ class TestSuiteAutosignBase(TestSuiteBase):
),
'wallet_dir': None if self.live else self.wallet_dir,
'test_suite': True,
'test_suite_xmr_autosign': self.name == 'TestSuiteXMRAutosign',
'test_suite_xmr_autosign': self.name == 'CmdTestXMRAutosign',
})
)
self.mountpoint = self.asi.mountpoint
@ -246,9 +246,9 @@ class TestSuiteAutosignBase(TestSuiteBase):
fdata = [e for e in filedir_map if e[0] in (txfile_coins or self.txfile_coins)]
from .ts_ref import TestSuiteRef
tfns = [TestSuiteRef.sources['ref_tx_file'][c][1] for c,d in fdata] + \
[TestSuiteRef.sources['ref_tx_file'][c][0] for c,d in fdata] + \
from .ct_ref import CmdTestRef
tfns = [CmdTestRef.sources['ref_tx_file'][c][1] for c,d in fdata] + \
[CmdTestRef.sources['ref_tx_file'][c][0] for c,d in fdata] + \
['25EFA3[2.34].testnet.rawtx'] # TX with 2 non-MMGen outputs
self.tx_count = len([fn for fn in tfns if fn])
if op == 'set_count':
@ -367,7 +367,7 @@ class TestSuiteAutosignBase(TestSuiteBase):
imsg('')
return t
class TestSuiteAutosign(TestSuiteAutosignBase):
class CmdTestAutosign(CmdTestAutosignBase):
'autosigning transactions for all supported coins'
coins = ['btc','bch','ltc','eth']
daemon_coins = ['btc','bch','ltc']
@ -429,13 +429,13 @@ class TestSuiteAutosign(TestSuiteAutosignBase):
self.bad_msg_count = 0
return self.do_sign(['--quiet','wait'],have_msg=True)
class TestSuiteAutosignBTC(TestSuiteAutosign):
class CmdTestAutosignBTC(CmdTestAutosign):
'autosigning BTC transactions'
coins = ['btc']
daemon_coins = ['btc']
txfile_coins = ['btc']
class TestSuiteAutosignLive(TestSuiteAutosignBTC):
class CmdTestAutosignLive(CmdTestAutosignBTC):
'live autosigning BTC transactions'
live = True
cmd_group = (
@ -511,6 +511,6 @@ class TestSuiteAutosignLive(TestSuiteAutosignBTC):
t.expect("Stopping LED")
return t
class TestSuiteAutosignLiveSimulate(TestSuiteAutosignLive):
class CmdTestAutosignLiveSimulate(CmdTestAutosignLive):
'live autosigning BTC transactions with simulated LED support'
simulate = True

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_base: Base class for the test.py test suite
test.cmdtest_py_d.ct_base: Base class for the cmdtest.py test suite
"""
import sys,os
@ -27,8 +27,8 @@ from mmgen.util import msg
from ..include.common import cfg,write_to_file,read_from_file
from .common import get_file_with_ext
class TestSuiteBase:
'initializer class for the test.py test suite'
class CmdTestBase:
'initializer class for the cmdtest.py test suite'
base_passthru_opts = ('data_dir','skip_cfg_file')
passthru_opts = ()
extra_spawn_args = []

View file

@ -7,7 +7,7 @@
# Licensed according to the terms of GPL Version 3. See LICENSE for details.
"""
test.test_py_d.ts_cfgfile: CfgFile tests for the MMGen test.py test suite
test.cmdtest_py_d.ct_cfgfile: CfgFile tests for the MMGen cmdtest.py test suite
"""
import sys,os,time,shutil
@ -16,9 +16,9 @@ from mmgen.color import yellow
from mmgen.cfgfile import CfgFileSampleSys,CfgFileSampleUsr,cfg_file_sample
from ..include.common import cfg,read_from_file,write_to_file,imsg
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
class TestSuiteCfgFile(TestSuiteBase):
class CmdTestCfgFile(CmdTestBase):
'CfgFile API'
networks = ('btc',)
tmpdir_nums = [40]
@ -41,7 +41,7 @@ class TestSuiteCfgFile(TestSuiteBase):
)
def __init__(self,trunner,cfgs,spawn):
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
self.spawn_env['MMGEN_TEST_SUITE_CFGTEST'] = '1'
def spawn_test(self,args=[],extra_desc='',pexpect_spawn=None):

View file

@ -17,17 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_chainsplit: Forking scenario tests for the test.py test suite
test.cmdtest_py_d.ct_chainsplit: Forking scenario tests for the cmdtest.py test suite
This module is unmaintained and currently non-functional
"""
from mmgen.util import die
from .common import get_file_with_ext
from .ts_regtest import TestSuiteRegtest
from .ct_regtest import CmdTestRegtest
class TestSuiteChainsplit(TestSuiteRegtest):
'forking scenario tests for the test.py test suite'
class CmdTestChainsplit(CmdTestRegtest):
'forking scenario tests for the cmdtest.py test suite'
cmd_group = (
('split_setup', 'regtest forking scenario setup'),
('walletgen_bob', "generating Bob's wallet"),

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_ethdev: Ethdev tests for the test.py test suite
test.cmdtest_py_d.ct_ethdev: Ethdev tests for the cmdtest.py test suite
"""
import sys,os,re,shutil,asyncio,json
@ -55,8 +55,8 @@ from .common import (
ok_msg,
Ctrl_U
)
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
del_addrs = ('4','1')
dfl_sid = '98831F3A'
@ -144,7 +144,7 @@ token_bals_getbalance = {
coin = cfg.coin
class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
class CmdTestEthdev(CmdTestBase,CmdTestShared):
'Ethereum transacting, token deployment and tracking wallet operations'
networks = ('eth','etc')
passthru_opts = ('coin','daemon_id','http_timeout','rpc_backend')
@ -383,7 +383,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
}
def __init__(self,trunner,cfgs,spawn):
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
if trunner is None:
return

View file

@ -7,7 +7,7 @@
# Licensed according to the terms of GPL Version 3. See LICENSE for details.
"""
test.test_py_d.ts_input: user input tests for the MMGen test.py test suite
test.cmdtest_py_d.ct_input: user input tests for the MMGen cmdtest.py test suite
"""
import sys,os
@ -26,10 +26,10 @@ from ..include.common import (
strip_ansi_escapes
)
from .common import Ctrl_U,ref_dir
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
from .input import stealth_mnemonic_entry,user_dieroll_entry
class TestSuiteInput(TestSuiteBase):
class CmdTestInput(CmdTestBase):
'user input'
networks = ('btc',)
tmpdir_nums = [1]

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_main: Basic operations tests for the test.py test suite
test.cmdtest_py_d.ct_main: Basic operations tests for the cmdtest.py test suite
"""
import sys,os
@ -54,8 +54,8 @@ from .common import (
incog_id_fn,
non_mmgen_fn
)
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
def make_brainwallet_file(fn):
# Print random words with random whitespace in between
@ -90,7 +90,7 @@ rwords = """
сувенир сугроб суть сцена театр тираж толк удивить улыбка фирма читатель эстония эстрада юность
"""
class TestSuiteMain(TestSuiteBase,TestSuiteShared):
class CmdTestMain(CmdTestBase,CmdTestShared):
'basic operations with emulated tracking wallet'
tmpdir_nums = [1,2,3,4,5,14,15,16,20,21]
networks = ('btc','btc_tn','ltc','ltc_tn','bch','bch_tn')
@ -306,7 +306,7 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
)
def __init__(self,trunner,cfgs,spawn):
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
if trunner is None or self.proto.coin.lower() not in self.networks:
return
self.rpc = async_run(rpc_init(cfg,self.proto))
@ -870,8 +870,8 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
return t
walletgen14 = walletgen
addrgen14 = TestSuiteShared.addrgen
keyaddrgen14 = TestSuiteShared.keyaddrgen
addrgen14 = CmdTestShared.addrgen
keyaddrgen14 = CmdTestShared.keyaddrgen
def walletgen4(self,del_dw_run='dummy'):
bwf = joinpath(self.tmpdir,self.bw_filename)

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_misc: Miscellaneous test groups for the test.py test suite
test.cmdtest_py_d.ct_misc: Miscellaneous test groups for the cmdtest.py test suite
"""
import sys,os,re,time
@ -26,10 +26,10 @@ from mmgen.util import ymsg
from ..include.common import cfg,start_test_daemons,stop_test_daemons,imsg
from .common import get_file_with_ext
from .ts_base import TestSuiteBase
from .ts_main import TestSuiteMain
from .ct_base import CmdTestBase
from .ct_main import CmdTestMain
class TestSuiteMisc(TestSuiteBase):
class CmdTestMisc(CmdTestBase):
'miscellaneous tests (RPC backends, xmrwallet_txview, term)'
networks = ('btc',)
tmpdir_nums = [99]
@ -117,7 +117,7 @@ class TestSuiteMisc(TestSuiteBase):
return 'skip'
return self.spawn('test/misc/term_ni.py',['cleanup'],cmd_dir='.',pexpect_spawn=True)
class TestSuiteHelp(TestSuiteBase):
class CmdTestHelp(CmdTestBase):
'help, info and usage screens'
networks = ('btc','ltc','bch','eth','xmr')
tmpdir_nums = []
@ -131,7 +131,7 @@ class TestSuiteHelp(TestSuiteBase):
('show_hash_presets', (1,'info screen (--show-hash-presets)',[])),
('tool_help', (1,"'mmgen-tool' usage screen",[])),
('tool_cmd_usage', (1,"'mmgen-tool' usage screen",[])),
('test_help', (1,"'test.py' help screens",[])),
('test_help', (1,"'cmdtest.py' help screens",[])),
('tooltest_help', (1,"'tooltest.py' help screens",[])),
)
@ -251,10 +251,10 @@ class TestSuiteHelp(TestSuiteBase):
('--list-cmd-groups','AVAILABLE COMMAND GROUPS')
):
t = self.spawn_chk_expect(
'test.py',
'cmdtest.py',
[arg],
cmd_dir = 'test',
extra_desc = f'(test.py {arg})',
extra_desc = f'(cmdtest.py {arg})',
expect = expect )
return t
@ -271,7 +271,7 @@ class TestSuiteHelp(TestSuiteBase):
expect = expect )
return t
class TestSuiteOutput(TestSuiteBase):
class CmdTestOutput(CmdTestBase):
'screen output'
networks = ('btc',)
tmpdir_nums = []
@ -327,7 +327,7 @@ class TestSuiteOutput(TestSuiteBase):
return 'skip'
return self.oneshot_warning(pexpect_spawn=True)
class TestSuiteRefTX(TestSuiteMain,TestSuiteBase):
class CmdTestRefTX(CmdTestMain,CmdTestBase):
'create a reference transaction file (administrative command)'
segwit_opts_ok = False
passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet')
@ -348,7 +348,7 @@ class TestSuiteRefTX(TestSuiteMain,TestSuiteBase):
cfgs[str(n)].update({ 'addr_idx_list': '1-2',
'segwit': n in (33,34),
'dep_generators': { 'addrs':'ref_tx_addrgen'+str(n)[-1] }})
TestSuiteMain.__init__(self,trunner,cfgs,spawn)
CmdTestMain.__init__(self,trunner,cfgs,spawn)
def ref_tx_addrgen(self,atype):
if atype not in self.proto.mmtypes:

View file

@ -7,15 +7,15 @@
# Licensed according to the terms of GPL Version 3. See LICENSE for details.
"""
test.test_py_d.ts_opts: options processing tests for the MMGen test.py test suite
test.cmdtest_py_d.ct_opts: options processing tests for the MMGen cmdtest.py test suite
"""
import os,time
from ..include.common import cfg
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
class TestSuiteOpts(TestSuiteBase):
class CmdTestOpts(CmdTestBase):
'options processing'
networks = ('btc',)
tmpdir_nums = [41]

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_ref: Reference file tests for the test.py test suite
test.cmdtest_py_d.ct_ref: Reference file tests for the cmdtest.py test suite
"""
import os
@ -46,12 +46,12 @@ from .common import (
skip
)
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
wpasswd = 'reference password'
class TestSuiteRef(TestSuiteBase,TestSuiteShared):
class CmdTestRef(CmdTestBase,CmdTestShared):
'saved reference address, password and transaction files'
tmpdir_nums = [8]
networks = ('btc','btc_tn','ltc','ltc_tn')
@ -238,7 +238,7 @@ class TestSuiteRef(TestSuiteBase,TestSuiteShared):
pat = pat or f'{self.nw_desc}.*Legacy'
af_key = f'ref_{ftype}file' + ('_' + id_key if id_key else '')
af_fn = TestSuiteRef.sources[af_key].format(pfx or self.altcoin_pfx,'' if coin else self.tn_ext)
af_fn = CmdTestRef.sources[af_key].format(pfx or self.altcoin_pfx,'' if coin else self.tn_ext)
af = joinpath(ref_dir,(subdir or self.ref_subdir,'')[ftype=='passwd'],af_fn)
coin_arg = [] if coin is None else ['--coin='+coin]
tool_cmd = ftype.replace('segwit','').replace('bech32','')+'file_chksum'

View file

@ -17,8 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_ref_3seed: Saved and generated reference file tests for 128,
192 and 256-bit seeds for the test.py test suite
test.cmdtest_py_d.ct_ref_3seed: Saved and generated reference file tests for 128,
192 and 256-bit seeds for the cmdtest.py test suite
"""
import os
@ -35,11 +35,11 @@ from .common import (
ref_dir,
ok_msg
)
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ts_wallet import TestSuiteWalletConv
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
from .ct_wallet import CmdTestWalletConv
class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
class CmdTestRef3Seed(CmdTestBase,CmdTestShared):
'saved wallet files for 128-, 192- and 256-bit seeds + generated filename checks'
networks = ('btc',)
mmtypes = (None,)
@ -65,7 +65,7 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
('ref_mn_chk', ([],'saved native MMGen mnemonic file')),
('ref_bip39_chk', ([],'saved BIP39 mnemonic file')),
('ref_hincog_chk', ([],'saved hidden incog reference wallet')),
('ref_brain_chk', ([],'saved brainwallet')), # in ts_shared
('ref_brain_chk', ([],'saved brainwallet')), # in ct_shared
# generating new reference ('abc' brainwallet) wallets for filename checks:
('ref_walletgen_brain', ([],'generating new reference wallet + filename check (brain)')),
@ -87,10 +87,10 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
for n in self.tmpdir_nums:
cfgs[str(n)]['addr_idx_list'] = self.addr_idx_list_in
cfgs[str(n)]['pass_idx_list'] = self.pass_idx_list_in
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
def ref_wallet_chk(self):
wf = joinpath(ref_dir,TestSuiteWalletConv.sources[str(self.seed_len)]['ref_wallet'])
wf = joinpath(ref_dir,CmdTestWalletConv.sources[str(self.seed_len)]['ref_wallet'])
return self.walletchk(wf,sid=self.seed_id)
def ref_ss_chk(self,ss_type):
@ -119,7 +119,7 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
return self.ref_ss_chk('bip39')
def ref_hincog_chk(self,desc='hidden incognito data'):
source = TestSuiteWalletConv.sources[str(self.seed_len)]
source = CmdTestWalletConv.sources[str(self.seed_len)]
for wtype,edesc,of_arg in (
('hic_wallet', '', []),
('hic_wallet_old','(old format)',['-O']) ):
@ -146,7 +146,7 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
def ref_walletgen_brain(self):
sl_arg = f'-l{self.seed_len}'
hp_arg = f'-p{ref_wallet_hash_preset}'
label = f'test.py ref. wallet (pw {ref_wallet_brainpass!r}, seed len {self.seed_len}) α'
label = f'ref. wallet (pw {ref_wallet_brainpass!r}, seed len {self.seed_len}) α'
bf = 'ref.mmbrain'
args = ['-d',self.tmpdir,hp_arg,sl_arg,'-ibw','-L',label]
self.write_to_tmpfile(bf,ref_wallet_brainpass)
@ -212,7 +212,7 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
def ref_walletconv_hexincog(self):
return self.ref_walletconv_incog(ofmt='incog_hex',ext='mmincox')
class TestSuiteRef3Addr(TestSuiteRef3Seed):
class CmdTestRef3Addr(CmdTestRef3Seed):
'generated reference address, key and password files for 128-, 192- and 256-bit seeds'
networks = ('btc','btc_tn','ltc','ltc_tn')
passthru_opts = ('coin','testnet')

View file

@ -17,17 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_ref_altcoin: Altcoin reference file tests for the test.py test suite
test.cmdtest_py_d.ct_ref_altcoin: Altcoin reference file tests for the cmdtest.py test suite
"""
from mmgen.color import set_vt100
from .common import pwfile,dfl_wpasswd,ref_dir,dfl_words_file,dfl_addr_idx_list
from ..include.common import cfg,joinpath,start_test_daemons,stop_test_daemons,cmp_or_die
from .ts_ref import TestSuiteRef
from .ts_base import TestSuiteBase
from .ct_ref import CmdTestRef
from .ct_base import CmdTestBase
class TestSuiteRefAltcoin(TestSuiteRef,TestSuiteBase):
class CmdTestRefAltcoin(CmdTestRef,CmdTestBase):
'saved and generated altcoin reference files'
tmpdir_nums = [8]
networks = ('btc',)
@ -90,7 +90,7 @@ class TestSuiteRefAltcoin(TestSuiteRef,TestSuiteBase):
self.write_to_tmpfile(pwfile,dfl_wpasswd)
passfile = joinpath(self.tmpdir,pwfile)
from mmgen.tx.file import MMGenTxFile
src = TestSuiteRef.sources['ref_tx_file']
src = CmdTestRef.sources['ref_tx_file']
for coin,files in src.items():
if coin == 'mm1':
coin = 'eth'

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_regtest: Regtest tests for the test.py test suite
test.cmdtest_py_d.ct_regtest: Regtest tests for the cmdtest.py test suite
"""
import os,json,time,re
@ -51,8 +51,8 @@ from .common import (
tx_comment_jp,
get_env_without_debug_vars
)
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
pat_date = r'\b\d\d-\d\d-\d\d\b'
pat_date_time = r'\b\d\d\d\d-\d\d-\d\d\s+\d\d:\d\d\b'
@ -163,7 +163,7 @@ def make_burn_addr(proto):
proto = proto,
mmtype = 'compressed' ).pubhash2addr('00'*20)
class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
class CmdTestRegtest(CmdTestBase,CmdTestShared):
'transacting and tracking wallet operations via regtest mode'
networks = ('btc','ltc','bch')
passthru_opts = ('coin','rpc_backend')
@ -437,7 +437,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
}
def __init__(self,trunner,cfgs,spawn):
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
if trunner == None:
return
if self.proto.testnet:
@ -445,7 +445,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
self.proto = init_proto( cfg, self.proto.coin, network='regtest', need_amt=True )
coin = self.proto.coin.lower()
import test.test_py_d.ts_regtest as rt_mod
import test.cmdtest_py_d.ct_regtest as rt_mod
for k in rt_data:
setattr( rt_mod, k, rt_data[k][coin] if coin in rt_data[k] else None )

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_seedsplit: Seed split/join tests for the test.py test suite
test.cmdtest_py_d.ct_seedsplit: Seed split/join tests for the cmdtest.py test suite
"""
import os
@ -27,7 +27,7 @@ from mmgen.util import capfirst
from ..include.common import strip_ansi_escapes,cmp_or_die
from .common import get_file_with_ext
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
ref_wf = 'test/ref/98831F3A.bip39'
ref_sid = '98831F3A'
@ -35,7 +35,7 @@ wpasswd = 'abc'
sh1_passwd = 'xyz'
dfl_wcls = get_wallet_cls('mmgen')
class TestSuiteSeedSplit(TestSuiteBase):
class CmdTestSeedSplit(CmdTestBase):
'splitting and joining seeds'
networks = ('btc',)
tmpdir_nums = [23]

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_shared: Shared methods for the test.py test suite
test.cmdtest_py_d.ct_shared: Shared methods for the cmdtest.py test suite
"""
from mmgen.util import get_extension
@ -26,8 +26,8 @@ from mmgen.wallet import get_wallet_cls
from ..include.common import cmp_or_die,strip_ansi_escapes,joinpath
from .common import ref_bw_file,ref_bw_hash_preset,ref_dir
class TestSuiteShared:
'shared methods for the test.py test suite'
class CmdTestShared:
'shared methods for the cmdtest.py test suite'
def txcreate_ui_common(
self,

View file

@ -7,7 +7,7 @@
# Licensed according to the terms of GPL Version 3. See LICENSE for details.
"""
test.test_py_d.ts_tool: tool tests for the MMGen test.py test suite
test.cmdtest_py_d.ct_tool: tool tests for the MMGen cmdtest.py test suite
"""
import sys,os
@ -25,10 +25,10 @@ from ..include.common import (
getrand
)
from .common import hincog_fn,incog_id_fn,hincog_offset,tool_enc_passwd,ref_dir
from .ts_base import TestSuiteBase
from .ts_main import TestSuiteMain
from .ct_base import CmdTestBase
from .ct_main import CmdTestMain
class TestSuiteTool(TestSuiteMain,TestSuiteBase):
class CmdTestTool(CmdTestMain,CmdTestBase):
"interactive 'mmgen-tool' commands"
networks = ('btc',)
segwit_opts_ok = False

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_wallet: Wallet conversion tests for the test.py test suite
test.cmdtest_py_d.ct_wallet: Wallet conversion tests for the cmdtest.py test suite
"""
import os
@ -27,10 +27,10 @@ from mmgen.wallet import get_wallet_cls
from ..include.common import cfg,joinpath,imsg
from .common import ref_dir,ref_wallet_brainpass,ref_wallet_incog_offset,hincog_fn,hincog_bytes
from .ts_base import TestSuiteBase
from .ts_shared import TestSuiteShared
from .ct_base import CmdTestBase
from .ct_shared import CmdTestShared
class TestSuiteWalletConv(TestSuiteBase,TestSuiteShared):
class CmdTestWalletConv(CmdTestBase,CmdTestShared):
'wallet conversion to and from reference data'
networks = ('btc',)
tmpdir_nums = [11,12,13]
@ -92,7 +92,7 @@ class TestSuiteWalletConv(TestSuiteBase,TestSuiteShared):
for k,_ in self.cmd_group:
for n in (1,2,3):
setattr(self,f'{k}_{n}',getattr(self,k))
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
def ref_wallet_conv(self):
wf = joinpath(ref_dir,self.sources[str(self.seed_len)]['ref_wallet'])

View file

@ -10,7 +10,7 @@
"""
test.test_py_d.ts_xmr_autosign: xmr autosigning tests for the test.py test suite
test.cmdtest_py_d.ct_xmr_autosign: xmr autosigning tests for the cmdtest.py test suite
"""
import os,time,re,shutil
@ -29,8 +29,8 @@ from ..include.common import (
)
from .common import get_file_with_ext
from .ts_xmrwallet import TestSuiteXMRWallet
from .ts_autosign import TestSuiteAutosignBase
from .ct_xmrwallet import CmdTestXMRWallet
from .ct_autosign import CmdTestAutosignBase
def make_burn_addr():
from mmgen.tool.coin import tool_cmd
@ -40,20 +40,20 @@ def make_burn_addr():
proto = cfg._proto,
mmtype = 'monero' ).privhex2addr('beadcafe'*8)
class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
class CmdTestXMRAutosign(CmdTestXMRWallet,CmdTestAutosignBase):
"""
Monero autosigning operations
"""
tmpdir_nums = [39]
# ts_xmrwallet attrs:
# ct_xmrwallet attrs:
user_data = (
('miner', '98831F3A', False, 130, '1', []),
('alice', 'FE3C6545', True, 150, '1-2', []),
)
# ts_autosign attrs:
# ct_autosign attrs:
coins = ['xmr']
daemon_coins = []
txfile_coins = []
@ -106,8 +106,8 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
def __init__(self,trunner,cfgs,spawn):
TestSuiteXMRWallet.__init__(self,trunner,cfgs,spawn)
TestSuiteAutosignBase.__init__(self,trunner,cfgs,spawn)
CmdTestXMRWallet.__init__(self,trunner,cfgs,spawn)
CmdTestAutosignBase.__init__(self,trunner,cfgs,spawn)
if trunner is None:
return

View file

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
test.test_py_d.ts_xmrwallet: xmrwallet tests for the test.py test suite
test.cmdtest_py_d.ct_xmrwallet: xmrwallet tests for the cmdtest.py test suite
"""
import sys,os,time,re,atexit,asyncio,shutil
@ -43,7 +43,7 @@ from ..include.common import (
strip_ansi_escapes
)
from .common import get_file_with_ext
from .ts_base import TestSuiteBase
from .ct_base import CmdTestBase
# atexit functions:
def stop_daemons(self):
@ -62,7 +62,7 @@ def kill_proxy(cls,args):
cmd = [ 'pkill', '-f', ' '.join(args) ]
run(cmd)
class TestSuiteXMRWallet(TestSuiteBase):
class CmdTestXMRWallet(CmdTestBase):
"""
Monero wallet operations
"""
@ -117,7 +117,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
)
def __init__(self,trunner,cfgs,spawn):
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
CmdTestBase.__init__(self,trunner,cfgs,spawn)
if trunner is None:
return

View file

@ -7,7 +7,7 @@
# Licensed according to the terms of GPL Version 3. See LICENSE for details.
"""
test.test_py_d.input: Shared input routines for the test.py test suite
test.cmdtest_py_d.input: Shared input routines for the cmdtest.py test suite
"""
import time

View file

@ -59,8 +59,8 @@ def strip_ansi_escapes(s):
import re
return re.sub('\x1b' + r'\[[;0-9]+?m','',s)
test_py_log_fn = 'test.py.log'
test_py_error_fn = 'test.py.err'
cmdtest_py_log_fn = 'cmdtest.py.log'
cmdtest_py_error_fn = 'cmdtest.py.err'
ascii_uc = ''.join(map(chr,list(range(65,91)))) # 26 chars
ascii_lc = ''.join(map(chr,list(range(97,123)))) # 26 chars

View file

@ -80,7 +80,7 @@ init_tests() {
d_altref="altcoin reference file checks"
t_altref="
- $test_py ref_altcoin # generated addrfiles verified against checksums
- $cmdtest_py ref_altcoin # generated addrfiles verified against checksums
"
d_altgen="altcoin address generation"
@ -127,72 +127,72 @@ init_tests() {
d_xmr="Monero xmrwallet operations"
t_xmr="
- $test_py --coin=xmr
- $cmdtest_py --coin=xmr
"
d_eth="operations for Ethereum and Ethereum Classic using devnet"
t_eth="
geth $test_py --coin=eth ethdev
parity $test_py --coin=etc ethdev
geth $cmdtest_py --coin=eth ethdev
parity $cmdtest_py --coin=etc ethdev
"
[ "$ARM32" -o "$ARM64" ] && t_eth_skip+=' parity'
d_autosign="transaction and message autosigning"
t_autosign="- $test_py autosign"
t_autosign="- $cmdtest_py autosign"
d_autosign_btc="transaction and message autosigning (Bitcoin only)"
t_autosign_btc="- $test_py autosign_btc"
t_autosign_btc="- $cmdtest_py autosign_btc"
d_autosign_btc="transaction and message autosigning (interactive)"
t_autosign_live="- $test_py autosign_live"
t_autosign_live="- $cmdtest_py autosign_live"
d_btc="overall operations with emulated RPC data (Bitcoin)"
t_btc="
- $python scripts/compute-file-chksum.py $REFDIR/*testnet.rawtx >/dev/null 2>&1
- $test_py --exclude regtest,autosign,ref_altcoin
- $test_py --segwit
- $test_py --segwit-random
- $test_py --bech32
- $cmdtest_py --exclude regtest,autosign,ref_altcoin
- $cmdtest_py --segwit
- $cmdtest_py --segwit-random
- $cmdtest_py --bech32
"
d_btc_tn="overall operations with emulated RPC data (Bitcoin testnet)"
t_btc_tn="
- $test_py --testnet=1
- $test_py --testnet=1 --segwit
- $test_py --testnet=1 --segwit-random
- $test_py --testnet=1 --bech32
- $cmdtest_py --testnet=1
- $cmdtest_py --testnet=1 --segwit
- $cmdtest_py --testnet=1 --segwit-random
- $cmdtest_py --testnet=1 --bech32
"
d_btc_rt="overall operations using the regtest network (Bitcoin)"
t_btc_rt="- $test_py regtest"
t_btc_rt="- $cmdtest_py regtest"
d_bch="overall operations with emulated RPC data (Bitcoin Cash Node)"
t_bch="- $test_py --coin=bch --exclude regtest"
t_bch="- $cmdtest_py --coin=bch --exclude regtest"
d_bch_tn="overall operations with emulated RPC data (Bitcoin Cash Node testnet)"
t_bch_tn="- $test_py --coin=bch --testnet=1 --exclude regtest"
t_bch_tn="- $cmdtest_py --coin=bch --testnet=1 --exclude regtest"
d_bch_rt="overall operations using the regtest network (Bitcoin Cash Node)"
t_bch_rt="- $test_py --coin=bch regtest"
t_bch_rt="- $cmdtest_py --coin=bch regtest"
d_ltc="overall operations with emulated RPC data (Litecoin)"
t_ltc="
- $test_py --coin=ltc --exclude regtest
- $test_py --coin=ltc --segwit
- $test_py --coin=ltc --segwit-random
- $test_py --coin=ltc --bech32
- $cmdtest_py --coin=ltc --exclude regtest
- $cmdtest_py --coin=ltc --segwit
- $cmdtest_py --coin=ltc --segwit-random
- $cmdtest_py --coin=ltc --bech32
"
d_ltc_tn="overall operations with emulated RPC data (Litecoin testnet)"
t_ltc_tn="
- $test_py --coin=ltc --testnet=1 --exclude regtest
- $test_py --coin=ltc --testnet=1 --segwit
- $test_py --coin=ltc --testnet=1 --segwit-random
- $test_py --coin=ltc --testnet=1 --bech32
- $cmdtest_py --coin=ltc --testnet=1 --exclude regtest
- $cmdtest_py --coin=ltc --testnet=1 --segwit
- $cmdtest_py --coin=ltc --testnet=1 --segwit-random
- $cmdtest_py --coin=ltc --testnet=1 --bech32
"
d_ltc_rt="overall operations using the regtest network (Litecoin)"
t_ltc_rt="- $test_py --coin=ltc regtest"
t_ltc_rt="- $cmdtest_py --coin=ltc regtest"
d_tool2="'mmgen-tool' utility with data check"
t_tool2="

View file

@ -131,7 +131,7 @@ trap 'echo -e "${GREEN}Exiting at user request$RESET"; exit' INT
umask 0022
test_py='test/test.py -n'
cmdtest_py='test/cmdtest.py -n'
objtest_py='test/objtest.py'
objattrtest_py='test/objattrtest.py'
unit_tests_py='test/unit_tests.py --names --quiet'
@ -156,7 +156,7 @@ do
echo " USAGE: $PROGNAME [options] [tests or test group]"
echo " OPTIONS: -h Print this help message"
echo " -A Skip tests requiring altcoin modules or daemons"
echo " -b Buffer keypresses for all invocations of 'test/test.py'"
echo " -b Buffer keypresses for all invocations of 'test/cmdtest.py'"
echo " -C Run tests in coverage mode"
echo " -d Enable Python Development Mode"
echo " -D Run tests in deterministic mode"
@ -164,27 +164,27 @@ do
echo " -F Reduce rounds even further"
echo " -L List available tests and test groups with description"
echo " -l List the test name symbols"
echo " -N Pass the --no-timings switch to test/test.py"
echo " -N Pass the --no-timings switch to test/cmdtest.py"
echo " -O Use pexpect.spawn rather than popen_spawn where applicable"
echo " -p Pause between tests"
echo " -s LIST Skip tests in LIST (space-separated)"
echo " -S Build SDIST distribution, unpack, and run test"
echo " -t Print the tests without running them"
echo " -v Run test/test.py with '--exact-output' and other commands"
echo " -v Run test/cmdtest.py with '--exact-output' and other commands"
echo " with '--verbose' switch"
echo " -V Run test/test.py and other commands with '--verbose' switch"
echo " -V Run test/cmdtest.py and other commands with '--verbose' switch"
echo
echo " For traceback output and error file support, set the EXEC_WRAPPER_TRACEBACK"
echo " environment var"
exit ;;
A) SKIP_ALT_DEP=1
test_py+=" --no-altcoin"
cmdtest_py+=" --no-altcoin"
unit_tests_py+=" --no-altcoin-deps"
scrambletest_py+=" --no-altcoin" ;;
b) test_py+=" --buf-keypress" ;;
b) cmdtest_py+=" --buf-keypress" ;;
C) mkdir -p 'test/trace'
touch 'test/trace.acc'
test_py+=" --coverage"
cmdtest_py+=" --coverage"
tooltest_py+=" --coverage"
tooltest2_py+=" --fork --coverage"
scrambletest_py+=" --coverage"
@ -202,15 +202,15 @@ do
F) rounds=3 FAST=1 fast_opt='--fast' unit_tests_py+=" --fast" ;;
L) list_avail_tests; exit ;;
l) list_group_symbols; exit ;;
N) test_py+=" --no-timings" ;;
O) test_py+=" --pexpect-spawn" ;;
N) cmdtest_py+=" --no-timings" ;;
O) cmdtest_py+=" --pexpect-spawn" ;;
p) PAUSE=1 ;;
s) SKIP_LIST+=" $OPTARG" ;;
S) SDIST_TEST=1 ;;
t) LIST_CMDS=1 ;;
v) EXACT_OUTPUT=1 test_py+=" --exact-output" ;&
v) EXACT_OUTPUT=1 cmdtest_py+=" --exact-output" ;&
V) VERBOSE='--verbose'
[ "$EXACT_OUTPUT" ] || test_py+=" --verbose"
[ "$EXACT_OUTPUT" ] || cmdtest_py+=" --verbose"
unit_tests_py="${unit_tests_py/--quiet/--verbose}"
altcoin_mod_opts="${altcoin_mod_opts/--quiet/--verbose}"
tooltest2_py="${tooltest2_py/--quiet/--verbose}"
@ -253,7 +253,7 @@ case $1 in
'extra') tests=$extra_tests ;;
'noalt') tests=$noalt_tests
SKIP_ALT_DEP=1
test_py+=" --no-altcoin"
cmdtest_py+=" --no-altcoin"
unit_tests_py+=" --no-altcoin-deps"
scrambletest_py+=" --no-altcoin" ;;
'quick') tests=$quick_tests ;;
@ -274,7 +274,7 @@ remove_skipped_tests
check_tests
test/test.py clean
test/cmdtest.py clean
start_time=$(date +%s)

View file

@ -172,7 +172,7 @@ if cfg.list_cmds:
if cfg.testing_status:
tested_in = {
'tooltest.py': [],
'test.py': (
'cmdtest.py': (
'encrypt','decrypt','find_incog_data',
'addrfile_chksum','keyaddrfile_chksum','passwdfile_chksum',
'add_label','remove_label','remove_address','twview',
@ -192,7 +192,7 @@ if cfg.testing_status:
tested_in['tooltest.py'] += list(v['cmd_data'].keys())
Msg(green("Testing status of 'mmgen-tool' commands:"))
for l in ('tooltest.py','tooltest2.py','test.py'):
for l in ('tooltest.py','tooltest2.py','cmdtest.py'):
Msg('\n ' + blue(l+':'))
Msg(' '+'\n '.join(sorted(tested_in[l])))
@ -203,7 +203,7 @@ if cfg.testing_status:
set(ignore) -
set(tested_in['tooltest.py']) -
set(tested_in['tooltest2.py']) -
set(tested_in['test.py'])
set(tested_in['cmdtest.py'])
)
if uc:
Msg(yellow('\n {}\n {}'.format('Untested commands:','\n '.join(uc))))

View file

@ -20,7 +20,7 @@
test/tooltest2.py: Simple tests for the 'mmgen-tool' utility
"""
# TODO: move all non-interactive 'mmgen-tool' tests in 'test.py' here
# TODO: move all non-interactive 'mmgen-tool' tests in 'cmdtest.py' here
# TODO: move all(?) tests in 'tooltest.py' here (or duplicate them?)
import sys,os,time,importlib
@ -851,7 +851,7 @@ def check_output(out,chk):
async def run_test(cls,gid,cmd_name):
data = tests[gid][cmd_name]
# behavior is like test.py: run coin-dependent tests only if proto.testnet or proto.coin != BTC
# behavior is like cmdtest.py: run coin-dependent tests only if proto.testnet or proto.coin != BTC
if gid in coin_dependent_groups:
k = '{}_{}'.format(
( cfg.token.lower() if proto.tokensym else proto.coin.lower() ),

View file

@ -60,5 +60,5 @@ class unit_tests:
return True
def ssh_socks_proxy(self,name,ut):
from test.test_py_d.ts_xmrwallet import TestSuiteXMRWallet
return TestSuiteXMRWallet.init_proxy(external_call=True)
from test.cmdtest_py_d.ct_xmrwallet import CmdTestXMRWallet
return CmdTestXMRWallet.init_proxy(external_call=True)