test suite: MSWin testing fixes

This commit is contained in:
The MMGen Project 2022-11-01 14:37:06 +00:00
commit e0c85f056d
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
10 changed files with 27 additions and 7 deletions

View file

@ -1 +1 @@
October 2022
November 2022

View file

@ -1 +1 @@
13.3.dev15
13.3.dev16

View file

@ -231,8 +231,11 @@ class MMGenTermMSWinStub(MMGenTermMSWin):
@classmethod
def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_bytes=None):
"""
Use stdin to allow UTF-8 and emulate the one-character behavior of MMGenTermMSWin
"""
msg_r(prompt)
return os.read(0,1).decode()
return sys.stdin.read(1)
get_char_raw = get_char

View file

@ -118,7 +118,7 @@ init_tests() {
z $gentest_py --coin=zec --type=zcash_z all:zcash-mini $rounds50x
"
[ "$MSYS2" ] && t_altgen_skip='M m z' # no moneropy (pysha3), zcash-mini (golang)
[ "$MSYS2" ] && t_altgen_skip='z' # no zcash-mini (golang)
[ "$ARM32" ] && t_altgen_skip='z e'
[ "$FAST" ] && t_altgen_skip+=' M'
# ARM ethkey available only on Arch Linux:

View file

@ -193,6 +193,9 @@ opts.UserOpts._reset_ok += (
parsed_opts = opts.init(opts_data,return_parsed=True)
usr_args = parsed_opts.cmd_args
if opt.pexpect_spawn and g.platform == 'win':
die(1,'--pexpect-spawn option not supported on Windows platform, exiting')
if opt.daemon_id and opt.daemon_id in g.blacklist_daemons.split():
die(1,f'test.py: daemon {opt.daemon_id!r} blacklisted, exiting')

View file

@ -152,7 +152,9 @@ class TestSuiteCfg(TestSuiteBase):
def old_sample_bad_var(self):
d = ['foo true','bar false']
write_to_file(self.path('usr'),'\n'.join(d) + '\n')
return self.old_sample_common(old_set=True,pexpect_spawn=True)
return self.old_sample_common(
old_set = True,
pexpect_spawn = False if g.platform == 'win' else True )
def coin_specific_vars(self):
"""

View file

@ -1278,10 +1278,13 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
def edit_label1(self):
return self.edit_label(out_num=del_addrs[0],label_text=tw_label_zh[:3])
def edit_label2(self):
return self.edit_label(out_num=del_addrs[0],label_text=tw_label_zh[3:],changed=True,pexpect_spawn=True)
spawn = False if g.platform == 'win' else True
return self.edit_label(out_num=del_addrs[0],label_text=tw_label_zh[3:],changed=True,pexpect_spawn=spawn)
def edit_label3(self):
return self.edit_label(out_num=del_addrs[1],label_text=tw_label_lat_cyr_gr)
def edit_label4(self):
if self.skip_for_win():
return 'skip'
return self.edit_label(out_num=del_addrs[0],label_text=Ctrl_U,pexpect_spawn=True)
def token_edit_label1(self):

View file

@ -219,6 +219,8 @@ class TestSuiteInput(TestSuiteBase):
return t
def _input_func(self,func_name,arg_dfls,func_args,text,expect,term):
if term and g.platform == 'win':
return ('skip_warn','pexpect_spawn not supported on Windows platform')
func_args = {k:v for k,v in zip(arg_dfls.keys(),func_args)}
t = self.spawn(
'test/misc/input_func.py',
@ -261,7 +263,8 @@ class TestSuiteInput(TestSuiteBase):
return self._get_char(['prompt> ','',True,5],'x','x',False)
def get_char2(self):
return self._get_char(['prompt> ','',True,5],'xxxxx','xxxxx',False)
expect = 'x' if g.platform == 'win' else 'xxxxx'
return self._get_char(['prompt> ','',True,5],'xxxxx',expect,False)
def get_char3(self):
return self._get_char(['','',True,5],'x','x',False)
@ -306,6 +309,8 @@ class TestSuiteInput(TestSuiteBase):
return self._line_input(['prompt> ',True,'foobarbaz',True],Ctrl_U+'foobar','foobar',True)
def _password_entry(self,prompt,opts=[],term=False):
if term and g.platform == 'win':
return ('skip_warn','pexpect_spawn not supported on Windows platform')
t = self.spawn( 'test/misc/input_func.py', opts + ['passphrase'], cmd_dir='.', pexpect_spawn=term )
imsg('Terminal: {}'.format(term))
pw = 'abc-α'

View file

@ -221,6 +221,8 @@ class TestSuiteOutput(TestSuiteBase):
return t
def oneshot_warning_term(self):
if self.skip_for_win():
return 'skip'
return self.oneshot_warning(pexpect_spawn=True)
class TestSuiteRefTX(TestSuiteMain,TestSuiteBase):

View file

@ -1278,6 +1278,8 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
return t
def alice_txcreate_info_term(self):
if self.skip_for_win():
return 'skip'
return self.alice_txcreate_info(pexpect_spawn=True)
def bob_msgcreate(self):