Browse Source

test-release.sh: code/data cleanups

The MMGen Project 2 years ago
parent
commit
1fcac76363
3 changed files with 64 additions and 127 deletions
  1. 1 1
      mmgen/data/version
  2. 41 120
      test/test-release.d/cfg.sh
  3. 22 6
      test/test-release.sh

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-13.3.dev10
+13.3.dev11

+ 41 - 120
test/test-release.d/cfg.sh

@@ -8,47 +8,21 @@
 #   https://github.com/mmgen/mmgen
 #   https://gitlab.com/mmgen/mmgen
 
-list_avail_tests() {
-	echo   "AVAILABLE TESTS:"
-	echo   "   obj      - data objects"
-	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   "   altgen   - gentest (altcoins)"
-	echo   "   xmr      - Monero xmrwallet operations"
-	echo   "   eth      - operations for Ethereum and Ethereum Classic"
-	echo   "   autosign - autosign"
-	echo   "   btc      - Bitcoin"
-	echo   "   btc_tn   - Bitcoin testnet"
-	echo   "   btc_rt   - Bitcoin regtest"
-	echo   "   bch      - Bitcoin Cash Node (BCH)"
-	echo   "   bch_tn   - Bitcoin Cash Node (BCH) testnet"
-	echo   "   bch_rt   - Bitcoin Cash Node (BCH) regtest"
-	echo   "   ltc      - Litecoin"
-	echo   "   ltc_tn   - Litecoin testnet"
-	echo   "   ltc_rt   - Litecoin regtest"
-	echo   "   tool     - tooltest (all supported coins)"
-	echo   "   tool2    - tooltest2 (all supported coins)"
-	echo   "   gen      - gentest (Bitcoin,Litecoin)"
-	echo   "   misc     - miscellaneous tests that don't fit in the above categories"
-	echo
-	echo   "AVAILABLE TEST GROUPS:"
-	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"
-}
+all_tests="dep obj color unit hash ref altref altgen xmr eth autosign btc btc_tn btc_rt bch bch_tn bch_rt ltc ltc_tn ltc_rt tool tool2 gen alt"
+
+groups_desc="
+	default  - All tests minus the extra tests
+	extra    - All tests minus the default tests
+	noalt    - BTC-only tests
+	quick    - Default tests minus btc_tn, bch, bch_rt, ltc and ltc_rt
+	qskip    - The tests skipped in the 'quick' test group
+"
 
 init_groups() {
-	dfl_tests='dep misc obj color unit hash ref tool tool2 gen autosign btc btc_tn btc_rt altref altgen bch bch_rt ltc ltc_rt eth xmr'
+	dfl_tests='dep alt obj color unit hash ref tool tool2 gen autosign btc btc_tn btc_rt altref altgen bch bch_rt ltc ltc_rt eth xmr'
 	extra_tests='dep autosign_btc autosign_live ltc_tn bch_tn'
-	noalt_tests='dep misc obj color unit hash ref tool tool2 gen autosign_btc btc btc_tn btc_rt'
-	quick_tests='dep misc obj color unit hash ref tool tool2 gen autosign btc btc_rt altref altgen eth xmr'
+	noalt_tests='dep alt obj color unit hash ref tool tool2 gen autosign_btc btc btc_tn btc_rt'
+	quick_tests='dep alt obj color unit hash ref tool tool2 gen autosign btc btc_rt altref altgen eth xmr'
 	qskip_tests='btc_tn bch bch_rt ltc ltc_rt'
 
 	[ "$MSYS2" ] && SKIP_LIST='autosign autosign_btc autosign_live'
@@ -57,15 +31,12 @@ init_groups() {
 init_tests() {
 	REFDIR='test/ref'
 
-	i_misc='Miscellaneous'
-	s_misc='Testing various subsystems'
-	t_misc="
+	d_alt="altcoin module"
+	t_alt="
 		- python3 -m mmgen.altcoin $altcoin_mod_opts
 	"
-	f_misc='Miscellaneous tests completed'
 
-	i_obj='Data object'
-	s_obj='Testing data objects'
+	d_obj="data objects"
 	t_obj="
 		- $objtest_py --coin=btc
 		- $objtest_py --getobj --coin=btc
@@ -75,58 +46,44 @@ init_tests() {
 		- $objtest_py --coin=eth
 		- $objattrtest_py
 	"
-	f_obj='Data object tests completed'
 
 	[ "$PYTHONOPTIMIZE" ] && {
 		echo -e "${YELLOW}PYTHONOPTIMIZE set, skipping object tests$RESET"
 		t_obj_skip='-'
 	}
 
-	i_color='Color'
-	s_color='Testing terminal colors'
+	d_color="color handling"
 	t_color='- test/colortest.py'
-	f_color='Terminal color tests completed'
 
-	i_dep='Dependency'
-	s_dep='Testing for installed dependencies'
+	d_dep="system and testing dependencies"
 	t_dep="- $unit_tests_py testdep dep daemon.exec"
-	f_dep='Dependency tests completed'
 
-	i_unit='Unit'
-	s_unit='The bitcoin and bitcoin-bchn mainnet daemons must be running for the following tests'
+	d_unit="low-level subsystems"
 	t_unit="- $unit_tests_py --exclude testdep,dep,daemon"
-	f_unit='Unit tests completed'
 
-	i_hash='Internal hash function implementations'
-	s_hash='Testing internal hash function implementations'
+	d_hash="internal hash function implementations"
 	t_hash="
 		256    $python test/hashfunc.py sha256 $rounds5x
 		512    $python test/hashfunc.py sha512 $rounds5x # native SHA512 - not used by the MMGen wallet
 		keccak $python test/hashfunc.py keccak $rounds5x
 		ripemd160 $python mmgen/contrib/ripemd160.py $VERBOSE $fast_opt
 	"
-	f_hash='Hash function tests completed'
 
 	[ "$ARM32" ] && t_hash_skip='512'        # gmpy produces invalid init constants
 	[ "$MSYS2" ] && t_hash_skip='512 keccak' # 2:py_long_long issues, 3:no pysha3 for keccak reference
 	[ "$SKIP_ALT_DEP" ] && t_hash_skip+=' keccak'
 
-	i_ref='Miscellaneous reference data'
-	s_ref='The following tests will test some generated values against reference data'
+	d_ref="generated values against reference data"
 	t_ref="
 		- $scrambletest_py
 	"
-	f_ref='Miscellaneous reference data tests completed'
 
-	i_altref='Altcoin reference file'
-	s_altref='The following tests will test some generated altcoin files against reference data'
+	d_altref="altcoin reference file checks"
 	t_altref="
 		- $test_py ref_altcoin # generated addrfiles verified against checksums
 	"
-	f_altref='Altcoin reference file tests completed'
 
-	i_altgen='Altcoin generation'
-	s_altgen='The following tests will test generation operations for all supported altcoins'
+	d_altgen="altcoin address generation"
 	t_altgen="
 		- # speed tests, no verification:
 		- $gentest_py --coin=etc 1 $rounds10x
@@ -167,48 +124,34 @@ init_tests() {
 	# ARM ethkey available only on Arch Linux:
 	[ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_altgen_skip+=' e'
 
-	f_altgen='Altcoin generation tests completed'
 
-	i_xmr='Monero'
-	s_xmr='Testing Monero operations'
+	d_xmr="Monero xmrwallet operations using stagenet"
 	t_xmr="
 		- $test_py --coin=xmr
 	"
-	f_xmr='Monero tests completed'
 
-	i_eth='Ethereum'
-	s_eth='Testing transaction and tracking wallet operations for Ethereum'
+	d_eth="operations for Ethereum and Ethereum Classic using devnet"
 	t_eth="
 		oe     $test_py --coin=eth --daemon-id=openethereum ethdev
 		geth   $test_py --coin=eth --daemon-id=geth ethdev
 		parity $test_py --coin=etc ethdev
 	"
-	f_eth='Ethereum tests completed'
 
 	[ "$FAST" ] && t_eth_skip='oe'
 	[ "$ARM32" -o "$ARM64" ] && t_eth_skip+=' parity'
 	# ARM openethereum available only on ArchLinuxArm:
 	[ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_eth_skip+=' oe'
 
-	i_autosign='Autosign'
-	s_autosign='The bitcoin, bitcoin-bchn and litecoin mainnet and testnet daemons must be running for the following test'
+	d_autosign="transaction and message autosigning"
 	t_autosign="- $test_py autosign"
-	f_autosign='Autosign test completed'
 
-	i_autosign_btc='Autosign BTC'
-	s_autosign_btc='The bitcoin mainnet and testnet daemons must be running for the following test'
+	d_autosign_btc="transaction and message autosigning (Bitcoin only)"
 	t_autosign_btc="- $test_py autosign_btc"
-	f_autosign_btc='Autosign BTC test completed'
 
-	i_autosign_live='Autosign Live'
-	s_autosign_live="The bitcoin mainnet and testnet daemons must be running for the following test\n"
-	s_autosign_live+="${YELLOW}Mountpoint, '/etc/fstab' and removable device must be configured "
-	s_autosign_live+="as described in 'mmgen-autosign --help'${RESET}"
+	d_autosign_btc="transaction and message autosigning (interactive)"
 	t_autosign_live="- $test_py autosign_live"
-	f_autosign_live='Autosign Live test completed'
 
-	i_btc='Bitcoin mainnet'
-	s_btc='The bitcoin (mainnet) daemon must both be running for the following tests'
+	d_btc="overall operations with emulated RPC data (Bitcoin)"
 	t_btc="
 		- $test_py --exclude regtest,autosign,ref_altcoin
 		- $test_py --segwit
@@ -216,65 +159,47 @@ init_tests() {
 		- $test_py --bech32
 		- $python scripts/compute-file-chksum.py $REFDIR/*testnet.rawtx >/dev/null 2>&1
 	"
-	f_btc='Bitcoin mainnet tests completed'
 
-	i_btc_tn='Bitcoin testnet'
-	s_btc_tn='The bitcoin testnet daemon must both be running for the following tests'
+	d_btc_tn="overall operations with emulated RPC data (Bitcoin testnet)"
 	t_btc_tn="
 		- $test_py --testnet=1
 		- $test_py --testnet=1 --segwit
 		- $test_py --testnet=1 --segwit-random
 		- $test_py --testnet=1 --bech32
 	"
-	f_btc_tn='Bitcoin testnet tests completed'
 
-	i_btc_rt='Bitcoin regtest'
-	s_btc_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
+	d_btc_rt="overall operations using the regtest network (Bitcoin)"
 	t_btc_rt="- $test_py regtest"
-	f_btc_rt='Regtest (Bob and Alice) mode tests for BTC completed'
 
-	i_bch='BitcoinCashNode (BCH) mainnet'
-	s_bch='The bitcoin-bchn mainnet daemon must both be running for the following tests'
+	d_bch="overall operations with emulated RPC data (Bitcoin Cash Node)"
 	t_bch="- $test_py --coin=bch --exclude regtest"
-	f_bch='BitcoinCashNode (BCH) mainnet tests completed'
 
-	i_bch_tn='BitcoinCashNode (BCH) testnet'
-	s_bch_tn='The bitcoin-bchn testnet daemon must both be running for the following tests'
+	d_bch_tn="overall operations with emulated RPC data (Bitcoin Cash Node testnet)"
 	t_bch_tn="- $test_py --coin=bch --testnet=1 --exclude regtest"
-	f_bch_tn='BitcoinCashNode (BCH) testnet tests completed'
 
-	i_bch_rt='BitcoinCashNode (BCH) regtest'
-	s_bch_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
+	d_bch_rt="overall operations using the regtest network (Bitcoin Cash Node)"
 	t_bch_rt="- $test_py --coin=bch regtest"
-	f_bch_rt='Regtest (Bob and Alice) mode tests for BCH completed'
 
-	i_ltc='Litecoin'
-	s_ltc='The litecoin mainnet daemon must both be running for the following tests'
+	d_ltc="overall operations with emulated RPC data (Litecoin)"
 	t_ltc="
 		- $test_py --coin=ltc --exclude regtest
 		- $test_py --coin=ltc --segwit
 		- $test_py --coin=ltc --segwit-random
 		- $test_py --coin=ltc --bech32
 	"
-	f_ltc='Litecoin mainnet tests completed'
 
-	i_ltc_tn='Litecoin testnet'
-	s_ltc_tn='The litecoin testnet daemon must both be running for the following tests'
+	d_ltc_tn="overall operations with emulated RPC data (Litecoin testnet)"
 	t_ltc_tn="
 		- $test_py --coin=ltc --testnet=1 --exclude regtest
 		- $test_py --coin=ltc --testnet=1 --segwit
 		- $test_py --coin=ltc --testnet=1 --segwit-random
 		- $test_py --coin=ltc --testnet=1 --bech32
 	"
-	f_ltc_tn='Litecoin testnet tests completed'
 
-	i_ltc_rt='Litecoin regtest'
-	s_ltc_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
+	d_ltc_rt="overall operations using the regtest network (Litecoin)"
 	t_ltc_rt="- $test_py --coin=ltc regtest"
-	f_ltc_rt='Regtest (Bob and Alice) mode tests for LTC completed'
 
-	i_tool2='Tooltest2'
-	s_tool2="The following tests will run '$tooltest2_py' for all supported coins"
+	d_tool2="'mmgen-tool' utility with data check"
 	t_tool2="
 		- $tooltest2_py --tool-api # test the tool_api subsystem
 		- $tooltest2_py --tool-api --testnet=1
@@ -297,11 +222,9 @@ init_tests() {
 		e $tooltest2_py --coin=etc
 		- $tooltest2_py --fork # run once with --fork so commands are actually executed
 	"
-	f_tool2='tooltest2 tests completed'
 	[ "$SKIP_ALT_DEP" ] && t_tool2_skip='a e' # skip ETH,ETC: txview requires py_ecc
 
-	i_tool='Tooltest'
-	s_tool="The following tests will run '$tooltest_py' for all supported coins"
+	d_tool="'mmgen-tool' utility (all supported coins)"
 	t_tool="
 		- $tooltest_py --coin=btc cryptocoin
 		- $tooltest_py --coin=btc mnemonic
@@ -318,10 +241,7 @@ init_tests() {
 	[ "$MSYS2" -o "$ARM32" ] && t_tool_skip='z'
 	[ "$SKIP_ALT_DEP" ] && t_tool_skip='a z'
 
-	f_tool='tooltest tests completed'
-
-	i_gen='Generation'
-	s_gen='The following tests will test generation operations for Bitcoin and Litecoin'
+	d_gen="Bitcoin and Litecoin address generation"
 	t_gen="
 		- # speed tests, no verification:
 		- $gentest_py --coin=btc 1 $rounds10x
@@ -356,5 +276,6 @@ init_tests() {
 	"
 
 	[ "$SKIP_ALT_DEP" ] && t_gen_skip='a'
-	f_gen='gentest tests completed'
+
+	true
 }

+ 22 - 6
test/test-release.sh

@@ -48,9 +48,26 @@ prompt_skip() {
 	return 1
 }
 
+list_avail_tests() {
+	echo   "AVAILABLE TESTS:"
+	init_tests
+	for i in $all_tests; do
+		z="d_$i"
+		printf "   %-8s - %s\n" $i "${!z}"
+	done
+	echo
+	echo   "AVAILABLE TEST GROUPS:"
+	while read a b c; do
+		[ "$a" ] && printf "   %-8s - %s\n" $a "$c"
+	done <<<$groups_desc
+	echo
+	echo   "By default, all tests are run"
+}
+
 run_tests() {
 	[ "$LIST_CMDS" ] || echo "Running tests: $1"
 	for t in $1; do
+		desc_id="d_$t" desc=${!desc_id}
 		if [ "$SKIP_ALT_DEP" ]; then
 			ok=$(for a in $noalt_tests; do if [ $t == $a ]; then echo 'ok'; fi; done)
 			if [ ! "$ok" ]; then
@@ -59,15 +76,14 @@ run_tests() {
 			fi
 		fi
 		if [ "$LIST_CMDS" ]; then
-			eval echo -e '\\n#' $(echo \$i_$t) "\($t\)"
+			echo -e "\n### $t: $desc"
 		else
-			eval echo -e "'\n'"\${GREEN}'###' Running $(echo \$i_$t) tests\$RESET
-			eval echo -e $(echo \$s_$t)
+			echo -e "\n${BLUE}Testing:$RESET $GREEN$desc$RESET"
 		fi
 		[ "$PAUSE" ] && prompt_skip && continue
 		CUR_TEST=$t
 		do_test $t
-		[ "$LIST_CMDS" ] || eval echo -e $(echo \$f_$t)
+		[ "$LIST_CMDS" ] || echo -e "${BLUE}Finished testing:$RESET $GREEN$desc$RESET"
 	done
 }
 
@@ -271,8 +287,8 @@ elapsed_fmt=$(printf %02d:%02d $((elapsed/60)) $((elapsed%60)))
 
 [ "$LIST_CMDS" ] || {
 	if [ "$MMGEN_TEST_SUITE_DETERMINISTIC" ]; then
-		echo -e "${GREEN}All OK"
+		echo -e "\n${GREEN}All OK"
 	else
-		echo -e "${GREEN}All OK.  Total elapsed time: $elapsed_fmt$RESET"
+		echo -e "\n${GREEN}All OK.  Total elapsed time: $elapsed_fmt$RESET"
 	fi
 }