add ethkey dependency test

This commit is contained in:
The MMGen Project 2022-05-06 12:52:40 +00:00
commit 1eabba00a8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 19 additions and 3 deletions

View file

@ -28,7 +28,7 @@ sys.path.insert(0,overlay_setup(repo_root))
# Import these _after_ local path's been added to sys.path
from mmgen.common import *
from test.include.common import getrand
from test.include.common import getrand,get_ethkey
results_file = 'gentest.out.json'
@ -166,8 +166,13 @@ class GenTool(object):
class GenToolEthkey(GenTool):
desc = 'ethkey'
def __init__(self,*args,**kwargs):
self.cmdname = get_ethkey()
return super().__init__(*args,**kwargs)
def run(self,sec,vcoin):
o = get_cmd_output(['ethkey','info',sec.hex()])
o = get_cmd_output([self.cmdname,'info',sec.hex()])
return gtr(
o[0].split()[1],
o[-1].split()[1],

View file

@ -249,3 +249,13 @@ def check_solc_ver():
omsg(yellow('Warning: Solidity compiler (solc) could not be executed or has unsupported version'))
omsg(res)
return False
def get_ethkey():
cmdnames = ('ethkey','openethereum-ethkey')
for cmdname in cmdnames:
try: run([cmdname,'--help'],stdout=PIPE)
except: pass
else:
return cmdname
else:
die(1,f'ethkey executable not found (tried {cmdnames})')

View file

@ -48,7 +48,8 @@ class unit_tests:
return True
def ethkey(self,name,ut):
res = run(['ethkey','generate','random'],stdout=PIPE)
from test.include.common import get_ethkey
get_ethkey()
return True
def ssh_socks_proxy(self,name,ut):