test-release.sh: start/stop monerod automatically
This commit is contained in:
parent
76925c0d5b
commit
adc5bc6e36
2 changed files with 14 additions and 8 deletions
|
|
@ -888,19 +888,23 @@ class MMGenToolCmdMonero(MMGenToolCmdBase):
|
|||
"sync Monero wallets from key-address list"
|
||||
return self.monero_wallet_ops(infile=xmr_keyaddrfile,op='sync',addrs=addrs)
|
||||
|
||||
def monero_wallet_ops(self,infile:str,op:str,blockheight=0,addrs=''):
|
||||
def monero_wallet_ops(self,infile:str,op:str,blockheight=0,addrs='',monerod_args=[],wallet_cli_args=[]):
|
||||
|
||||
exit_if_mswin('Monero wallet operations')
|
||||
|
||||
if opt.rpc_port:
|
||||
monerod_args = ['--rpc-bind-port={}'.format(opt.rpc_port)]
|
||||
wallet_cli_args = ['--daemon-address=localhost:{}'.format(opt.rpc_port)]
|
||||
|
||||
def run_cmd(cmd):
|
||||
from subprocess import run,PIPE,DEVNULL
|
||||
return run(cmd,stdout=PIPE,stderr=DEVNULL,check=True)
|
||||
|
||||
def test_rpc():
|
||||
cp = run_cmd(['monero-wallet-cli','--version'])
|
||||
cp = run_cmd(['monero-wallet-cli'] + wallet_cli_args + ['--version'])
|
||||
if not b'Monero' in cp.stdout:
|
||||
die(1,"Unable to run 'monero-wallet-cli'!")
|
||||
cp = run_cmd(['monerod','status'])
|
||||
cp = run_cmd(['monerod'] + monerod_args + ['status'])
|
||||
import re
|
||||
m = re.search(r'Height: (\d+)/\d+ ',cp.stdout.decode())
|
||||
if not m:
|
||||
|
|
@ -934,7 +938,7 @@ class MMGenToolCmdMonero(MMGenToolCmdBase):
|
|||
try: os.stat(fn)
|
||||
except: pass
|
||||
else: die(1,"Wallet '{}' already exists!".format(fn))
|
||||
p = pexpect.spawn('monero-wallet-cli --generate-from-spend-key {}'.format(fn))
|
||||
p = pexpect.spawn('monero-wallet-cli', wallet_cli_args + ['--generate-from-spend-key',fn])
|
||||
# if g.debug: p.logfile = sys.stdout # TODO: Error: 'write() argument must be str, not bytes'
|
||||
my_expect(p,'Awaiting initial prompt','Secret spend key: ')
|
||||
my_sendline(p,'',d.sec,65)
|
||||
|
|
@ -971,7 +975,7 @@ class MMGenToolCmdMonero(MMGenToolCmdBase):
|
|||
import time
|
||||
try: os.stat(fn)
|
||||
except: die(1,"Wallet '{}' does not exist!".format(fn))
|
||||
p = pexpect.spawn('monero-wallet-cli --wallet-file={}'.format(fn))
|
||||
p = pexpect.spawn('monero-wallet-cli', wallet_cli_args + ['--wallet-file={}'.format(fn)])
|
||||
# if g.debug: p.logfile = sys.stdout # TODO: Error: 'write() argument must be str, not bytes'
|
||||
my_expect(p,'Awaiting password prompt','Wallet password: ')
|
||||
my_sendline(p,'Sending password',d.wallet_passwd,33)
|
||||
|
|
|
|||
|
|
@ -325,12 +325,13 @@ t_xmr="
|
|||
cs2=\$(mmgen-tool -q --accept-defaults --coin=xmr keyaddrfile_chksum $TMPDIR/*-XMR*.akeys)
|
||||
[ \"\$cs1\" == \"\$cs2\" ]
|
||||
"
|
||||
f_xmr='You may stop the Monero mainnet daemon if you wish'
|
||||
f_xmr='Monero tests completed'
|
||||
|
||||
mmgen_tool_xmr="$mmgen_tool -q --accept-defaults --outdir $TMPDIR"
|
||||
mmgen_tool_xmr="$mmgen_tool --rpc-port=18181 -q --accept-defaults --outdir $TMPDIR"
|
||||
|
||||
[ "$MSYS2" ] || { # password file descriptor issues, cannot use popen_spawn()
|
||||
t_xmr+="
|
||||
test/start-coin-daemons.py xmr
|
||||
$mmgen_tool_xmr keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys addrs=23
|
||||
$mmgen_tool_xmr keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys addrs=103-200
|
||||
rm $TMPDIR/*-MoneroWallet*
|
||||
|
|
@ -338,10 +339,11 @@ $mmgen_tool_xmr keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys
|
|||
$mmgen_tool_xmr syncmonerowallets $TMPDIR/*-XMR*.akeys addrs=3
|
||||
$mmgen_tool_xmr syncmonerowallets $TMPDIR/*-XMR*.akeys addrs=23-29
|
||||
$mmgen_tool_xmr syncmonerowallets $TMPDIR/*-XMR*.akeys
|
||||
test/stop-coin-daemons.py -W xmr
|
||||
"
|
||||
}
|
||||
|
||||
[ "$xmr_addrs" == '3,23' ] && t_xmr_skip='4 8 13'
|
||||
[ "$xmr_addrs" == '3,23' ] && t_xmr_skip='4 9 14'
|
||||
|
||||
i_eth='Ethereum'
|
||||
s_eth='Testing transaction and tracking wallet operations for Ethereum and Ethereum Classic'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue