Browse Source

release/testing: minor fixes and improvements

The MMGen Project 5 years ago
parent
commit
9a4920a1b5

+ 2 - 0
MANIFEST.in

@@ -4,6 +4,7 @@ include doc/wiki/using-mmgen/*
 include test/*.py
 include test/*.py
 include test/test_py_d/*.py
 include test/test_py_d/*.py
 include test/objtest_py_d/*.py
 include test/objtest_py_d/*.py
+include test/objattrtest_py_d/*.py
 include test/unit_tests_d/*.py
 include test/unit_tests_d/*.py
 include test/ref/*
 include test/ref/*
 include test/ref/litecoin/*
 include test/ref/litecoin/*
@@ -21,6 +22,7 @@ include mmgen/altcoins/eth/pyethereum/LICENSE
 
 
 include scripts/compute-file-chksum.py
 include scripts/compute-file-chksum.py
 include scripts/create-token.py
 include scripts/create-token.py
+include scripts/traceback_run.py
 include scripts/uninstall-mmgen.py
 include scripts/uninstall-mmgen.py
 
 
 prune test/ref/__db*
 prune test/ref/__db*

+ 1 - 1
doc/release-notes/release-notes-v0.12.0.md

@@ -22,7 +22,7 @@
 
 
 This release has been tested on the following platforms:
 This release has been tested on the following platforms:
 
 
-		Debian Buster / x86_64
+        Debian Buster / x86_64
         Windows 10 Enterprise Eng. / MSYS2 / qemu-x86_64
         Windows 10 Enterprise Eng. / MSYS2 / qemu-x86_64
 
 
 and with the following coin daemon versions:
 and with the following coin daemon versions:

+ 4 - 0
mmgen/altcoin.py

@@ -27,6 +27,10 @@ altcoin.py - Coin constants for Bitcoin-derived altcoins
 #   wn: https://walletgenerator.net
 #   wn: https://walletgenerator.net
 #   cc: https://www.cryptocompare.com/api/data/coinlist/ (names,symbols only)
 #   cc: https://www.cryptocompare.com/api/data/coinlist/ (names,symbols only)
 
 
+# BIP44
+# https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
+# BIP44 registered coin types: https://github.com/satoshilabs/slips/blob/master/slip-0044.md
+
 # WIP:
 # WIP:
 #   NSR:  149/191 c/u,  63/('S'),  64/('S'|'T')
 #   NSR:  149/191 c/u,  63/('S'),  64/('S'|'T')
 #   NBT:  150/191 c/u,  25/('B'),  26/('B')
 #   NBT:  150/191 c/u,  25/('B'),  26/('B')

+ 4 - 1
mmgen/daemon.py

@@ -137,7 +137,10 @@ class Daemon(MMGenObject):
 		else:
 		else:
 			if not silent:
 			if not silent:
 				msg('{} {} not running'.format(self.net_desc,self.desc))
 				msg('{} {} not running'.format(self.net_desc,self.desc))
-		# rm -rf $datadir
+
+	def restart(self,silent=False):
+		self.stop(silent=silent)
+		return self.start(silent=silent)
 
 
 	def wait_for_state(self,req_state):
 	def wait_for_state(self,req_state):
 		for i in range(200):
 		for i in range(200):

+ 1 - 1
mmgen/main_passgen.py

@@ -28,7 +28,7 @@ from mmgen.seed import SeedSource
 from mmgen.obj import MMGenPWIDString
 from mmgen.obj import MMGenPWIDString
 
 
 pwi = PasswordList.pw_info
 pwi = PasswordList.pw_info
-pwi_fs = '{:5} {:1} {:26} {:<7}  {:<7}  {}'
+pwi_fs = '{:8} {:1} {:26} {:<7}  {:<7}  {}'
 
 
 opts_data = {
 opts_data = {
 	'sets': [('print_checksum',True,'quiet',True)],
 	'sets': [('print_checksum',True,'quiet',True)],

+ 3 - 2
mmgen/opts.py

@@ -323,8 +323,9 @@ def init(opts_data,add_opts=[],opt_filter=None,parse_only=False):
 
 
 	if hasattr(g,'cfg_options_changed'):
 	if hasattr(g,'cfg_options_changed'):
 		ymsg("Warning: config file options have changed! See '{}' for details".format(g.cfg_file+'.sample'))
 		ymsg("Warning: config file options have changed! See '{}' for details".format(g.cfg_file+'.sample'))
-		from mmgen.util import my_raw_input
-		my_raw_input('Hit ENTER to continue: ')
+		if not g.test_suite:
+			from mmgen.util import my_raw_input
+			my_raw_input('Hit ENTER to continue: ')
 
 
 	if g.debug and g.prog_name != 'test.py':
 	if g.debug and g.prog_name != 'test.py':
 		opt.verbose,opt.quiet = (True,None)
 		opt.verbose,opt.quiet = (True,None)

+ 1 - 2
mmgen/tool.py

@@ -1019,8 +1019,7 @@ class MMGenToolCmdMonero(MMGenToolCmdBase):
 
 
 			from mmgen.daemon import MoneroWalletDaemon
 			from mmgen.daemon import MoneroWalletDaemon
 			wd = MoneroWalletDaemon(opt.outdir or '.',test_suite=g.test_suite)
 			wd = MoneroWalletDaemon(opt.outdir or '.',test_suite=g.test_suite)
-			wd.stop()
-			wd.start()
+			wd.restart()
 
 
 			from mmgen.rpc import MoneroWalletRPCConnection
 			from mmgen.rpc import MoneroWalletRPCConnection
 			c = MoneroWalletRPCConnection(
 			c = MoneroWalletRPCConnection(

+ 3 - 0
test/common.py

@@ -171,6 +171,9 @@ def start_test_daemons(*network_ids):
 def stop_test_daemons(*network_ids):
 def stop_test_daemons(*network_ids):
 	return test_daemons_ops(*network_ids,op='stop')
 	return test_daemons_ops(*network_ids,op='stop')
 
 
+def restart_test_daemons(*network_ids):
+	return test_daemons_ops(*network_ids,op='restart')
+
 def test_daemons_ops(*network_ids,op):
 def test_daemons_ops(*network_ids,op):
 	if opt.no_daemon_autostart:
 	if opt.no_daemon_autostart:
 		return
 		return

+ 38 - 19
test/test-release.sh

@@ -37,11 +37,13 @@ rounds=100 rounds_min=20 rounds_mid=250 rounds_max=500
 xmr_addrs='3,99,2,22-24,101-104'
 xmr_addrs='3,99,2,22-24,101-104'
 
 
 dfl_tests='misc obj color unit hash ref altref alts xmr eth autosign btc btc_tn btc_rt bch bch_rt ltc ltc_rt tool tool2 gen'
 dfl_tests='misc obj color unit hash ref altref alts xmr eth autosign btc btc_tn btc_rt bch bch_rt ltc ltc_rt tool tool2 gen'
-extra_tests='autosign_minimal autosign_live ltc_tn bch_tn'
+extra_tests='autosign_minimal autosign_live etc ltc_tn bch_tn'
 noalt_tests='misc obj color unit hash ref autosign_minimal btc btc_tn btc_rt tool tool2 gen'
 noalt_tests='misc obj color unit hash ref autosign_minimal btc btc_tn btc_rt tool tool2 gen'
+quick_tests='misc obj color unit hash ref altref alts xmr eth autosign btc btc_rt tool tool2 gen'
+qskip_tests='btc_tn bch bch_rt ltc ltc_rt'
 
 
 PROGNAME=$(basename $0)
 PROGNAME=$(basename $0)
-while getopts hbCfFiIlOpRtvV OPT
+while getopts hbCfFi:I:lOpRtvV OPT
 do
 do
 	case "$OPT" in
 	case "$OPT" in
 	h)  printf "  %-16s Test MMGen release\n" "${PROGNAME}:"
 	h)  printf "  %-16s Test MMGen release\n" "${PROGNAME}:"
@@ -52,8 +54,8 @@ do
 		echo   "           '-f'  Speed up the tests by using fewer rounds"
 		echo   "           '-f'  Speed up the tests by using fewer rounds"
 		echo   "           '-F'  Reduce rounds even further"
 		echo   "           '-F'  Reduce rounds even further"
 		echo   "           '-i'  Create and install Python package, then run tests.  A branch"
 		echo   "           '-i'  Create and install Python package, then run tests.  A branch"
-		echo   "                 must be supplied as the first argument"
-		echo   "           '-I'  Install the package only; don't run tests"
+		echo   "                 must be supplied as a parameter"
+		echo   "           '-I'  Like '-i', but install the package without running the tests"
 		echo   "           '-l'  List the test name symbols"
 		echo   "           '-l'  List the test name symbols"
 		echo   "           '-O'  Use pexpect.spawn rather than popen_spawn for applicable tests"
 		echo   "           '-O'  Use pexpect.spawn rather than popen_spawn for applicable tests"
 		echo   "           '-p'  Pause between tests"
 		echo   "           '-p'  Pause between tests"
@@ -68,9 +70,12 @@ do
 		echo   "     color    - color handling"
 		echo   "     color    - color handling"
 		echo   "     unit     - unit tests"
 		echo   "     unit     - unit tests"
 		echo   "     hash     - internal hash function implementations"
 		echo   "     hash     - internal hash function implementations"
+		echo   "     ref      - reference file checks"
+		echo   "     altref   - altcoin reference file checks"
 		echo   "     alts     - operations for all supported gen-only altcoins"
 		echo   "     alts     - operations for all supported gen-only altcoins"
 		echo   "     xmr      - operations for Monero"
 		echo   "     xmr      - operations for Monero"
 		echo   "     eth      - operations for Ethereum"
 		echo   "     eth      - operations for Ethereum"
+		echo   "     etc      - operations for Ethereum Classic"
 		echo   "     autosign - autosign"
 		echo   "     autosign - autosign"
 		echo   "     btc      - bitcoin"
 		echo   "     btc      - bitcoin"
 		echo   "     btc_tn   - bitcoin testnet"
 		echo   "     btc_tn   - bitcoin testnet"
@@ -87,7 +92,11 @@ do
 		echo   "     misc     - miscellaneous tests that don't fit in the above categories"
 		echo   "     misc     - miscellaneous tests that don't fit in the above categories"
 		echo
 		echo
 		echo   "  AVAILABLE TEST GROUPS:"
 		echo   "  AVAILABLE TEST GROUPS:"
-		echo   "     noalt    - BTC-only tests + tests not requiring altcoin daemons"
+		echo   "     default  - All tests minus the extra tests"
+		echo   "     extra    - All tests minus the default tests"
+		echo   "     noalt    - BTC-only tests"
+		echo   "     quick    - Default tests minus btc_tn, bch, bch_rt, ltc and ltc_rt"
+		echo   "     qskip    - The tests skipped in the 'quick' test group"
 		echo
 		echo
 		echo   "  By default, all tests are run"
 		echo   "  By default, all tests are run"
 		exit ;;
 		exit ;;
@@ -107,11 +116,13 @@ do
 		mmgen_keygen="$python $mmgen_keygen" ;&
 		mmgen_keygen="$python $mmgen_keygen" ;&
 	f)  FAST=1 rounds=10 rounds_min=3 rounds_mid=25 rounds_max=50 xmr_addrs='3,23' unit_tests_py+=" --fast" ;;
 	f)  FAST=1 rounds=10 rounds_min=3 rounds_mid=25 rounds_max=50 xmr_addrs='3,23' unit_tests_py+=" --fast" ;;
 	F)  FAST=1 rounds=3 rounds_min=1 rounds_mid=3 rounds_max=5 xmr_addrs='3,23' unit_tests_py+=" --fast" ;;
 	F)  FAST=1 rounds=3 rounds_min=1 rounds_mid=3 rounds_max=5 xmr_addrs='3,23' unit_tests_py+=" --fast" ;;
-	i)  INSTALL=1 ;;
-	I)  INSTALL_ONLY=1 ;;
+	i)  INSTALL=$OPTARG ;;
+	I)  INSTALL=$OPTARG INSTALL_ONLY=1 ;;
 	l)  echo -e "Default tests:\n  $dfl_tests"
 	l)  echo -e "Default tests:\n  $dfl_tests"
-		echo -e "Additional tests:\n $extra_tests"
-		echo -e "BTC-only ('noalt') test group:\n  $noalt_tests"
+		echo -e "Extra tests:\n  $extra_tests"
+		echo -e "'noalt' test group:\n  $noalt_tests"
+		echo -e "'quick' test group:\n  $quick_tests"
+		echo -e "'qskip' test group:\n  $qskip_tests"
 		exit ;;
 		exit ;;
 	O)  test_py+=" --pexpect-spawn" ;;
 	O)  test_py+=" --pexpect-spawn" ;;
 	p)  PAUSE=1 ;;
 	p)  PAUSE=1 ;;
@@ -136,16 +147,18 @@ done
 
 
 shift $((OPTIND-1))
 shift $((OPTIND-1))
 
 
-if [ "$1" == 'noalt' ]; then
-	tests=$noalt_tests
-elif [ "$*" ]; then
-	tests="$*"
-else
-	tests=$dfl_tests
-fi
+case $1 in
+	'')        tests=$dfl_tests ;;
+	'default') tests=$dfl_tests ;;
+	'extra')   tests=$extra_tests ;;
+	'noalt')   tests=$noalt_tests ;;
+	'quick')   tests=$quick_tests ;;
+	'qskip')   tests=$qskip_tests ;;
+	*)         tests="$*" ;;
+esac
 
 
 [ "$INSTALL" ] && {
 [ "$INSTALL" ] && {
-	BRANCH=$1; shift
+	BRANCH=$INSTALL
 	BRANCHES=$(git branch)
 	BRANCHES=$(git branch)
 	FOUND_BRANCH=$(for b in ${BRANCHES/\*}; do [ "$b" == "$BRANCH" ] && echo ok; done)
 	FOUND_BRANCH=$(for b in ${BRANCHES/\*}; do [ "$b" == "$BRANCH" ] && echo ok; done)
 	[ "$FOUND_BRANCH" ] || { echo "Branch '$BRANCH' not found!"; exit; }
 	[ "$FOUND_BRANCH" ] || { echo "Branch '$BRANCH' not found!"; exit; }
@@ -356,13 +369,19 @@ f_xmr='Monero tests completed'
 [ "$xmr_addrs" == '3,23' ] && t_xmr_skip='4 9 14'
 [ "$xmr_addrs" == '3,23' ] && t_xmr_skip='4 9 14'
 
 
 i_eth='Ethereum'
 i_eth='Ethereum'
-s_eth='Testing transaction and tracking wallet operations for Ethereum and Ethereum Classic'
+s_eth='Testing transaction and tracking wallet operations for Ethereum'
 t_eth="
 t_eth="
 	$test_py --coin=eth ethdev
 	$test_py --coin=eth ethdev
-	$test_py --coin=etc ethdev
 "
 "
 f_eth='Ethereum tests completed'
 f_eth='Ethereum tests completed'
 
 
+i_etc='Ethereum Classic'
+s_etc='Testing transaction and tracking wallet operations for Ethereum Classic'
+t_etc="
+	$test_py --coin=etc ethdev
+"
+f_etc='Ethereum Classic tests completed'
+
 i_autosign='Autosign'
 i_autosign='Autosign'
 s_autosign='The bitcoin, bitcoin-abc and litecoin mainnet and testnet daemons must be running for the following test'
 s_autosign='The bitcoin, bitcoin-abc and litecoin mainnet and testnet daemons must be running for the following test'
 t_autosign="$test_py autosign"
 t_autosign="$test_py autosign"

+ 1 - 1
test/test_py_d/ts_ethdev.py

@@ -320,7 +320,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
 			from shutil import copytree
 			from shutil import copytree
 			for d in ('mm1','mm2'):
 			for d in ('mm1','mm2'):
 				copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d))
 				copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d))
-		start_test_daemons(g.coin)
+		restart_test_daemons(g.coin)
 		return 'ok'
 		return 'ok'
 
 
 	def wallet_upgrade(self,src_file):
 	def wallet_upgrade(self,src_file):