diff --git a/test/misc/tool_api_test.py b/test/misc/tool_api_test.py index 53911eed..bd57c43a 100755 --- a/test/misc/tool_api_test.py +++ b/test/misc/tool_api_test.py @@ -93,20 +93,21 @@ def run_test(): 'KwojSzt1VvW343mQfWQi3J537siAt5ktL2qbuCg1ZyKR8BLQ6UJm', 'bc1q6pqnfwwakuuejpm9w52ds342f9d5u36v0qnz7c' ) - test_triplet(tool,'ltc','regtest','bech32',1, - 'cV3ZRqf8PhyfiFwtJfkvGu2qmBsazE1wXoA2A16S3nixb3BTvvVx', - 'rltc1qvmqas4maw7lg9clqu6kqu9zq9cluvllnz4kj9y' ) + if not 'no_altcoin' in sys.argv: + test_triplet(tool,'ltc','regtest','bech32',1, + 'cV3ZRqf8PhyfiFwtJfkvGu2qmBsazE1wXoA2A16S3nixb3BTvvVx', + 'rltc1qvmqas4maw7lg9clqu6kqu9zq9cluvllnz4kj9y' ) - test_triplet(tool,'xmr','mainnet','M',1, - 'e8164dda6d42bd1e261a3406b2038dcbddadbeefdeadbeefdeadbeefdeadbe0f', - '41i7saPWA53EoHenmJVRt34dubPxsXwoWMnw8AdMyx4mTD1svf7qYzcVjxxRfteLNdYrAxWUMmiPegFW9EfoNgXx7vDMExv' ), + test_triplet(tool,'xmr','mainnet','M',1, + 'e8164dda6d42bd1e261a3406b2038dcbddadbeefdeadbeefdeadbeefdeadbe0f', + '41i7saPWA53EoHenmJVRt34dubPxsXwoWMnw8AdMyx4mTD1svf7qYzcVjxxRfteLNdYrAxWUMmiPegFW9EfoNgXx7vDMExv' ), - test_triplet(tool,'etc','mainnet','E',1, - 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', - 'c96aaa54e2d44c299564da76e1cd3184a2386b8d' ), + test_triplet(tool,'etc','mainnet','E',1, + 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', + 'c96aaa54e2d44c299564da76e1cd3184a2386b8d' ), - test_triplet(tool,'zec','mainnet','Z',1, - 'SKxuS56e99jpCeD9mMQ5o63zoGPakNdM9HCvt4Vt2cypvRjCdvGJ', - 'zchFELwBxqsAubsLQ8yZgPCDDGukjXJssgCbiTPwFNmFwn9haLnDatzfhLdZzJT4PcU4o2yr92B52UFirUzEdF6ZYM2gBkM' ) + test_triplet(tool,'zec','mainnet','Z',1, + 'SKxuS56e99jpCeD9mMQ5o63zoGPakNdM9HCvt4Vt2cypvRjCdvGJ', + 'zchFELwBxqsAubsLQ8yZgPCDDGukjXJssgCbiTPwFNmFwn9haLnDatzfhLdZzJT4PcU4o2yr92B52UFirUzEdF6ZYM2gBkM' ) run_test() diff --git a/test/scrambletest.py b/test/scrambletest.py index 9db7e56e..3a47c429 100755 --- a/test/scrambletest.py +++ b/test/scrambletest.py @@ -35,6 +35,7 @@ opts_data = { 'options': """ -h, --help Print this help message --, --longhelp Print help message for long options (common options) +-a, --no-altcoin Skip altcoin tests -C, --coverage Produce code coverage info using trace module -l, --list-cmds List and describe the tests and commands in this test suite -s, --system Test scripts and modules installed on system rather than @@ -57,12 +58,15 @@ if not opt.system: from collections import namedtuple td = namedtuple('scrambletest_entry',['seed','str','id_str','lbl','addr']) -coin_data = { +bitcoin_data = { # SCRAMBLED_SEED[:8] SCRAMBLE_KEY ID_STR LBL FIRST ADDR 'btc': td('456d7f5f1c4bfe3b','(none)', '', '', '1MU7EdgqYy9JX35L25hR6CmXXcSEBDAwyv'), 'btc_compressed':td('bf98a4af5464a4ef','compressed', '-C', 'COMPRESSED', '1F97Jd89wwmu4ELadesAdGDzg3d8Y6j5iP'), 'btc_segwit': td('b56962d829ffc678','segwit', '-S', 'SEGWIT', '36TvVzU5mxSjJ3D9qKAmYzCV7iUqtTDezF'), 'btc_bech32': td('d09eea818f9ad17f','bech32', '-B', 'BECH32', 'bc1q8snv94j6959y3gkqv4gku0cm5mersnpucsvw5z'), +} + +altcoin_data = { 'bch': td('456d7f5f1c4bfe3b','(none)', '', '', '1MU7EdgqYy9JX35L25hR6CmXXcSEBDAwyv'), 'bch_compressed':td('bf98a4af5464a4ef','compressed', '-C', 'COMPRESSED', '1F97Jd89wwmu4ELadesAdGDzg3d8Y6j5iP'), 'ltc': td('b11f16632e63ba92','ltc:legacy', '-LTC', 'LTC', 'LMxB474SVfxeYdqxNrM1WZDZMnifteSMv1'), @@ -120,7 +124,9 @@ def do_test(cmd,tdata,msg_str,addr_desc): def do_coin_tests(): bmsg('Testing address scramble strings and list IDs') - for tname,tdata in coin_data.items(): + for tname,tdata in ( + tuple(bitcoin_data.items()) + + tuple(altcoin_data.items() if not opt.no_altcoin else []) ): if tname == 'zec_zcash_z' and g.platform == 'win': msg("Skipping 'zec_zcash_z' test for Windows platform") continue diff --git a/test/test-release.sh b/test/test-release.sh index 41ba5cd8..b86d570a 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -102,7 +102,10 @@ do echo echo " By default, all tests are run" exit ;; - A) SKIP_ALT_DEP=1 unit_tests_py+=" --no-altcoin-deps" ;; + A) SKIP_ALT_DEP=1 + test_py+=" --no-altcoin" + unit_tests_py+=" --no-altcoin-deps" + scrambletest_py+=" --no-altcoin" ;; b) test_py+=" --buf-keypress" ;; C) mkdir -p 'test/trace' touch 'test/trace.acc' @@ -165,7 +168,11 @@ case $1 in '') tests=$dfl_tests ;; 'default') tests=$dfl_tests ;; 'extra') tests=$extra_tests ;; - 'noalt') tests=$noalt_tests SKIP_ALT_DEP=1 unit_tests_py+=" --no-altcoin-deps" ;; + 'noalt') tests=$noalt_tests + SKIP_ALT_DEP=1 + test_py+=" --no-altcoin" + unit_tests_py+=" --no-altcoin-deps" + scrambletest_py+=" --no-altcoin" ;; 'quick') tests=$quick_tests ;; 'qskip') tests=$qskip_tests ;; *) tests="$*" ;; @@ -463,18 +470,18 @@ s_tool2="The following tests will run '$tooltest2_py' for all supported coins" t_tool2=" - $tooltest2_py --tool-api # test the tool_api subsystem - $tooltest2_py --tool-api --testnet=1 - - $tooltest2_py --tool-api --coin=eth - - $tooltest2_py --tool-api --coin=xmr - - $tooltest2_py --tool-api --coin=zec + e $tooltest2_py --tool-api --coin=eth + a $tooltest2_py --tool-api --coin=xmr + a $tooltest2_py --tool-api --coin=zec - $tooltest2_py - $tooltest2_py --testnet=1 - - $tooltest2_py --coin=ltc - - $tooltest2_py --coin=ltc --testnet=1 - - $tooltest2_py --coin=bch - - $tooltest2_py --coin=bch --testnet=1 - - $tooltest2_py --coin=zec - - $tooltest2_py --coin=xmr - - $tooltest2_py --coin=dash + a $tooltest2_py --coin=ltc + a $tooltest2_py --coin=ltc --testnet=1 + a $tooltest2_py --coin=bch + a $tooltest2_py --coin=bch --testnet=1 + a $tooltest2_py --coin=zec + a $tooltest2_py --coin=xmr + a $tooltest2_py --coin=dash e $tooltest2_py --coin=eth e $tooltest2_py --coin=eth --testnet=1 e $tooltest2_py --coin=eth --token=mm1 @@ -483,61 +490,64 @@ t_tool2=" - $tooltest2_py --fork # run once with --fork so commands are actually executed " f_tool2='tooltest2 tests completed' -[ "$SKIP_ALT_DEP" ] && t_tool2_skip='e' # skip ETH,ETC: txview requires py_ecc +[ "$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" t_tool=" - $tooltest_py --coin=btc cryptocoin - $tooltest_py --coin=btc mnemonic - - $tooltest_py --coin=ltc cryptocoin - - $tooltest_py --coin=eth cryptocoin - - $tooltest_py --coin=etc cryptocoin - - $tooltest_py --coin=dash cryptocoin - - $tooltest_py --coin=doge cryptocoin - - $tooltest_py --coin=emc cryptocoin - - $tooltest_py --coin=xmr cryptocoin - - $tooltest_py --coin=zec cryptocoin + a $tooltest_py --coin=ltc cryptocoin + a $tooltest_py --coin=eth cryptocoin + a $tooltest_py --coin=etc cryptocoin + a $tooltest_py --coin=dash cryptocoin + a $tooltest_py --coin=doge cryptocoin + a $tooltest_py --coin=emc cryptocoin + a $tooltest_py --coin=xmr cryptocoin + a $tooltest_py --coin=zec cryptocoin z $tooltest_py --coin=zec --type=zcash_z cryptocoin " [ "$MSYS2" -o "$ARM32" -o "$ARM64" ] && t_tool_skip='z' +[ "$SKIP_ALT_DEP" ] && t_tool_skip='a z' f_tool='tooltest tests completed' i_gen='Gentest' -s_gen="The following tests will run '$gentest_py' for BTC and LTC mainnet and testnet" +s_gen="The following tests will run '$gentest_py' for configured coins and address types" t_gen=" - # speed tests, no verification: - $gentest_py --coin=btc 1 $rounds - $gentest_py --coin=btc --type=compressed 1 $rounds - $gentest_py --coin=btc --type=segwit 1 $rounds - $gentest_py --coin=btc --type=bech32 1 $rounds - - $gentest_py --coin=ltc 1 $rounds - - $gentest_py --coin=ltc --type=compressed 1 $rounds - - $gentest_py --coin=ltc --type=segwit 1 $rounds - - $gentest_py --coin=ltc --type=bech32 1 $rounds + a $gentest_py --coin=ltc 1 $rounds + a $gentest_py --coin=ltc --type=compressed 1 $rounds + a $gentest_py --coin=ltc --type=segwit 1 $rounds + a $gentest_py --coin=ltc --type=bech32 1 $rounds - # wallet dumps: - $gentest_py --type=compressed 1 $REFDIR/btcwallet.dump - $gentest_py --type=segwit 1 $REFDIR/btcwallet-segwit.dump - $gentest_py --type=bech32 1 $REFDIR/btcwallet-bech32.dump - $gentest_py --type=compressed --testnet=1 1 $REFDIR/btcwallet-testnet.dump - - $gentest_py --coin=ltc --type=compressed 1 $REFDIR/litecoin/ltcwallet.dump - - $gentest_py --coin=ltc --type=segwit 1 $REFDIR/litecoin/ltcwallet-segwit.dump - - $gentest_py --coin=ltc --type=bech32 1 $REFDIR/litecoin/ltcwallet-bech32.dump - - $gentest_py --coin=ltc --type=compressed --testnet=1 1 $REFDIR/litecoin/ltcwallet-testnet.dump + a $gentest_py --coin=ltc --type=compressed 1 $REFDIR/litecoin/ltcwallet.dump + a $gentest_py --coin=ltc --type=segwit 1 $REFDIR/litecoin/ltcwallet-segwit.dump + a $gentest_py --coin=ltc --type=bech32 1 $REFDIR/litecoin/ltcwallet-bech32.dump + a $gentest_py --coin=ltc --type=compressed --testnet=1 1 $REFDIR/litecoin/ltcwallet-testnet.dump - # libsecp256k1 vs python-ecdsa: - $gentest_py 1:2 $rounds - $gentest_py --type=segwit 1:2 $rounds - $gentest_py --type=bech32 1:2 $rounds - $gentest_py --testnet=1 1:2 $rounds - $gentest_py --testnet=1 --type=segwit 1:2 $rounds - - $gentest_py --coin=ltc 1:2 $rounds - - $gentest_py --coin=ltc --type=segwit 1:2 $rounds - - $gentest_py --coin=ltc --testnet=1 1:2 $rounds - - $gentest_py --coin=ltc --testnet=1 --type=segwit 1:2 $rounds - - # all backends vs pycoin: - - $gentest_py all:pycoin $rounds + a $gentest_py --coin=ltc 1:2 $rounds + a $gentest_py --coin=ltc --type=segwit 1:2 $rounds + a $gentest_py --coin=ltc --testnet=1 1:2 $rounds + a $gentest_py --coin=ltc --testnet=1 --type=segwit 1:2 $rounds + a # all backends vs pycoin: + a $gentest_py all:pycoin $rounds " + +[ "$SKIP_ALT_DEP" ] && t_gen_skip='a' f_gen='gentest tests completed' [ -d .git -a -n "$INSTALL" -a -z "$LIST_CMDS" ] && { diff --git a/test/test.py b/test/test.py index 4eea85f7..c233cd7e 100755 --- a/test/test.py +++ b/test/test.py @@ -100,6 +100,7 @@ opts_data = { 'options': """ -h, --help Print this help message --, --longhelp Print help message for long options (common options) +-a, --no-altcoin Skip altcoin tests (WIP) -A, --no-daemon-autostart Don't start and stop daemons automatically -B, --bech32 Generate and use Bech32 addresses -b, --buf-keypress Use buffered keypresses as with real human input diff --git a/test/test_py_d/ts_cfg.py b/test/test_py_d/ts_cfg.py index d1f51208..0673be03 100755 --- a/test/test_py_d/ts_cfg.py +++ b/test/test_py_d/ts_cfg.py @@ -171,6 +171,8 @@ class TestSuiteCfg(TestSuiteBase): ('ETH','True', '5.4321',True), ('ETC','False','5.4321',False) ): + if opt.no_altcoin and coin != 'BTC': + continue t = self.spawn_test( args = [ f'--coin={coin}', @@ -207,6 +209,9 @@ class TestSuiteCfg(TestSuiteBase): def chain_names(self): + if opt.no_altcoin: + return 'skip' + def run(chk,testnet): for coin,chain_chk in (('ETH',chk),('ETC',None)): t = self.spawn_test( diff --git a/test/test_py_d/ts_tool.py b/test/test_py_d/ts_tool.py index 87e4d020..cead2ffc 100755 --- a/test/test_py_d/ts_tool.py +++ b/test/test_py_d/ts_tool.py @@ -87,6 +87,8 @@ class TestSuiteTool(TestSuiteMain,TestSuiteBase): return t def tool_extract_key_from_geth_wallet(self): + if opt.no_altcoin: + return 'skip' fn = 'test/ref/ethereum/geth-wallet.json' key = '9627ddb68354f5e0ff45fb2da49d7a20a013b7257a83ef4adbbbd87aeaccc75e' t = self.spawn('mmgen-tool',['-d',self.tmpdir,'extract_key_from_geth_wallet',fn]) @@ -95,6 +97,9 @@ class TestSuiteTool(TestSuiteMain,TestSuiteBase): return t def tool_api(self): - t = self.spawn('tool_api_test.py',cmd_dir='test/misc') + t = self.spawn( + 'tool_api_test.py', + (['no_altcoin'] if opt.no_altcoin else []), + cmd_dir = 'test/misc' ) t.expect('legacy.*compressed.*segwit.*bech32',regex=True) return t diff --git a/test/unit_tests_d/ut_gen.py b/test/unit_tests_d/ut_gen.py index e76a2067..f6540399 100755 --- a/test/unit_tests_d/ut_gen.py +++ b/test/unit_tests_d/ut_gen.py @@ -83,6 +83,8 @@ def do_tests(coin,internal_keccak=False): class unit_tests: + altcoin_deps = ('eth','xmr','zec') + def btc(self,name,ut): return do_tests('btc')