cmdtest.py: remove unneeded opts from spawn cmdline
This commit is contained in:
parent
647c7a2601
commit
3b3d06fb51
11 changed files with 51 additions and 22 deletions
|
|
@ -574,7 +574,6 @@ class CmdTestRunner:
|
|||
([] if no_exec_wrapper else ['scripts/exec_wrapper.py']) +
|
||||
[cmd_path] +
|
||||
([] if no_passthru_opts else self.passthru_opts) +
|
||||
self.tg.extra_spawn_args +
|
||||
args )
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtestBDBWallet)
|
|||
|
||||
networks = ('btc', 'bch', 'ltc')
|
||||
tmpdir_nums = [49]
|
||||
extra_spawn_args = []
|
||||
|
||||
rtFundAmt = None # pylint
|
||||
rt_data = {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ class CmdTestBase:
|
|||
'initializer class for the cmdtest.py test suite'
|
||||
base_passthru_opts = ('data_dir','skip_cfg_file')
|
||||
passthru_opts = ()
|
||||
extra_spawn_args = []
|
||||
networks = ()
|
||||
segwit_opts_ok = False
|
||||
color = False
|
||||
|
|
@ -56,6 +55,7 @@ class CmdTestBase:
|
|||
self.coin = self.proto.coin.lower()
|
||||
self.fork = 'btc' if self.coin == 'bch' and not cfg.cashaddr else self.coin
|
||||
self.altcoin_pfx = '' if self.fork == 'btc' else f'-{self.proto.coin}'
|
||||
self.testnet_opt = [f'--testnet=1'] if cfg.testnet else []
|
||||
if len(self.tmpdir_nums) == 1:
|
||||
self.tmpdir_num = self.tmpdir_nums[0]
|
||||
if self.tr:
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
|
|||
'Ethereum transacting, token deployment and tracking wallet operations'
|
||||
networks = ('eth','etc')
|
||||
passthru_opts = ('coin','daemon_id','http_timeout','rpc_backend')
|
||||
extra_spawn_args = ['--regtest=1']
|
||||
tmpdir_nums = [22]
|
||||
color = True
|
||||
cmd_group_in = (
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
args += ['-d',self.tmpdir]
|
||||
if seed_len:
|
||||
args += ['-l',str(seed_len)]
|
||||
t = self.spawn('mmgen-walletgen', args + [self.usr_rand_arg])
|
||||
t = self.spawn('mmgen-walletgen', self.testnet_opt + args + [self.usr_rand_arg], no_passthru_opts=True)
|
||||
t.license()
|
||||
t.usr_rand(self.usr_rand_chars)
|
||||
wcls = MMGenWallet
|
||||
|
|
@ -390,7 +390,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
args = [self.usr_rand_arg,'-p1','-d',self.tr.trash_dir,'-L','Label']
|
||||
if wf != 'default':
|
||||
args += [wf]
|
||||
t = self.spawn('mmgen-subwalletgen', args + ['10s'])
|
||||
t = self.spawn('mmgen-subwalletgen', self.testnet_opt + args + ['10s'], no_passthru_opts=True)
|
||||
t.license()
|
||||
wcls = MMGenWallet
|
||||
t.passphrase(wcls.desc,self.cfgs['1']['wpasswd'])
|
||||
|
|
@ -406,7 +406,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
icls = get_wallet_cls(ext=get_extension(wf))
|
||||
ocls = get_wallet_cls('words')
|
||||
args = [self.usr_rand_arg,'-p1','-d',self.tr.trash_dir,'-o',ocls.fmt_codes[0],wf,'3L']
|
||||
t = self.spawn('mmgen-subwalletgen', args)
|
||||
t = self.spawn('mmgen-subwalletgen', self.testnet_opt + args, no_passthru_opts=True)
|
||||
t.license()
|
||||
t.passphrase(icls.desc,self.cfgs['1']['wpasswd'])
|
||||
t.expect(r'Generating subseed.*\D3L',regex=True)
|
||||
|
|
@ -424,7 +424,10 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
'keep': ['-d',self.tr.trash_dir,'--keep-label'],
|
||||
'user': ['-d',self.tr.trash_dir]
|
||||
}[label_action]
|
||||
t = self.spawn('mmgen-passchg', add_args + [self.usr_rand_arg, '-p2'] + ([wf] if wf else []))
|
||||
t = self.spawn(
|
||||
'mmgen-passchg',
|
||||
self.testnet_opt + add_args + [self.usr_rand_arg, '-p2'] + ([wf] if wf else []),
|
||||
no_passthru_opts = True)
|
||||
t.license()
|
||||
wcls = MMGenWallet
|
||||
t.passphrase(wcls.desc,self.cfgs['1']['wpasswd'],pwtype='old')
|
||||
|
|
@ -712,7 +715,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
def _walletconv_export(self,wf,uargs=[],out_fmt='w',pf=None):
|
||||
opts = ['-d',self.tmpdir,'-o',out_fmt] + uargs + \
|
||||
([],[wf])[bool(wf)] + ([],['-P',pf])[bool(pf)]
|
||||
t = self.spawn('mmgen-walletconv',opts)
|
||||
t = self.spawn('mmgen-walletconv', self.testnet_opt + opts, no_passthru_opts=True)
|
||||
t.license()
|
||||
|
||||
if not pf:
|
||||
|
|
@ -888,7 +891,7 @@ class CmdTestMain(CmdTestBase,CmdTestShared):
|
|||
make_brainwallet_file(bwf)
|
||||
seed_len = str(self.seed_len)
|
||||
args = ['-d',self.tmpdir,'-p1',self.usr_rand_arg,'-l'+seed_len,'-ibw']
|
||||
t = self.spawn('mmgen-walletconv', args + [bwf])
|
||||
t = self.spawn('mmgen-walletconv', self.testnet_opt + args + [bwf], no_passthru_opts=True)
|
||||
t.license()
|
||||
wcls = MMGenWallet
|
||||
t.passphrase_new('new ' +wcls.desc,self.wpasswd)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import sys, os, re, time
|
|||
|
||||
from mmgen.util import ymsg, die
|
||||
|
||||
from ..include.common import cfg, start_test_daemons, stop_test_daemons, imsg
|
||||
from ..include.common import cfg, start_test_daemons, stop_test_daemons, imsg, proto_cmds
|
||||
from .common import get_file_with_ext, dfl_words_file
|
||||
from .ct_base import CmdTestBase
|
||||
from .ct_main import CmdTestMain
|
||||
|
|
@ -197,7 +197,7 @@ class CmdTestHelp(CmdTestBase):
|
|||
)
|
||||
|
||||
def usage(self):
|
||||
t = self.spawn('mmgen-walletgen', ['foo'], exit_val=1)
|
||||
t = self.spawn('mmgen-walletgen', ['foo'], exit_val=1, no_passthru_opts=True)
|
||||
t.expect('USAGE: mmgen-walletgen')
|
||||
return t
|
||||
|
||||
|
|
@ -210,7 +210,8 @@ class CmdTestHelp(CmdTestBase):
|
|||
t = self.spawn(
|
||||
'mmgen-walletconv',
|
||||
['--stdout', '--in-fmt=hex', '--out-fmt=hex'],
|
||||
env = {'MMGEN_NO_LICENSE':''} )
|
||||
env = {'MMGEN_NO_LICENSE':''},
|
||||
no_passthru_opts = True)
|
||||
t.expect('to continue: ', 'w')
|
||||
t.expect('TERMS AND CONDITIONS') # start of GPL text
|
||||
if cfg.pexpect_spawn:
|
||||
|
|
@ -252,7 +253,8 @@ class CmdTestHelp(CmdTestBase):
|
|||
t = self.spawn(
|
||||
f'mmgen-{cmdname}',
|
||||
[arg],
|
||||
extra_desc = f'(mmgen-{cmdname})')
|
||||
extra_desc = f'(mmgen-{cmdname})',
|
||||
no_passthru_opts = not cmdname in proto_cmds)
|
||||
t.expect(expect,regex=True)
|
||||
if pager and t.pexpect_spawn:
|
||||
time.sleep(0.2)
|
||||
|
|
|
|||
|
|
@ -188,14 +188,22 @@ class CmdTestRef(CmdTestBase,CmdTestShared):
|
|||
ocls = get_wallet_cls('words')
|
||||
args = ['-d',self.tr.trash_dir,'-o',ocls.fmt_codes[-1],wf,ss_idx]
|
||||
|
||||
t = self.spawn('mmgen-subwalletgen',args,extra_desc='(generate subwallet)')
|
||||
t = self.spawn(
|
||||
'mmgen-subwalletgen',
|
||||
self.testnet_opt + args,
|
||||
extra_desc = '(generate subwallet)',
|
||||
no_passthru_opts = True)
|
||||
t.expect(f'Generating subseed {ss_idx}')
|
||||
chk_sid = self.chk_data['ref_subwallet_sid'][f'98831F3A:{ss_idx}']
|
||||
fn = t.written_to_file(capfirst(ocls.desc))
|
||||
assert chk_sid in fn,f'incorrect filename: {fn} (does not contain {chk_sid})'
|
||||
ok()
|
||||
|
||||
t = self.spawn('mmgen-walletchk',[fn],extra_desc='(check subwallet)')
|
||||
t = self.spawn(
|
||||
'mmgen-walletchk',
|
||||
self.testnet_opt + [fn],
|
||||
extra_desc = '(check subwallet)',
|
||||
no_passthru_opts = True)
|
||||
t.expect(r'Valid MMGen native mnemonic data for Seed ID ([0-9A-F]*)\b',regex=True)
|
||||
sid = t.p.match.group(1)
|
||||
assert sid == chk_sid,f'subseed ID {sid} does not match expected value {chk_sid}'
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class CmdTestRef3Seed(CmdTestBase,CmdTestShared):
|
|||
args = ['-d',self.tmpdir,hp_arg,sl_arg,'-ibw','-L',label]
|
||||
self.write_to_tmpfile(bf,ref_wallet_brainpass)
|
||||
self.write_to_tmpfile(pwfile,self.wpasswd)
|
||||
t = self.spawn('mmgen-walletconv', args + [self.usr_rand_arg])
|
||||
t = self.spawn('mmgen-walletconv', self.testnet_opt + args + [self.usr_rand_arg], no_passthru_opts=True)
|
||||
t.license()
|
||||
t.expect('Enter brainwallet: ', ref_wallet_brainpass+'\n')
|
||||
ocls = get_wallet_cls('mmgen')
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ class CmdTestRegtest(CmdTestBase,CmdTestShared):
|
|||
'transacting and tracking wallet operations via regtest mode'
|
||||
networks = ('btc','ltc','bch')
|
||||
passthru_opts = ('coin','rpc_backend')
|
||||
extra_spawn_args = ['--regtest=1']
|
||||
tmpdir_nums = [17]
|
||||
color = True
|
||||
deterministic = False
|
||||
|
|
@ -548,7 +547,7 @@ class CmdTestRegtest(CmdTestBase,CmdTestShared):
|
|||
return t
|
||||
|
||||
def walletgen(self,user):
|
||||
t = self.spawn('mmgen-walletgen', ['-q', '-r0', '-p1', f'--{user}'])
|
||||
t = self.spawn('mmgen-walletgen', ['-q', '-r0', '-p1', f'--{user}'], no_passthru_opts=True)
|
||||
t.passphrase_new(f'new {dfl_wcls.desc}', rt_pw)
|
||||
t.label()
|
||||
t.expect('move it to the data directory? (Y/n): ', 'y')
|
||||
|
|
@ -1860,14 +1859,18 @@ class CmdTestRegtest(CmdTestBase,CmdTestShared):
|
|||
|
||||
def bob_walletconv_words(self):
|
||||
t = self.spawn(
|
||||
'mmgen-walletconv', [ '--bob', f'--outdir={self.tmpdir}', '--out-fmt=words' ] )
|
||||
'mmgen-walletconv',
|
||||
['--bob', f'--outdir={self.tmpdir}', '--out-fmt=words'],
|
||||
no_passthru_opts = True)
|
||||
t.passphrase(dfl_wcls.desc,rt_pw)
|
||||
t.written_to_file('data')
|
||||
return t
|
||||
|
||||
def bob_subwalletgen_bip39(self):
|
||||
t = self.spawn(
|
||||
'mmgen-subwalletgen', [ '--bob', f'--outdir={self.tmpdir}', '--out-fmt=bip39', '29L' ] )
|
||||
'mmgen-subwalletgen',
|
||||
['--bob', f'--outdir={self.tmpdir}', '--out-fmt=bip39', '29L'],
|
||||
no_passthru_opts = True)
|
||||
t.passphrase(dfl_wcls.desc,rt_pw)
|
||||
t.written_to_file('data')
|
||||
return t
|
||||
|
|
|
|||
|
|
@ -233,9 +233,11 @@ class CmdTestShared:
|
|||
t = self.spawn(
|
||||
'mmgen-walletchk',
|
||||
([] if dfl_wallet else ['-i',wcls.fmt_codes[0]])
|
||||
+ self.testnet_opt
|
||||
+ add_args + ['-p',hp]
|
||||
+ ([wf] if wf else []),
|
||||
extra_desc=extra_desc)
|
||||
extra_desc = extra_desc,
|
||||
no_passthru_opts = True)
|
||||
if wcls.type != 'incog_hidden':
|
||||
t.expect(f"Getting {wcls.desc} from file ‘")
|
||||
if wcls.enc and wcls.type != 'brain':
|
||||
|
|
|
|||
|
|
@ -97,6 +97,20 @@ sample_mn = {
|
|||
ref_kafile_pass = 'kafile password'
|
||||
ref_kafile_hash_preset = '1'
|
||||
|
||||
proto_cmds = (
|
||||
'addrimport',
|
||||
'autosign',
|
||||
'msg',
|
||||
'regtest',
|
||||
'tool',
|
||||
'txbump',
|
||||
'txcreate',
|
||||
'txdo',
|
||||
'txsend',
|
||||
'txsign',
|
||||
'xmrwallet',
|
||||
)
|
||||
|
||||
def getrand(n):
|
||||
if cfg.test_suite_deterministic:
|
||||
from mmgen.test import fake_urandom
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue