daemontest.py exec: improve availability test

This commit is contained in:
The MMGen Project 2025-09-11 17:37:09 +00:00
commit 4e44e3a929
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 25 additions and 2 deletions

View file

@ -471,6 +471,11 @@ def have_sudo(*, silent=False):
except:
return False
def in_nix_environment():
for path in os.getenv('PATH').split(':'):
if path.startswith('/nix/store/'):
return True
def cached_property(orig_func):
@property
def new_func(self):

View file

@ -8,7 +8,7 @@ from subprocess import run, PIPE
from collections import namedtuple
from mmgen.color import orange, red
from mmgen.util import fmt_list
from mmgen.util import fmt_list, in_nix_environment
from mmgen.daemon import CoinDaemon
from ..include.common import cfg, qmsg, qmsg_r, vmsg, msg, msg_r
@ -108,7 +108,25 @@ class unit_tests:
def avail(self, name, ut):
qmsg_r('Testing availability of coin daemons...')
return self._test_cmd(['start', '--print-version', '--mainnet-only'])
from platform import machine
test_reth = not (cfg.no_altcoin_deps or cfg.fast)
test_parity = not (
cfg.no_altcoin_deps
or machine() in ('riscv64', 'aarch64', 'armv7l')
or in_nix_environment())
ret1 = self._test_cmd(
['start', '--print-version', '--mainnet-only'],
network_ids = ['btc'] if cfg.no_altcoin_deps else ['btc', 'ltc', 'bch', 'xmr', 'eth'],
ok = not (test_reth or test_parity))
ret2 = self._test_cmd(
['start', '--print-version', '--mainnet-only', '--daemon-id=reth'],
network_ids = ['eth'],
ok = not test_parity) if test_reth else True
ret3 = self._test_cmd(
['start', '--print-version', '--mainnet-only'],
network_ids = ['etc'],
ok = True) if test_parity else True
return ret1 and ret2 and ret3
def versions(self, name, ut):
qmsg_r('Displaying coin daemon versions...')