Browse Source

test-release.sh: add 'noalt' test group

The MMGen Project 5 years ago
parent
commit
b4a60208e4
3 changed files with 44 additions and 22 deletions
  1. 37 18
      test/test-release.sh
  2. 3 1
      test/test_py_d/ts_autosign.py
  3. 4 3
      test/unit_tests_d/ut_tx_deserialize.py

+ 37 - 18
test/test-release.sh

@@ -36,15 +36,16 @@ python='python3'
 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 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'
+noalt_tests='misc obj color unit hash ref autosign_minimal btc btc_tn btc_rt tool tool2 gen'
 
 PROGNAME=$(basename $0)
 while getopts hbCfFiIlOpRtvV OPT
 do
 	case "$OPT" in
 	h)  printf "  %-16s Test MMGen release\n" "${PROGNAME}:"
-		echo   "  USAGE:           $PROGNAME [options] [tests]"
+		echo   "  USAGE:           $PROGNAME [options] [tests or test group]"
 		echo   "  OPTIONS: '-h'  Print this help message"
 		echo   "           '-b'  Buffer keypresses for all invocations of 'test/test.py'"
 		echo   "           '-C'  Run tests in coverage mode"
@@ -61,6 +62,7 @@ do
 		echo   "           '-v'  Run test/test.py with '--exact-output' and other commands with"
 		echo   "                 '--verbose' switch"
 		echo   "           '-V'  Run test/test.py and other commands with '--verbose' switch"
+		echo
 		echo   "  AVAILABLE TESTS:"
 		echo   "     obj      - data objects"
 		echo   "     color    - color handling"
@@ -83,6 +85,10 @@ do
 		echo   "     tool2    - tooltest2 (all supported coins)"
 		echo   "     gen      - gentest (all supported coins)"
 		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
 		echo   "  By default, all tests are run"
 		exit ;;
 	b)  test_py+=" --buf-keypress" ;;
@@ -104,7 +110,8 @@ do
 	i)  INSTALL=1 ;;
 	I)  INSTALL_ONLY=1 ;;
 	l)  echo -e "Default tests:\n  $dfl_tests"
-		echo -e "Additional tests:\n  $extra_tests"
+		echo -e "Additional tests:\n $extra_tests"
+		echo -e "BTC-only ('noalt') test group:\n  $noalt_tests"
 		exit ;;
 	O)  test_py+=" --pexpect-spawn" ;;
 	p)  PAUSE=1 ;;
@@ -129,6 +136,14 @@ done
 
 shift $((OPTIND-1))
 
+if [ "$1" == 'noalt' ]; then
+	tests=$noalt_tests
+elif [ "$*" ]; then
+	tests="$*"
+else
+	tests=$dfl_tests
+fi
+
 [ "$INSTALL" ] && {
 	BRANCH=$1; shift
 	BRANCHES=$(git branch)
@@ -240,7 +255,7 @@ i_hash='Internal hash function implementations'
 s_hash='Testing internal hash function implementations'
 t_hash="
 	$python test/hashfunc.py sha256 $rounds_max
-	$python test/hashfunc.py sha512 $rounds_max # native sha512 - not used by MMGen
+	$python test/hashfunc.py sha512 $rounds_max # native SHA512 - not used by the MMGen wallet
 	$python test/hashfunc.py keccak $rounds_max
 "
 f_hash='Hash function tests completed'
@@ -252,22 +267,20 @@ i_ref='Miscellaneous reference data'
 s_ref='The following tests will test some generated values against reference data'
 t_ref="
 	$scrambletest_py
-	$test_py ref_altcoin # generated addrfiles verified against checksums
 "
 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'
+t_altref="
+	$test_py ref_altcoin # generated addrfiles verified against checksums
+"
+f_altref='Altcoin reference file tests completed'
+
 i_alts='Gen-only altcoin'
 s_alts='The following tests will test generation operations for all supported altcoins'
 t_alts="
 	# speed tests, no verification:
-	$gentest_py --coin=btc 2 $rounds
-	$gentest_py --coin=btc --type=compressed 2 $rounds
-	$gentest_py --coin=btc --type=segwit 2 $rounds
-	$gentest_py --coin=btc --type=bech32 2 $rounds
-	$gentest_py --coin=ltc 2 $rounds
-	$gentest_py --coin=ltc --type=compressed 2 $rounds
-	$gentest_py --coin=ltc --type=segwit 2 $rounds
-	$gentest_py --coin=ltc --type=bech32 2 $rounds
 	$gentest_py --coin=etc 2 $rounds
 	$gentest_py --coin=etc --use-internal-keccak-module 2 $rounds_min
 	$gentest_py --coin=eth 2 $rounds
@@ -370,7 +383,7 @@ 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'
 t_btc="
-	$test_py --exclude regtest,autosign_minimal
+	$test_py --exclude regtest,autosign_minimal,ref_altcoin
 	$test_py --segwit
 	$test_py --segwit-random
 	$test_py --bech32
@@ -478,8 +491,17 @@ t_tool="
 f_tool='tooltest tests completed'
 
 i_gen='Gentest'
-s_gen="The following tests will run '$gentest_py' on mainnet and testnet for all supported coins"
+s_gen="The following tests will run '$gentest_py' for BTC and LTC mainnet and testnet"
 t_gen="
+	# speed tests, no verification:
+	$gentest_py --coin=btc 2 $rounds
+	$gentest_py --coin=btc --type=compressed 2 $rounds
+	$gentest_py --coin=btc --type=segwit 2 $rounds
+	$gentest_py --coin=btc --type=bech32 2 $rounds
+	$gentest_py --coin=ltc 2 $rounds
+	$gentest_py --coin=ltc --type=compressed 2 $rounds
+	$gentest_py --coin=ltc --type=segwit 2 $rounds
+	$gentest_py --coin=ltc --type=bech32 2 $rounds
 	# wallet dumps:
 	$gentest_py 2 $REFDIR/btcwallet.dump
 	$gentest_py --type=segwit 2 $REFDIR/btcwallet-segwit.dump
@@ -537,9 +559,6 @@ check_args() {
 	done
 }
 
-tests=$dfl_tests
-[ "$*" ] && tests="$*"
-
 check_args
 [ "$LIST_CMDS" ] || echo "Running tests: $tests"
 START=$(date +%s)

+ 3 - 1
test/test_py_d/ts_autosign.py

@@ -45,6 +45,7 @@ class TestSuiteAutosign(TestSuiteBase):
 	def autosign_minimal(self,live=False):
 		return self.autosign(
 					coins=['btc','eth'],
+					daemon_coins=['btc'],
 					txfiles=['btc','eth','mm1','etc'],
 					txcount=8,
 					live=live)
@@ -52,6 +53,7 @@ class TestSuiteAutosign(TestSuiteBase):
 	# tests everything except device detection, mount/unmount
 	def autosign(   self,
 					coins=['btc','bch','ltc','eth'],
+					daemon_coins=['btc','bch','ltc'],
 					txfiles=['btc','bch','ltc','eth','mm1','etc'],
 					txcount=12,
 					live=False):
@@ -178,7 +180,7 @@ class TestSuiteAutosign(TestSuiteBase):
 			imsg('')
 			return t
 
-		network_ids = [c+'_tn' for c in coins] + coins
+		network_ids = [c+'_tn' for c in daemon_coins] + daemon_coins
 		start_test_daemons(*network_ids)
 
 		if live:

+ 4 - 3
test/unit_tests_d/ut_tx_deserialize.py

@@ -104,7 +104,8 @@ class unit_test(object):
 		def test_mmgen_txs():
 			fns = ( ('btc',False,'test/ref/0B8D5A[15.31789,14,tl=1320969600].rawtx'),
 					('btc',True,'test/ref/0C7115[15.86255,14,tl=1320969600].testnet.rawtx'),
-					('bch',False,'test/ref/460D4D-BCH[10.19764,tl=1320969600].rawtx') )
+				#	('bch',False,'test/ref/460D4D-BCH[10.19764,tl=1320969600].rawtx')
+				)
 			from mmgen.protocol import init_coin
 			from mmgen.tx import MMGenTX
 			from mmgen.daemon import CoinDaemon
@@ -123,9 +124,9 @@ class unit_test(object):
 		from mmgen.tx import DeserializedTX
 		import json
 
-		start_test_daemons('btc','btc_tn','bch')
+		start_test_daemons('btc','btc_tn') # ,'bch')
 		test_mmgen_txs()
 		test_core_vectors()
-		stop_test_daemons('btc','btc_tn','bch')
+		stop_test_daemons('btc','btc_tn') # ,'bch')
 
 		return True