From 3b6f3ef3b0a34ff268a225230dc2dca625f577af Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 18 Mar 2021 12:35:51 +0000 Subject: [PATCH] support node tools unit tests --- test/test-release.sh | 3 ++- test/unit_tests.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/test-release.sh b/test/test-release.sh index 57c6baf3..2baa18ce 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -131,7 +131,8 @@ do R) NO_TMPFILE_REMOVAL=1 ;; t) LIST_CMDS=1 ;; v) EXACT_OUTPUT=1 test_py+=" --exact-output" ;& - V) VERBOSE=1 [ "$EXACT_OUTPUT" ] || test_py+=" --verbose" + V) VERBOSE=1 + [ "$EXACT_OUTPUT" ] || test_py+=" --verbose" unit_tests_py="${unit_tests_py/--quiet/--verbose}" altcoin_py="${altcoin_py/--quiet/--verbose}" tooltest2_py="${tooltest2_py/--quiet/--verbose}" diff --git a/test/unit_tests.py b/test/unit_tests.py index dbfe3575..2bdd5f9c 100755 --- a/test/unit_tests.py +++ b/test/unit_tests.py @@ -35,6 +35,7 @@ opts_data = { -A, --no-daemon-autostart Don't start and stop daemons automatically -D, --no-daemon-stop Don't stop auto-started daemons after running tests -f, --fast Speed up execution by reducing rounds on some tests +-n, --node-tools Select node-tools unit tests -l, --list List available tests -n, --names Print command names instead of descriptions -q, --quiet Produce quieter output @@ -49,12 +50,14 @@ If no test is specified, all available tests are run sys.argv.insert(1,'--skip-cfg-file') cmd_args = opts.init(opts_data) +file_pfx = 'nt_' if opt.node_tools else 'ut_' + def exit_msg(): t = int(time.time()) - start_time - gmsg('All requested tests finished OK, elapsed time: {:02}:{:02}'.format(t//60,t%60)) + gmsg('All requested unit tests finished OK, elapsed time: {:02}:{:02}'.format(t//60,t%60)) all_tests = sorted( - [fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == 'ut_']) + [fn[3:-3] for fn in os.listdir(os.path.join(repo_root,'test','unit_tests_d')) if fn[:3] == file_pfx]) start_time = int(time.time()) @@ -85,7 +88,7 @@ class UnitTestHelpers(object): rdie(3,m_noraise.format(desc,exc_chk)) def run_test(test,subtest=None): - modname = 'test.unit_tests_d.ut_{}'.format(test) + modname = 'test.unit_tests_d.{}{}'.format(file_pfx,test) mod = importlib.import_module(modname) def run_subtest(subtest):