From 9a4920a1b5e9d7d053d7daaf877fc19d2b0249d8 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 18 Feb 2020 20:28:28 +0000 Subject: [PATCH] release/testing: minor fixes and improvements --- MANIFEST.in | 2 + doc/release-notes/release-notes-v0.12.0.md | 2 +- mmgen/altcoin.py | 4 ++ mmgen/daemon.py | 5 +- mmgen/main_passgen.py | 2 +- mmgen/opts.py | 5 +- mmgen/tool.py | 3 +- test/common.py | 3 ++ test/test-release.sh | 57 ++++++++++++++-------- test/test_py_d/ts_ethdev.py | 2 +- 10 files changed, 58 insertions(+), 27 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 6dbd1fff..4ea58a1d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include doc/wiki/using-mmgen/* include test/*.py include test/test_py_d/*.py include test/objtest_py_d/*.py +include test/objattrtest_py_d/*.py include test/unit_tests_d/*.py include test/ref/* include test/ref/litecoin/* @@ -21,6 +22,7 @@ include mmgen/altcoins/eth/pyethereum/LICENSE include scripts/compute-file-chksum.py include scripts/create-token.py +include scripts/traceback_run.py include scripts/uninstall-mmgen.py prune test/ref/__db* diff --git a/doc/release-notes/release-notes-v0.12.0.md b/doc/release-notes/release-notes-v0.12.0.md index c1062ff9..10b42151 100644 --- a/doc/release-notes/release-notes-v0.12.0.md +++ b/doc/release-notes/release-notes-v0.12.0.md @@ -22,7 +22,7 @@ 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 and with the following coin daemon versions: diff --git a/mmgen/altcoin.py b/mmgen/altcoin.py index 3c867819..492846b3 100755 --- a/mmgen/altcoin.py +++ b/mmgen/altcoin.py @@ -27,6 +27,10 @@ altcoin.py - Coin constants for Bitcoin-derived altcoins # wn: https://walletgenerator.net # 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: # NSR: 149/191 c/u, 63/('S'), 64/('S'|'T') # NBT: 150/191 c/u, 25/('B'), 26/('B') diff --git a/mmgen/daemon.py b/mmgen/daemon.py index 2355fcc1..67cafb8b 100755 --- a/mmgen/daemon.py +++ b/mmgen/daemon.py @@ -137,7 +137,10 @@ class Daemon(MMGenObject): else: if not silent: 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): for i in range(200): diff --git a/mmgen/main_passgen.py b/mmgen/main_passgen.py index 65b13805..ad77e224 100755 --- a/mmgen/main_passgen.py +++ b/mmgen/main_passgen.py @@ -28,7 +28,7 @@ from mmgen.seed import SeedSource from mmgen.obj import MMGenPWIDString pwi = PasswordList.pw_info -pwi_fs = '{:5} {:1} {:26} {:<7} {:<7} {}' +pwi_fs = '{:8} {:1} {:26} {:<7} {:<7} {}' opts_data = { 'sets': [('print_checksum',True,'quiet',True)], diff --git a/mmgen/opts.py b/mmgen/opts.py index 1faa784a..7cc03a49 100755 --- a/mmgen/opts.py +++ b/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'): 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': opt.verbose,opt.quiet = (True,None) diff --git a/mmgen/tool.py b/mmgen/tool.py index d76a0e22..25d150e5 100755 --- a/mmgen/tool.py +++ b/mmgen/tool.py @@ -1019,8 +1019,7 @@ class MMGenToolCmdMonero(MMGenToolCmdBase): from mmgen.daemon import MoneroWalletDaemon wd = MoneroWalletDaemon(opt.outdir or '.',test_suite=g.test_suite) - wd.stop() - wd.start() + wd.restart() from mmgen.rpc import MoneroWalletRPCConnection c = MoneroWalletRPCConnection( diff --git a/test/common.py b/test/common.py index f3afb2ef..2da22ce8 100755 --- a/test/common.py +++ b/test/common.py @@ -171,6 +171,9 @@ def start_test_daemons(*network_ids): def stop_test_daemons(*network_ids): 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): if opt.no_daemon_autostart: return diff --git a/test/test-release.sh b/test/test-release.sh index 64a316d6..61c0264a 100755 --- a/test/test-release.sh +++ b/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' 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' +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) -while getopts hbCfFiIlOpRtvV OPT +while getopts hbCfFi:I:lOpRtvV OPT do case "$OPT" in 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' Reduce rounds even further" 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 " '-O' Use pexpect.spawn rather than popen_spawn for applicable tests" echo " '-p' Pause between tests" @@ -68,9 +70,12 @@ do echo " color - color handling" echo " unit - unit tests" 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 " xmr - operations for Monero" echo " eth - operations for Ethereum" + echo " etc - operations for Ethereum Classic" echo " autosign - autosign" echo " btc - bitcoin" echo " btc_tn - bitcoin testnet" @@ -87,7 +92,11 @@ do echo " misc - miscellaneous tests that don't fit in the above categories" echo 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 " By default, all tests are run" exit ;; @@ -107,11 +116,13 @@ do 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=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" - 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 ;; O) test_py+=" --pexpect-spawn" ;; p) PAUSE=1 ;; @@ -136,16 +147,18 @@ done 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" ] && { - BRANCH=$1; shift + BRANCH=$INSTALL BRANCHES=$(git branch) FOUND_BRANCH=$(for b in ${BRANCHES/\*}; do [ "$b" == "$BRANCH" ] && echo ok; done) [ "$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' 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=" $test_py --coin=eth ethdev - $test_py --coin=etc ethdev " 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' s_autosign='The bitcoin, bitcoin-abc and litecoin mainnet and testnet daemons must be running for the following test' t_autosign="$test_py autosign" diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index 4bdeed15..bfeee259 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -320,7 +320,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): from shutil import copytree for d in ('mm1','mm2'): copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d)) - start_test_daemons(g.coin) + restart_test_daemons(g.coin) return 'ok' def wallet_upgrade(self,src_file):