test suite: add autosign_data_dir
This commit is contained in:
parent
6b4841e760
commit
673da14a9f
6 changed files with 16 additions and 9 deletions
|
|
@ -43,12 +43,13 @@ if os.path.exists(overlay_tree_dir):
|
|||
rmtree(overlay_tree_dir, ignore_errors=True)
|
||||
print(f'Removed {os.path.relpath(overlay_tree_dir)!r}')
|
||||
|
||||
from test.include.common import clean, set_globals, trash_dir, trash_dir2
|
||||
from test.include.common import clean, set_globals, autosign_data_dir, trash_dir, trash_dir2
|
||||
|
||||
set_globals(cfg)
|
||||
|
||||
extra_dirs = [
|
||||
Config.test_datadir,
|
||||
autosign_data_dir,
|
||||
trash_dir,
|
||||
trash_dir2]
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ def check_segwit_opts(proto):
|
|||
if getattr(cfg, k) and m not in proto.mmtypes:
|
||||
die(1, f'--{k.replace("_", "-")} option incompatible with {proto.cls_name}')
|
||||
|
||||
def create_shm_dir(data_dir, trash_dir, trash_dir2):
|
||||
def create_shm_dir(data_dir, autosign_data_dir, trash_dir, trash_dir2):
|
||||
# Laggy flash media can cause pexpect to fail, so create a temporary directory
|
||||
# under '/dev/shm' and put datadir and tmpdirs here.
|
||||
import shutil
|
||||
from subprocess import run
|
||||
if gc.platform in ('win32', 'darwin'):
|
||||
for tdir in (data_dir, trash_dir, trash_dir2):
|
||||
for tdir in (data_dir, autosign_data_dir, trash_dir, trash_dir2):
|
||||
try:
|
||||
os.listdir(tdir)
|
||||
except:
|
||||
|
|
@ -61,7 +61,7 @@ def create_shm_dir(data_dir, trash_dir, trash_dir2):
|
|||
except Exception as e:
|
||||
die(2, f'Unable to create temporary directory in {tdir} ({e.args[0]})')
|
||||
|
||||
for tdir in (trash_dir, trash_dir2):
|
||||
for tdir in (autosign_data_dir, trash_dir, trash_dir2):
|
||||
dest = os.path.join(shm_dir, os.path.basename(tdir))
|
||||
os.mkdir(dest, 0o755)
|
||||
|
||||
|
|
@ -91,6 +91,7 @@ from test.include.common import (
|
|||
cmdtest_py_log_fn,
|
||||
cmdtest_py_error_fn,
|
||||
mk_tmpdir,
|
||||
autosign_data_dir,
|
||||
trash_dir,
|
||||
trash_dir2,
|
||||
stop_test_daemons)
|
||||
|
|
@ -182,7 +183,7 @@ data_dir = Config.test_datadir
|
|||
|
||||
# step 1: delete data_dir symlink in ./test;
|
||||
if not po.user_opts.get('skip_deps'):
|
||||
for fn in (data_dir,):
|
||||
for fn in (data_dir, autosign_data_dir):
|
||||
try:
|
||||
os.unlink(fn)
|
||||
except:
|
||||
|
|
@ -217,7 +218,7 @@ if cfg.daemon_id and cfg.daemon_id in cfg.blacklisted_daemons.split():
|
|||
|
||||
# step 3: move data_dir to /dev/shm and symlink it back to ./test:
|
||||
if not cfg.skipping_deps:
|
||||
shm_dir = create_shm_dir(data_dir, trash_dir, trash_dir2)
|
||||
shm_dir = create_shm_dir(data_dir, autosign_data_dir, trash_dir, trash_dir2)
|
||||
|
||||
check_segwit_opts(cfg._proto)
|
||||
|
||||
|
|
@ -289,7 +290,7 @@ if __name__ == '__main__':
|
|||
from test.cmdtest_d.include.runner import CmdTestRunner
|
||||
|
||||
try:
|
||||
tr = CmdTestRunner(cfg, repo_root, data_dir, trash_dir, trash_dir2)
|
||||
tr = CmdTestRunner(cfg, repo_root, data_dir, autosign_data_dir, trash_dir, trash_dir2)
|
||||
tr.run_tests(cmd_args)
|
||||
tr.print_warnings()
|
||||
if tr.daemon_started and not cfg.no_daemon_stop:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ from ..include.common import (
|
|||
oqmsg_r,
|
||||
start_test_daemons,
|
||||
stop_test_daemons,
|
||||
autosign_data_dir,
|
||||
joinpath,
|
||||
imsg,
|
||||
read_from_file,
|
||||
|
|
@ -619,6 +620,8 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase):
|
|||
'mmgen-autosign',
|
||||
(opts or self.opts)
|
||||
+ add_opts
|
||||
# ensure that changes to online cfg file don’t affect autosign:
|
||||
+ [f'--data-dir={autosign_data_dir}']
|
||||
+ ['--full-summary', 'wait'],
|
||||
direct_exec = True,
|
||||
no_passthru_opts = True,
|
||||
|
|
|
|||
|
|
@ -48,11 +48,12 @@ class CmdTestRunner:
|
|||
if self.logging:
|
||||
self.log_fd.close()
|
||||
|
||||
def __init__(self, cfg, repo_root, data_dir, trash_dir, trash_dir2):
|
||||
def __init__(self, cfg, repo_root, data_dir, autosign_data_dir, trash_dir, trash_dir2):
|
||||
|
||||
self.cfg = cfg
|
||||
self.proto = cfg._proto
|
||||
self.data_dir = data_dir
|
||||
self.autosign_data_dir = autosign_data_dir
|
||||
self.trash_dir = trash_dir
|
||||
self.trash_dir2 = trash_dir2
|
||||
self.cmd_total = 0
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class CmdTestSwapMethods:
|
|||
'exit_after': None,
|
||||
'log': None} | add_cfg)
|
||||
t = trunner
|
||||
ret = CmdTestRunner(cfg, t.repo_root, t.data_dir, t.trash_dir, t.trash_dir2)
|
||||
ret = CmdTestRunner(cfg, t.repo_root, t.data_dir, t.autosign_data_dir, t.trash_dir, t.trash_dir2)
|
||||
ret.init_group(self.cross_group)
|
||||
ret.parent_group = self
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ def set_globals(cfg):
|
|||
def strip_ansi_escapes(s):
|
||||
return re.sub('\x1b' + r'\[[;0-9]+?m', '', s)
|
||||
|
||||
autosign_data_dir = os.path.join('test', 'tmp', 'autosign_data_dir')
|
||||
trash_dir = os.path.join('test', 'tmp', 'trash')
|
||||
trash_dir2 = os.path.join('test', 'tmp', 'trash2')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue