Browse Source

support node tools unit tests

The MMGen Project 4 years ago
parent
commit
3b6f3ef3b0
2 changed files with 8 additions and 4 deletions
  1. 2 1
      test/test-release.sh
  2. 6 3
      test/unit_tests.py

+ 2 - 1
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}"

+ 6 - 3
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):