Windows and Windows testing fixes
This commit is contained in:
parent
23457774e2
commit
feffc45fd5
10 changed files with 31 additions and 12 deletions
|
|
@ -60,8 +60,10 @@ def get_terminfo_colors(term=None):
|
|||
try:
|
||||
cmdout = run(cmd,stdout=PIPE,check=True).stdout.decode()
|
||||
except:
|
||||
set_vt100()
|
||||
return None
|
||||
else:
|
||||
set_vt100()
|
||||
s = [e.split('#')[1] for e in cmdout.split(',') if e.startswith('colors')][0]
|
||||
from .util import is_hex_str
|
||||
if s.isdecimal():
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from subprocess import run,PIPE,CompletedProcess
|
|||
from collections import namedtuple
|
||||
|
||||
from .globalvars import g
|
||||
from .color import set_vt100
|
||||
from .util import msg,Msg_r,die
|
||||
from .flags import *
|
||||
|
||||
|
|
@ -79,6 +80,7 @@ class Daemon(Lockable):
|
|||
cp = run(cmd,check=False,stdout=out,stderr=out)
|
||||
except Exception as e:
|
||||
die( 'MMGenCalledProcessError', f'Error starting executable: {type(e).__name__} [Errno {e.errno}]' )
|
||||
set_vt100()
|
||||
if self.debug:
|
||||
print(cp)
|
||||
return cp
|
||||
|
|
@ -425,9 +427,10 @@ class CoinDaemon(Daemon):
|
|||
"remove the network's datadir"
|
||||
assert self.test_suite, 'datadir removal restricted to test suite'
|
||||
if self.state == 'stopped':
|
||||
try: # exception handling required for MSWin/MSYS2
|
||||
run(['/bin/rm','-rf',self.network_datadir])
|
||||
except:
|
||||
pass
|
||||
run([
|
||||
('rm' if g.platform == 'win' else '/bin/rm'),
|
||||
'-rf',
|
||||
self.datadir ])
|
||||
set_vt100()
|
||||
else:
|
||||
msg(f'Cannot remove {self.network_datadir!r} - daemon is not stopped')
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ fileutil.py: Routines that read, write, execute or stat files
|
|||
import sys,os
|
||||
|
||||
from .globalvars import g
|
||||
from .color import set_vt100
|
||||
from .util import (
|
||||
msg,
|
||||
qmsg,
|
||||
|
|
@ -43,10 +44,11 @@ def check_or_create_dir(path):
|
|||
except:
|
||||
if os.getenv('MMGEN_TEST_SUITE'):
|
||||
from subprocess import run
|
||||
try: # exception handling required for MSWin/MSYS2
|
||||
run(['/bin/rm','-rf',path])
|
||||
except:
|
||||
pass
|
||||
run([
|
||||
('rm' if g.platform == 'win' else '/bin/rm'),
|
||||
'-rf',
|
||||
path ])
|
||||
set_vt100()
|
||||
try:
|
||||
os.makedirs(path,0o700)
|
||||
except:
|
||||
|
|
@ -58,6 +60,7 @@ def check_binary(args):
|
|||
run(args,stdout=DEVNULL,stderr=DEVNULL,check=True)
|
||||
except:
|
||||
die(2,f'{args[0]!r} binary missing, not in path, or not executable')
|
||||
set_vt100()
|
||||
|
||||
def shred_file(fn,verbose=False):
|
||||
check_binary(['shred','--version'])
|
||||
|
|
@ -67,6 +70,7 @@ def shred_file(fn,verbose=False):
|
|||
+ (['--verbose'] if verbose else [])
|
||||
+ [fn],
|
||||
check=True )
|
||||
set_vt100()
|
||||
|
||||
def _check_file_type_and_access(fname,ftype,blkdev_ok=False):
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,9 @@ class RPCBackends:
|
|||
dmsg_rpc(' RPC curl exec data ==>\n{}\n',exec_cmd)
|
||||
|
||||
from subprocess import run,PIPE
|
||||
from .color import set_vt100
|
||||
res = run(exec_cmd,stdout=PIPE,check=True).stdout.decode()
|
||||
set_vt100()
|
||||
# res = run(exec_cmd,stdout=PIPE,check=True,text='UTF-8').stdout # Python 3.7+
|
||||
return (res[:-3],int(res[-3:]))
|
||||
|
||||
|
|
|
|||
|
|
@ -607,6 +607,7 @@ def do_pager(text):
|
|||
pagers = [os.environ['PAGER']] + pagers
|
||||
|
||||
from subprocess import run
|
||||
from .color import set_vt100
|
||||
for pager in pagers:
|
||||
try:
|
||||
m = text + ('' if pager == 'less' else end_msg)
|
||||
|
|
@ -618,6 +619,7 @@ def do_pager(text):
|
|||
break
|
||||
else:
|
||||
Msg(text+end_msg)
|
||||
set_vt100()
|
||||
|
||||
def do_license_msg(immed=False):
|
||||
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -19,7 +19,7 @@ def build_libsecp256k1():
|
|||
'Windows': (
|
||||
['sh','./autogen.sh'],
|
||||
['sh','./configure','CFLAGS=-g -O2 -fPIC','--disable-dependency-tracking'],
|
||||
['mingw32-make']
|
||||
['mingw32-make','MAKE=mingw32-make']
|
||||
),
|
||||
'Linux': (
|
||||
['./autogen.sh'],
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ def test_color():
|
|||
for t,c in (('rxvt',8),('xterm',8),('rxvt-unicode',88),('screen-256color',256),('xterm-256color',256)):
|
||||
ret = get_terminfo_colors(t)
|
||||
if ret == None:
|
||||
set_vt100()
|
||||
ymsg(f'Warning: unable to get info for terminal {t!r}')
|
||||
continue
|
||||
msg(f'{t}: {orange(str(ret))}')
|
||||
|
|
@ -37,6 +36,5 @@ def test_color():
|
|||
|
||||
ret = get_terminfo_colors()
|
||||
msg(f'{os.getenv("TERM")} (this terminal): {orange(str(ret))}')
|
||||
set_vt100()
|
||||
|
||||
test_color()
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ noalt_tests='dep misc obj color unit hash ref autosign_btc btc btc_tn btc_rt too
|
|||
quick_tests='dep misc obj color unit hash ref altref alts xmr eth autosign btc btc_rt tool tool2 gen'
|
||||
qskip_tests='btc_tn bch bch_rt ltc ltc_rt'
|
||||
|
||||
[ "$MSYS2" ] && SKIP_LIST='autosign autosign_btc autosign_live'
|
||||
|
||||
PROGNAME=$(basename $0)
|
||||
while getopts hAbCdDfFi:I:lNOps:tvV OPT
|
||||
do
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ class TestSuiteAutosignBase(TestSuiteBase):
|
|||
super().__init__(trunner,cfgs,spawn)
|
||||
if trunner == None:
|
||||
return
|
||||
if g.platform == 'win':
|
||||
die(1,f'Test {type(self).__name__} not supported for Windows platform')
|
||||
self.network_ids = [c+'_tn' for c in self.daemon_coins] + self.daemon_coins
|
||||
|
||||
if self.simulate and not opt.exact_output:
|
||||
|
|
@ -124,6 +126,8 @@ class TestSuiteAutosignBase(TestSuiteBase):
|
|||
self.bad_msg_count = 0
|
||||
|
||||
def __del__(self):
|
||||
if g.platform == 'win':
|
||||
return
|
||||
if self.simulate or not self.live:
|
||||
LEDControl.delete_dummy_control_files()
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,12 @@ class TestSuiteInput(TestSuiteBase):
|
|||
def get_seed_from_stdin(self):
|
||||
self.spawn('',msg_only=True)
|
||||
from subprocess import run,PIPE
|
||||
cmd = ['cmds/mmgen-walletconv','--in-fmt=words','--out-fmt=bip39','--outdir=test/trash']
|
||||
cmd = ['python3','cmds/mmgen-walletconv','--in-fmt=words','--out-fmt=bip39','--outdir=test/trash']
|
||||
mn = sample_mn['mmgen']['mn']
|
||||
os.environ['MMGEN_TEST_SUITE'] = ''
|
||||
cp = run( cmd, input=mn.encode(), stdout=PIPE, stderr=PIPE )
|
||||
from mmgen.color import set_vt100
|
||||
set_vt100()
|
||||
os.environ['MMGEN_TEST_SUITE'] = '1'
|
||||
assert b'written to file' in cp.stderr, "test 'get_seed_from_stdin' failed"
|
||||
imsg(cp.stderr.decode().strip())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue