diff --git a/scripts/test-release.sh b/scripts/test-release.sh index 5d8ee921..6cafe055 100755 --- a/scripts/test-release.sh +++ b/scripts/test-release.sh @@ -79,8 +79,6 @@ REFDIR='test/ref' if uname -a | grep -qi mingw; then SUDO='' MINGW=1; else SUDO='sudo' MINGW=''; fi [ "$MINGW" ] || RED="\e[31;1m" GREEN="\e[32;1m" YELLOW="\e[33;1m" RESET="\e[0m" -set -e - [ "$NO_INSTALL" ] || { BRANCH=$1; shift BRANCHES=$(git branch) @@ -88,6 +86,8 @@ set -e [ "$FOUND_BRANCH" ] || { echo "Branch '$BRANCH' not found!"; exit; } } +set -e + check() { [ "$BRANCH" ] || { echo 'No branch specified. Exiting'; exit; } [ "$(git diff $BRANCH)" == "" ] || { diff --git a/test/mmgen_pexpect.py b/test/mmgen_pexpect.py index e06ab4d6..533f24e7 100755 --- a/test/mmgen_pexpect.py +++ b/test/mmgen_pexpect.py @@ -96,7 +96,8 @@ class MMGenPexpect(object): atexit.register(lambda: os.system('stty sane')) NL = '\n' - def __init__(self,name,mmgen_cmd,cmd_args,desc,no_output=False,passthru_args=[],msg_only=False,no_msg=False): + def __init__(self,name,mmgen_cmd,cmd_args,desc, + no_output=False,passthru_args=[],msg_only=False,no_msg=False,log_fd=None): cmd_args = ['--{}{}'.format(k.replace('_','-'), '='+getattr(opt,k) if getattr(opt,k) != True else '' ) for k in passthru_args if getattr(opt,k)] \ @@ -120,7 +121,7 @@ class MMGenPexpect(object): cmd_str = fs.format(*init_coverage(),c=cmd_str) if opt.log: - log_fd.write(cmd_str+'\n') + log_fd.write(cmd_str.encode('utf8')+'\n') if not no_msg: if opt.verbose or opt.print_cmdline or opt.exact_output: diff --git a/test/test.py b/test/test.py index 9b537e66..ba1dff8f 100755 --- a/test/test.py +++ b/test/test.py @@ -1053,6 +1053,8 @@ del cmd_group if opt.profile: opt.names = True if opt.resume: opt.skip_deps = True + +log_fd = None if opt.log: log_fd = open(log_file,'a') log_fd.write('\nLog started: {}\n'.format(make_timestr())) @@ -1193,7 +1195,8 @@ class MMGenExpect(MMGenPexpect): no_output=no_output, passthru_args=passthru_args, msg_only=msg_only, - no_msg=no_msg) + no_msg=no_msg, + log_fd=log_fd) def create_fake_unspent_entry(coinaddr,al_id=None,idx=None,lbl=None,non_mmgen=False,segwit=False): if 'S' not in g.proto.mmtypes: segwit = False @@ -1739,7 +1742,7 @@ class MMGenTestSuite(object): def txsign_ui_common(self,t,name, view='t',add_comment='', ni=False,save=True,do_passwd=False, - file_desc='Signed transaction',no_ok=False): + file_desc='Signed transaction',no_ok=False,has_label=False): txdo = name[:4] == 'txdo' if do_passwd: @@ -1747,7 +1750,7 @@ class MMGenTestSuite(object): if not ni and not txdo: t.view_tx(view) - t.do_comment(add_comment) + t.do_comment(add_comment,has_label=has_label) t.expect('(Y/n): ',('n','y')[save]) t.written_to_file(file_desc) @@ -1761,13 +1764,13 @@ class MMGenTestSuite(object): def txsend_ui_common(self,t,name, view='n',add_comment='', confirm_send=True,bogus_send=True,quiet=False, - file_desc='Sent transaction',no_ok=False): + file_desc='Sent transaction',no_ok=False,has_label=False): txdo = name[:4] == 'txdo' if not txdo: t.license() # MMGEN_NO_LICENSE is set, so does nothing t.view_tx(view) - t.do_comment(add_comment) + t.do_comment(add_comment,has_label=has_label) self.do_confirm_send(t,quiet=quiet,confirm_send=confirm_send) @@ -3148,21 +3151,22 @@ class MMGenTestSuite(object): input_sels_prompt='to spend from', inputs=acct,file_desc='Ethereum transaction', bad_input_sels=True,non_mmgen_inputs=non_mmgen_inputs, - interactive_fee=interactive_fee,fee_res=fee_res,fee_desc=fee_desc) + interactive_fee=interactive_fee,fee_res=fee_res,fee_desc=fee_desc, + add_comment=ref_tx_label_jp) def ethdev_txsign(self,name,ni=False,ext='.rawtx',add_args=[]): key_fn = get_tmpfile_fn(cfg,cfg['parity_keyfile']) write_to_tmpfile(cfg,cfg['parity_keyfile'],eth_key+'\n') tx_fn = get_file_with_ext(ext,cfg['tmpdir'],no_dot=True) t = MMGenExpect(name,'mmgen-txsign',eth_args+add_args + ([],['--yes'])[ni] + ['-k',key_fn,tx_fn,dfl_words]) - self.txsign_ui_common(t,name,ni=ni) + self.txsign_ui_common(t,name,ni=ni,has_label=True) def ethdev_txsend(self,name,ni=False,bogus_send=False,ext='.sigtx',add_args=[]): tx_fn = get_file_with_ext(ext,cfg['tmpdir'],no_dot=True) if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = '' t = MMGenExpect(name,'mmgen-txsend', eth_args+add_args + [tx_fn]) if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = '1' - self.txsend_ui_common(t,name,quiet=True,bogus_send=bogus_send) + self.txsend_ui_common(t,name,quiet=True,bogus_send=bogus_send,has_label=True) def ethdev_txcreate1(self,name): menu = ['a','d','A','r','M','D','e','m','m']