From 4c9f6e7071cacc4f524198be0aa56435122ada33 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 17 Oct 2022 18:37:23 +0000 Subject: [PATCH] test.py: pass through only explicitly set opts --- mmgen/opts.py | 5 +++-- test/test.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mmgen/opts.py b/mmgen/opts.py index 4585abb5..ce730791 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -286,7 +286,8 @@ def init( parse_only = False, parsed_opts = None, need_proto = True, - do_post_init = False ): + do_post_init = False, + return_parsed = False ): if opts_data is None: opts_data = opts_data_dfl @@ -446,7 +447,7 @@ def init( else: delete_data(opts_data) - return po.cmd_args + return po if return_parsed else po.cmd_args def check_usr_opts(usr_opts): # Raises an exception if any check fails diff --git a/test/test.py b/test/test.py index 3df5b527..d4ded03e 100755 --- a/test/test.py +++ b/test/test.py @@ -183,7 +183,8 @@ opts.UserOpts._reset_ok += ( 'skipping_deps' ) # step 2: opts.init will create new data_dir in ./test (if not opt.skipping_deps) -usr_args = opts.init(opts_data) +parsed_opts = opts.init(opts_data,return_parsed=True) +usr_args = parsed_opts.cmd_args if opt.daemon_id and opt.daemon_id in g.blacklist_daemons.split(): die(0,f'test.py: daemon {opt.daemon_id!r} blacklisted, exiting') @@ -673,10 +674,11 @@ class TestSuiteRunner(object): self.ts = self.gm.gm_init_group(self,gname,sg_name,self.spawn_wrapper) self.ts_clsname = type(self.ts).__name__ + # only pass through opts that are explicitly set on cmdline (po.user_opts) self.passthru_opts = ['--{}{}'.format( k.replace('_','-'), '=' + getattr(opt,k) if getattr(opt,k) != True else '' - ) for k in self.ts.base_passthru_opts + self.ts.passthru_opts if getattr(opt,k)] + ) for k in self.ts.base_passthru_opts + self.ts.passthru_opts if k in parsed_opts.user_opts] if opt.resuming: rc = opt.resume or opt.resume_after