From 3d435165a7432aed1d4153593728bd962f76915e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 5 Oct 2026 14:30:05 +0000 Subject: [PATCH] cfg: restore `exec_wrapper` and `devtools` config vars --- mmgen/cfg.py | 4 ++++ mmgen/main.py | 2 +- scripts/exec_wrapper.py | 4 ++-- test/cmdtest.py | 4 ++-- test/cmdtest_d/include/runner.py | 4 ++-- test/include/test_init.py | 2 +- test/include/unit_test.py | 2 +- test/objtest.py | 2 +- test/overlay/fakemods/mmgen/cfg.py | 4 ---- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index 4f172b39..f5678ac6 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -211,6 +211,8 @@ class Config(Lockable): debug_subseed = False debug_tw = False traceback = False + exec_wrapper = False + devtools = False # rpc: rpc_host = '' @@ -335,8 +337,10 @@ class Config(Lockable): 'MMGEN_DEBUG_RPC', 'MMGEN_DEBUG_SUBSEED', 'MMGEN_DEBUG_TW', + 'MMGEN_DEVTOOLS', 'MMGEN_DISABLE_COLOR', 'MMGEN_ENABLE_ERIGON', + 'MMGEN_EXEC_WRAPPER', 'MMGEN_FORCE_256_COLOR', 'MMGEN_HTTP_TIMEOUT', 'MMGEN_IGNORE_DAEMON_VERSION', diff --git a/mmgen/main.py b/mmgen/main.py index 5ee8c2b9..a1a57e14 100755 --- a/mmgen/main.py +++ b/mmgen/main.py @@ -66,7 +66,7 @@ def launch(*, mod=None, func=None, fqmod=None, package='mmgen'): e = e)) + '\n') - if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') or os.getenv('MMGEN_TRACEBACK'): + if os.getenv('MMGEN_EXEC_WRAPPER') or os.getenv('MMGEN_TRACEBACK'): raise sys.exit(d.exit_val) diff --git a/scripts/exec_wrapper.py b/scripts/exec_wrapper.py index 2bc1411a..86c1326d 100755 --- a/scripts/exec_wrapper.py +++ b/scripts/exec_wrapper.py @@ -35,7 +35,7 @@ def exec_wrapper_init(): else: exec_wrapper_sys.path.pop(0) - exec_wrapper_os.environ['MMGEN_TEST_SUITE_EXEC_WRAPPER'] = '1' + exec_wrapper_os.environ['MMGEN_EXEC_WRAPPER'] = '1' def exec_wrapper_write_traceback(e, exit_val): @@ -142,7 +142,7 @@ if exec_wrapper_os.getenv('MMGEN_TRACEMALLOC'): exec_wrapper_tracemalloc_setup() # import mmgen mods only after sys.path[0] is set to overlay root! -if exec_wrapper_os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'): +if exec_wrapper_os.getenv('MMGEN_DEVTOOLS'): from mmgen.devinit import init_dev as exec_wrapper_init_dev exec_wrapper_init_dev() diff --git a/test/cmdtest.py b/test/cmdtest.py index 2a9515ce..e4dc3a1a 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -318,7 +318,7 @@ if __name__ == '__main__': die(1, yellow('\ntest.py exiting at user request')) except TestSuiteSpawnedScriptException as e: # if spawned script is not running under exec_wrapper, output brief error msg: - if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER'): + if os.getenv('MMGEN_EXEC_WRAPPER'): Msg(red(str(e))) Msg(blue('cmdtest.py: spawned script exited with error')) if hasattr(tr, 'tg'): @@ -332,6 +332,6 @@ if __name__ == '__main__': del tr.tg del tr # if cmdtest.py itself is running under exec_wrapper, re-raise so wrapper can handle exception: - if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') or not os.getenv('MMGEN_TEST_SUITE_IGNORE_TEST_PY_EXCEPTION'): + if os.getenv('MMGEN_EXEC_WRAPPER') or not os.getenv('MMGEN_TEST_SUITE_IGNORE_TEST_PY_EXCEPTION'): raise die(1, red('Test script exited with error')) diff --git a/test/cmdtest_d/include/runner.py b/test/cmdtest_d/include/runner.py index 10b26509..0cd6f048 100755 --- a/test/cmdtest_d/include/runner.py +++ b/test/cmdtest_d/include/runner.py @@ -64,7 +64,7 @@ class CmdTestRunner: self.skipped_warnings = [] self.resume_cmd = None self.deps_only = None - self.logging = self.cfg.log or os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') + self.logging = self.cfg.log or os.getenv('MMGEN_EXEC_WRAPPER') self.testing_segwit = cfg.segwit or cfg.segwit_random or cfg.bech32 self.network_id = self.proto.coin.lower() + ('_tn' if self.proto.testnet else '') self.daemon_started = False @@ -114,7 +114,7 @@ class CmdTestRunner: 'MMGEN_TEST_SUITE_PEXPECT': '1', 'EXEC_WRAPPER_DO_RUNTIME_MSG':'1', # if cmdtest.py itself is running under exec_wrapper, disable writing of traceback file for spawned script - 'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_TEST_SUITE_EXEC_WRAPPER') else '1'}) + 'EXEC_WRAPPER_TRACEBACK': '' if os.getenv('MMGEN_EXEC_WRAPPER') else '1'}) if self.cfg.dev_mode: self.spawn_env.update({ diff --git a/test/include/test_init.py b/test/include/test_init.py index 1c8e53ef..d0fc41f2 100755 --- a/test/include/test_init.py +++ b/test/include/test_init.py @@ -25,6 +25,6 @@ os.environ['PYTHONPATH'] = overlay_root if 'TMUX' in os.environ: del os.environ['TMUX'] -if os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'): +if os.getenv('MMGEN_DEVTOOLS'): from mmgen.devinit import init_dev init_dev() diff --git a/test/include/unit_test.py b/test/include/unit_test.py index 00a20cb4..f7634885 100755 --- a/test/include/unit_test.py +++ b/test/include/unit_test.py @@ -26,7 +26,7 @@ os.environ['MMGEN_TEST_SUITE_LEGACY_TX'] = '1' from .test_init import repo_root -if not os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'): +if not os.getenv('MMGEN_DEVTOOLS'): from mmgen.devinit import init_dev init_dev() diff --git a/test/objtest.py b/test/objtest.py index ce607068..ad743a49 100755 --- a/test/objtest.py +++ b/test/objtest.py @@ -30,7 +30,7 @@ except ImportError: # for objtest, violate MMGen Project best practices and allow use of the dev tools # in production code: from mmgen.devtools import pmsg -if not os.getenv('MMGEN_TEST_SUITE_DEVTOOLS'): +if not os.getenv('MMGEN_DEVTOOLS'): from mmgen.devinit import init_dev init_dev() diff --git a/test/overlay/fakemods/mmgen/cfg.py b/test/overlay/fakemods/mmgen/cfg.py index 0437a7f4..efdc8b2b 100644 --- a/test/overlay/fakemods/mmgen/cfg.py +++ b/test/overlay/fakemods/mmgen/cfg.py @@ -40,12 +40,10 @@ for k, v in { # these are referenced in test suite only: 'test_suite_autosign_led_simulate': False, - 'test_suite_exec_wrapper': False, 'test_suite_bogus_unspent_data': '', 'test_suite_debug_utf8': False, 'test_suite_deterministic': False, 'test_suite_devnet_block_period': 0, - 'test_suite_devtools': False, 'test_suite_enable_color': False, 'test_suite_enable_user_port_shift': False, 'test_suite_ignore_test_py_exception': False, @@ -66,10 +64,8 @@ Config._env_opts += ( 'MMGEN_TEST_SUITE_DEBUG_UTF8', 'MMGEN_TEST_SUITE_DETERMINISTIC', 'MMGEN_TEST_SUITE_DEVNET_BLOCK_PERIOD', - 'MMGEN_TEST_SUITE_DEVTOOLS', 'MMGEN_TEST_SUITE_ENABLE_COLOR', 'MMGEN_TEST_SUITE_ENABLE_USER_PORT_SHIFT', - 'MMGEN_TEST_SUITE_EXEC_WRAPPER', # main - using os.getenv() - OK 'MMGEN_TEST_SUITE_HOLD_PROTECT_DISABLE', 'MMGEN_TEST_SUITE_IGNORE_TEST_PY_EXCEPTION', 'MMGEN_TEST_SUITE_LEGACY_TX',