test suite: minor fixes and additions
This commit is contained in:
parent
c7beb2e60c
commit
11cca53660
7 changed files with 36 additions and 21 deletions
|
|
@ -1,12 +1,15 @@
|
|||
#!/bin/bash
|
||||
# Tested on Linux, MSys2
|
||||
# Tested on Linux, Armbian, Raspbian, MSYS2
|
||||
|
||||
REFDIR='test/ref'
|
||||
if uname -a | grep -q MSYS; then
|
||||
SUDO='sudo'
|
||||
|
||||
if [ "$(uname -m)" == 'armv7l' ]; then
|
||||
ARM32=1
|
||||
elif uname -a | grep -q 'MSYS'; then
|
||||
SUDO='' MSYS2=1;
|
||||
else
|
||||
SUDO='sudo' MSYS2=''
|
||||
fi
|
||||
|
||||
RED="\e[31;1m" GREEN="\e[32;1m" YELLOW="\e[33;1m" RESET="\e[0m"
|
||||
|
||||
trap 'echo -e "${GREEN}Exiting at user request$RESET"; exit' INT
|
||||
|
|
@ -202,12 +205,13 @@ i_hash='Internal hash function implementations'
|
|||
s_hash='Testing internal hash function implementations'
|
||||
t_hash="
|
||||
$python test/hashfunc.py sha256 $rounds_max
|
||||
$python test/hashfunc.py sha512 $rounds_max
|
||||
$python test/hashfunc.py sha512 $rounds_max # native sha512 not used by MMGen
|
||||
$python test/hashfunc.py keccak $rounds_max
|
||||
"
|
||||
f_hash='Hash function tests complete'
|
||||
|
||||
[ "$MSYS2" ] && t_hash_skip='2' # gmp issues
|
||||
[ "$ARM32" ] && t_hash_skip='2' # gmpy produces invalid init constants
|
||||
[ "$MSYS2" ] && t_hash_skip='2 3' # 2:py_long_long issues, 3:no pysha3 for keccak reference
|
||||
|
||||
i_alts='Gen-only altcoin'
|
||||
s_alts='The following tests will test generation operations for all supported altcoins'
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ class TestSuiteAutosign(TestSuiteBase):
|
|||
|
||||
for f,fn in zip(tfs,tfns):
|
||||
if fn: # use empty fn to skip file
|
||||
if g.debug_utf8:
|
||||
ext = '.testnet.rawtx' if fn.endswith('.testnet.rawtx') else '.rawtx'
|
||||
fn = fn[:-len(ext)] + '-α' + ext
|
||||
target = joinpath(mountpoint,'tx',fn)
|
||||
remove_signed_only or shutil.copyfile(f,target)
|
||||
try: os.unlink(target.replace('.rawtx','.sigtx'))
|
||||
|
|
|
|||
|
|
@ -265,10 +265,11 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
if g.platform == 'win':
|
||||
dc_dir = joinpath(os.environ['LOCALAPPDATA'],'Parity','Ethereum','chains','DevelopmentChain')
|
||||
shutil.rmtree(dc_dir,ignore_errors=True)
|
||||
m1 = 'Please start parity on another terminal as follows:\n'
|
||||
m2 = ['parity',lf_arg] + opts
|
||||
m3 = '\nPress ENTER to continue: '
|
||||
my_raw_input(m1 + ' '.join(m2) + m3)
|
||||
m1 = 'Please copy precompiled contract data to {d}/mm1 and {d}/mm2\n'.format(d=self.tmpdir)
|
||||
m2 = 'Then start parity on another terminal as follows:\n'
|
||||
m3 = ['parity',lf_arg] + opts
|
||||
m4 = '\nPress ENTER to continue: '
|
||||
my_raw_input(m1 + m2 + ' '.join(m3) + m4)
|
||||
elif subprocess.call(['which','parity'],stdout=subprocess.PIPE) == 0:
|
||||
ss = 'parity.*--log-file=test/data_dir.*/parity.log' # allow for UTF8_DEBUG
|
||||
try:
|
||||
|
|
@ -489,8 +490,13 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
def token_compile(self,token_data={}):
|
||||
odir = joinpath(self.tmpdir,token_data['symbol'].lower())
|
||||
if self.skip_for_win():
|
||||
m ='Copy solc v0.5.3 contract data for token {} to directory {} and hit ENTER: '
|
||||
input(m.format(token_data['symbol'],odir))
|
||||
try:
|
||||
os.stat(os.path.join(odir,'Token.bin'))
|
||||
except:
|
||||
m ='Copy solc v0.5.3 contract data for token {} to directory {} and hit ENTER: '
|
||||
input(m.format(token_data['symbol'],odir))
|
||||
else:
|
||||
msg('Using precompiled contract data in {}'.format(odir))
|
||||
return 'skip'
|
||||
self.spawn('',msg_only=True)
|
||||
cmd_args = ['--{}={}'.format(k,v) for k,v in list(token_data.items())]
|
||||
|
|
|
|||
|
|
@ -118,14 +118,14 @@ class TestSuiteInput(TestSuiteBase):
|
|||
|
||||
def password_entry_noecho(self):
|
||||
if self.skip_for_win():
|
||||
msg('Perform this test by hand on MSWin (it will fail with utf8 password):')
|
||||
msg('Perform this test by hand on MSWin with non-ASCII password abc-α:')
|
||||
msg(' test/misc/password_entry.py')
|
||||
return 'skip' # getpass() can't handle utf8, and pexpect double-escapes utf8, so skip
|
||||
return self.password_entry('Enter passphrase: ',[])
|
||||
|
||||
def password_entry_echo(self):
|
||||
if self.skip_for_win():
|
||||
msg('Perform this test by hand on MSWin with utf8 password:')
|
||||
msg('Perform this test by hand on MSWin with non-ASCII password abc-α:')
|
||||
msg(' test/misc/password_entry.py --echo-passphrase')
|
||||
return 'skip' # pexpect double-escapes utf8, so skip
|
||||
return self.password_entry('Enter passphrase (echoed): ',['--echo-passphrase'])
|
||||
|
|
@ -199,7 +199,8 @@ class TestSuiteTool(TestSuiteMain,TestSuiteBase):
|
|||
vmsg('Incog ID: {}'.format(cyan(i_id)))
|
||||
t = self.spawn('mmgen-tool',['-d',self.tmpdir,'find_incog_data',f1,i_id])
|
||||
o = t.expect_getend('Incog data for ID {} found at offset '.format(i_id))
|
||||
os.unlink(f1)
|
||||
if not g.platform == 'win':
|
||||
os.unlink(f1) # causes problems with MSYS2
|
||||
cmp_or_die(hincog_offset,int(o))
|
||||
return t
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class TestSuiteRef(TestSuiteBase,TestSuiteShared):
|
|||
wf = dfl_words_file
|
||||
self.write_to_tmpfile(pwfile,wpasswd)
|
||||
pf = joinpath(self.tmpdir,pwfile)
|
||||
return self.txsign(tf,wf,pf,save=False,has_label=True,do_passwd=False)
|
||||
return self.txsign(tf,wf,pf,save=False,has_label=True,do_passwd=False,view='y')
|
||||
|
||||
def ref_brain_chk_spc3(self):
|
||||
return self.ref_brain_chk(bw_file=ref_bw_file_spc)
|
||||
|
|
|
|||
|
|
@ -151,11 +151,12 @@ class TestSuiteShared(object):
|
|||
has_label = False,
|
||||
do_passwd = True,
|
||||
extra_opts = [],
|
||||
extra_desc = '' ):
|
||||
extra_desc = '',
|
||||
view = 'n'):
|
||||
opts = extra_opts + ['-d',self.tmpdir,txfile] + ([wf] if wf else [])
|
||||
t = self.spawn('mmgen-txsign', opts, extra_desc)
|
||||
t.license()
|
||||
t.view_tx('n')
|
||||
t.view_tx(view)
|
||||
if do_passwd: t.passphrase('MMGen wallet',self.wpasswd)
|
||||
if save:
|
||||
self.txsign_end(t,has_label=has_label)
|
||||
|
|
|
|||
|
|
@ -151,16 +151,16 @@ class TestSuiteWalletConv(TestSuiteBase,TestSuiteShared):
|
|||
imsg('Creating block device image file')
|
||||
ic_img = joinpath(self.tmpdir,'hincog_blkdev_img')
|
||||
subprocess.check_output(['dd','if=/dev/zero','of='+ic_img,'bs=1K','count=1'],stderr=subprocess.PIPE)
|
||||
ic_dev = subprocess.check_output(['losetup','-f']).strip().decode()
|
||||
ic_dev = subprocess.check_output(['/sbin/losetup','-f']).strip().decode()
|
||||
ic_dev_mode_orig = '{:o}'.format(os.stat(ic_dev).st_mode & 0xfff)
|
||||
ic_dev_mode = '0666'
|
||||
imsg("Changing permissions on loop device to '{}'".format(ic_dev_mode))
|
||||
subprocess.check_output(['sudo','chmod',ic_dev_mode,ic_dev],stderr=subprocess.PIPE)
|
||||
imsg("Attaching loop device '{}'".format(ic_dev))
|
||||
subprocess.check_output(['losetup',ic_dev,ic_img])
|
||||
subprocess.check_output(['/sbin/losetup',ic_dev,ic_img])
|
||||
self.ref_hincog_conv_out(ic_f=ic_dev)
|
||||
imsg("Detaching loop device '{}'".format(ic_dev))
|
||||
subprocess.check_output(['losetup','-d',ic_dev])
|
||||
subprocess.check_output(['/sbin/losetup','-d',ic_dev])
|
||||
imsg("Resetting permissions on loop device to '{}'".format(ic_dev_mode_orig))
|
||||
subprocess.check_output(['sudo','chmod',ic_dev_mode_orig,ic_dev],stderr=subprocess.PIPE)
|
||||
return 'ok'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue