diff --git a/test/test-release.sh b/test/test-release.sh index c6624982..240ac8a7 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -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' diff --git a/test/test_py_d/ts_autosign.py b/test/test_py_d/ts_autosign.py index de57f980..fe718fd6 100755 --- a/test/test_py_d/ts_autosign.py +++ b/test/test_py_d/ts_autosign.py @@ -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')) diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index ce54184c..0d8491b3 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -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())] diff --git a/test/test_py_d/ts_misc.py b/test/test_py_d/ts_misc.py index f8462c0c..0dac66e2 100755 --- a/test/test_py_d/ts_misc.py +++ b/test/test_py_d/ts_misc.py @@ -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 diff --git a/test/test_py_d/ts_ref.py b/test/test_py_d/ts_ref.py index bb4826f5..2814a471 100755 --- a/test/test_py_d/ts_ref.py +++ b/test/test_py_d/ts_ref.py @@ -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) diff --git a/test/test_py_d/ts_shared.py b/test/test_py_d/ts_shared.py index 67722448..942f00a2 100755 --- a/test/test_py_d/ts_shared.py +++ b/test/test_py_d/ts_shared.py @@ -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) diff --git a/test/test_py_d/ts_wallet.py b/test/test_py_d/ts_wallet.py index 951ff906..d11000e6 100755 --- a/test/test_py_d/ts_wallet.py +++ b/test/test_py_d/ts_wallet.py @@ -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'