BTC-only testing fixes
This commit is contained in:
parent
fb9c5ac22c
commit
32b3558581
12 changed files with 43 additions and 10 deletions
|
|
@ -1 +1 @@
|
|||
14.0.dev22
|
||||
14.0.dev23
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ if not po.user_opts.get('skipping_deps'):
|
|||
# step 2: opts.init will create new data_dir in ./test (if not cfg.skipping_deps)
|
||||
cfg = Config(opts_data=opts_data)
|
||||
|
||||
if cfg.no_altcoin and cfg.coin != 'BTC':
|
||||
die(1,f'--no-altcoin incompatible with --coin={cfg.coin}')
|
||||
|
||||
set_globals(cfg)
|
||||
|
||||
from test.cmdtest_py_d.common import ( # this must be loaded after set_globals()
|
||||
|
|
@ -696,6 +699,11 @@ class CmdTestRunner:
|
|||
|
||||
def init_group(self,gname,sg_name=None,cmd=None,quiet=False,do_clean=True):
|
||||
|
||||
from test.cmdtest_py_d.cfg import cmd_groups_altcoin
|
||||
if cfg.no_altcoin and gname in cmd_groups_altcoin:
|
||||
omsg(gray(f'INFO → skipping test group {gname!r} (--no-altcoin)'))
|
||||
return None
|
||||
|
||||
ct_cls = CmdGroupMgr().load_mod(gname)
|
||||
|
||||
if sys.platform == 'win32' and ct_cls.win_skip:
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ test.cmdtest_py_d.cfg: configuration data for cmdtest.py
|
|||
from .common import pwfile,hincog_fn,incog_id_fn,randbool
|
||||
from ..include.common import cfg
|
||||
|
||||
cmd_groups_altcoin = ['ref_altcoin','autosign','ethdev','xmrwallet','xmr_autosign']
|
||||
|
||||
cmd_groups_dfl = {
|
||||
'misc': ('CmdTestMisc',{}),
|
||||
'opts': ('CmdTestOpts',{'full_data':True}),
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ class CmdTestMisc(CmdTestBase):
|
|||
return t
|
||||
|
||||
def xmrwallet_txview(self,op='txview'):
|
||||
if cfg.no_altcoin:
|
||||
return 'skip'
|
||||
files = get_file_with_ext('test/ref/monero','tx',no_dot=True,delete=False,return_list=True)
|
||||
t = self.spawn( 'mmgen-xmrwallet', [op] + files )
|
||||
res = t.read(strip_color=True)
|
||||
|
|
|
|||
|
|
@ -423,6 +423,8 @@ class CmdTestRef3Addr(CmdTestRef3Seed):
|
|||
def mn_pwgen(self,req_pw_len,pwfmt,ftype='passbip39',stdout=False):
|
||||
pwlen = min(req_pw_len,{'1':12,'2':18,'3':24}[self.test_name[-1]])
|
||||
if pwfmt == 'xmrseed':
|
||||
if cfg.no_altcoin:
|
||||
return 'skip'
|
||||
pwlen += 1
|
||||
ea = ['--accept-defaults']
|
||||
return self.pwgen(ftype,'фубар@crypto.org',pwfmt,pwlen,ea,stdout=stdout)
|
||||
|
|
|
|||
|
|
@ -567,9 +567,6 @@ from mmgen.keygen import get_backends
|
|||
from mmgen.util2 import load_cryptodomex
|
||||
from test.include.common import getrand,get_ethkey,set_globals
|
||||
|
||||
# This must be done at top level, not in monero tool __init__
|
||||
load_cryptodomex()
|
||||
|
||||
gtr = namedtuple('gen_tool_result',['wif','addr','viewkey'])
|
||||
sd = namedtuple('saved_data_item',['reduced','wif','addr','viewkey'])
|
||||
|
||||
|
|
@ -584,5 +581,9 @@ vmsg = cfg._util.vmsg
|
|||
|
||||
proto = cfg._proto
|
||||
|
||||
if proto.coin == 'XMR':
|
||||
# This must be done at top level, not in monero tool __init__
|
||||
load_cryptodomex()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ def do_coin_tests():
|
|||
def do_passwd_tests():
|
||||
bmsg('Testing password scramble strings and list IDs')
|
||||
for tname,tdata in passwd_data.items():
|
||||
if tname.startswith('xmrseed') and cfg.no_altcoin:
|
||||
continue
|
||||
a,b,pwid = tname.split('_')
|
||||
fmt_arg = '' if a == 'dfl' else f'--passwd-fmt={a} '
|
||||
len_arg = '' if b == 'dfl' else f'--passwd-len={b} '
|
||||
|
|
|
|||
|
|
@ -41,11 +41,12 @@ init_tests() {
|
|||
- $objtest_py --coin=btc
|
||||
- $objtest_py --getobj --coin=btc
|
||||
- $objtest_py --coin=btc --testnet=1
|
||||
- $objtest_py --coin=ltc
|
||||
- $objtest_py --coin=ltc --testnet=1
|
||||
- $objtest_py --coin=eth
|
||||
a $objtest_py --coin=ltc
|
||||
a $objtest_py --coin=ltc --testnet=1
|
||||
a $objtest_py --coin=eth
|
||||
- $objattrtest_py
|
||||
"
|
||||
[ "$SKIP_ALT_DEP" ] && t_obj_skip='a'
|
||||
|
||||
[ "$PYTHONOPTIMIZE" ] && {
|
||||
echo -e "${YELLOW}PYTHONOPTIMIZE set, skipping object tests$RESET"
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ do
|
|||
A) SKIP_ALT_DEP=1
|
||||
cmdtest_py+=" --no-altcoin"
|
||||
unit_tests_py+=" --no-altcoin-deps"
|
||||
scrambletest_py+=" --no-altcoin" ;;
|
||||
scrambletest_py+=" --no-altcoin"
|
||||
tooltest2_py+=" --no-altcoin" ;;
|
||||
b) cmdtest_py+=" --buf-keypress" ;;
|
||||
C) mkdir -p 'test/trace'
|
||||
touch 'test/trace.acc'
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ except ImportError:
|
|||
from test.include.common import set_globals,end_msg,sample_text,init_coverage
|
||||
|
||||
from mmgen.cfg import Config
|
||||
from mmgen.color import green,blue,purple,cyan
|
||||
from mmgen.color import green,blue,purple,cyan,gray
|
||||
from mmgen.util import msg,msg_r,Msg,is_hex_str,async_run,die
|
||||
|
||||
from mmgen.bip39 import is_bip39_mnemonic
|
||||
|
|
@ -72,6 +72,7 @@ opts_data = {
|
|||
'usage':'[options] [command]...',
|
||||
'options': """
|
||||
-h, --help Print this help message
|
||||
-a, --no-altcoin Skip altcoin tests
|
||||
-A, --tool-api Test the tool_api subsystem
|
||||
-C, --coverage Produce code coverage info using trace module
|
||||
-d, --die-on-missing Abort if no test data found for given command
|
||||
|
|
@ -876,9 +877,18 @@ async def run_test(cls,gid,cmd_name):
|
|||
m2 )
|
||||
|
||||
msg_r(green(m)+'\n' if cfg.verbose else m)
|
||||
skipping = False
|
||||
|
||||
for d in data:
|
||||
for n,d in enumerate(data):
|
||||
args,out,opts,mmtype = d + tuple([None] * (4-len(d)))
|
||||
if 'fmt=xmrseed' in args and cfg.no_altcoin:
|
||||
if not skipping:
|
||||
qmsg('')
|
||||
qmsg(('' if n else '\n') + gray(f'Skipping altcoin test {cmd_name} {args}'))
|
||||
skipping = True
|
||||
continue
|
||||
else:
|
||||
skipping = False
|
||||
stdin_input = None
|
||||
if args and isinstance(args[0],bytes):
|
||||
stdin_input = args[0]
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ def do_test(
|
|||
|
||||
class unit_tests:
|
||||
|
||||
altcoin_deps = ('keyaddr_xmr','viewkeyaddr')
|
||||
|
||||
def idxlist(self,name,ut):
|
||||
for i,o in (
|
||||
('99,88-102,1-3,4,9,818,444-445,816', '1-4,9,88-102,444-445,816,818'),
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ class unit_test:
|
|||
|
||||
for net_id,addrs in vectors.items():
|
||||
coin,network = net_id.split('_')
|
||||
if cfg.no_altcoin_deps and coin != 'btc':
|
||||
continue
|
||||
test_network(
|
||||
init_proto( cfg, coin, network=network ),
|
||||
addrs )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue