test-release.sh 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. #!/bin/bash
  2. # Tested on Linux, Armbian, Raspbian, MSYS2
  3. REFDIR='test/ref'
  4. SUDO='sudo'
  5. if [ "$(uname -m)" == 'armv7l' ]; then
  6. ARM32=1
  7. elif [ "$(uname -m)" == 'aarch64' ]; then
  8. ARM64=1
  9. elif uname -a | grep -q 'MSYS'; then
  10. SUDO='' MSYS2=1;
  11. fi
  12. trap 'echo -e "${GREEN}Exiting at user request$RESET"; exit' INT
  13. umask 0022
  14. export MMGEN_TEST_SUITE=1
  15. export MMGEN_NO_LICENSE=1
  16. export PYTHONPATH=.
  17. test_py='test/test.py -n'
  18. objtest_py='test/objtest.py'
  19. objattrtest_py='test/objattrtest.py'
  20. colortest_py='test/colortest.py'
  21. unit_tests_py='test/unit_tests.py --names --quiet'
  22. tooltest_py='test/tooltest.py'
  23. tooltest2_py='test/tooltest2.py --names --quiet'
  24. gentest_py='test/gentest.py --quiet'
  25. scrambletest_py='test/scrambletest.py'
  26. altcoin_mod_opts='--quiet'
  27. mmgen_tool='cmds/mmgen-tool'
  28. mmgen_keygen='cmds/mmgen-keygen'
  29. python='python3'
  30. rounds=100 rounds_min=20 rounds_mid=250 rounds_max=500
  31. dfl_tests='dep 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'
  32. extra_tests='dep autosign_btc autosign_live ltc_tn bch_tn'
  33. noalt_tests='dep misc obj color unit hash ref autosign_btc btc btc_tn btc_rt tool tool2 gen'
  34. quick_tests='dep misc obj color unit hash ref altref alts xmr eth autosign btc btc_rt tool tool2 gen'
  35. qskip_tests='btc_tn bch bch_rt ltc ltc_rt'
  36. [ "$MSYS2" ] && SKIP_LIST='autosign autosign_btc autosign_live'
  37. ORIG_ARGS=$@
  38. PROGNAME=$(basename $0)
  39. while getopts hAbCdDfFlNOps:StvV OPT
  40. do
  41. case "$OPT" in
  42. h) printf " %-16s Test MMGen release\n" "${PROGNAME}:"
  43. echo " USAGE: $PROGNAME [options] [tests or test group]"
  44. echo " OPTIONS: -h Print this help message"
  45. echo " -A Skip tests requiring altcoin modules or daemons"
  46. echo " -b Buffer keypresses for all invocations of 'test/test.py'"
  47. echo " -C Run tests in coverage mode"
  48. echo " -d Enable Python Development Mode"
  49. echo " -D Run tests in deterministic mode"
  50. echo " -f Speed up the tests by using fewer rounds"
  51. echo " -F Reduce rounds even further"
  52. echo " -l List the test name symbols"
  53. echo " -N Pass the --no-timings switch to test/test.py"
  54. echo " -O Use pexpect.spawn rather than popen_spawn where applicable"
  55. echo " -p Pause between tests"
  56. echo " -s LIST Skip tests in LIST (space-separated)"
  57. echo " -S Build SDIST distribution, unpack, and run test in unpacked dir"
  58. echo " -t Print the tests without running them"
  59. echo " -v Run test/test.py with '--exact-output' and other commands"
  60. echo " with '--verbose' switch"
  61. echo " -V Run test/test.py and other commands with '--verbose' switch"
  62. echo
  63. echo " AVAILABLE TESTS:"
  64. echo " obj - data objects"
  65. echo " color - color handling"
  66. echo " unit - unit tests"
  67. echo " hash - internal hash function implementations"
  68. echo " ref - reference file checks"
  69. echo " altref - altcoin reference file checks"
  70. echo " alts - operations for all supported gen-only altcoins"
  71. echo " xmr - Monero xmrwallet operations"
  72. echo " eth - operations for Ethereum and Ethereum Classic"
  73. echo " autosign - autosign"
  74. echo " btc - bitcoin"
  75. echo " btc_tn - bitcoin testnet"
  76. echo " btc_rt - bitcoin regtest"
  77. echo " bch - bitcoin cash (BCH)"
  78. echo " bch_tn - bitcoin cash (BCH) testnet"
  79. echo " bch_rt - bitcoin cash (BCH) regtest"
  80. echo " ltc - litecoin"
  81. echo " ltc_tn - litecoin testnet"
  82. echo " ltc_rt - litecoin regtest"
  83. echo " tool - tooltest (all supported coins)"
  84. echo " tool2 - tooltest2 (all supported coins)"
  85. echo " gen - gentest (all supported coins)"
  86. echo " misc - miscellaneous tests that don't fit in the above categories"
  87. echo
  88. echo " AVAILABLE TEST GROUPS:"
  89. echo " default - All tests minus the extra tests"
  90. echo " extra - All tests minus the default tests"
  91. echo " noalt - BTC-only tests"
  92. echo " quick - Default tests minus btc_tn, bch, bch_rt, ltc and ltc_rt"
  93. echo " qskip - The tests skipped in the 'quick' test group"
  94. echo
  95. echo " By default, all tests are run"
  96. exit ;;
  97. A) SKIP_ALT_DEP=1
  98. test_py+=" --no-altcoin"
  99. unit_tests_py+=" --no-altcoin-deps"
  100. scrambletest_py+=" --no-altcoin" ;;
  101. b) test_py+=" --buf-keypress" ;;
  102. C) mkdir -p 'test/trace'
  103. touch 'test/trace.acc'
  104. test_py+=" --coverage"
  105. tooltest_py+=" --coverage"
  106. tooltest2_py+=" --fork --coverage"
  107. scrambletest_py+=" --coverage"
  108. python="python3 -m trace --count --file=test/trace.acc --coverdir=test/trace"
  109. unit_tests_py="$python $unit_tests_py"
  110. objtest_py="$python $objtest_py"
  111. objattrtest_py="$python $objattrtest_py"
  112. gentest_py="$python $gentest_py"
  113. mmgen_tool="$python $mmgen_tool"
  114. mmgen_keygen="$python $mmgen_keygen" ;&
  115. d) export PYTHONDEVMODE=1
  116. export PYTHONWARNINGS='error' ;;
  117. D) export MMGEN_TEST_SUITE_DETERMINISTIC=1
  118. export MMGEN_DISABLE_COLOR=1 ;;
  119. f) FAST=1 rounds=10 rounds_min=3 rounds_mid=25 rounds_max=50 unit_tests_py+=" --fast" ;;
  120. F) FAST=1 rounds=3 rounds_min=1 rounds_mid=3 rounds_max=5 unit_tests_py+=" --fast" ;;
  121. l) echo -e "Default tests:\n $dfl_tests"
  122. echo -e "Extra tests:\n $extra_tests"
  123. echo -e "'noalt' test group:\n $noalt_tests"
  124. echo -e "'quick' test group:\n $quick_tests"
  125. echo -e "'qskip' test group:\n $qskip_tests"
  126. exit ;;
  127. N) test_py+=" --no-timings" ;;
  128. O) test_py+=" --pexpect-spawn" ;;
  129. p) PAUSE=1 ;;
  130. s) SKIP_LIST+=" $OPTARG" ;;
  131. S) SDIST_TEST=1 ;;
  132. t) LIST_CMDS=1 ;;
  133. v) EXACT_OUTPUT=1 test_py+=" --exact-output" ;&
  134. V) VERBOSE='--verbose'
  135. [ "$EXACT_OUTPUT" ] || test_py+=" --verbose"
  136. unit_tests_py="${unit_tests_py/--quiet/--verbose}"
  137. altcoin_mod_opts="${altcoin_mod_opts/--quiet/--verbose}"
  138. tooltest2_py="${tooltest2_py/--quiet/--verbose}"
  139. gentest_py="${gentest_py/--quiet/--verbose}"
  140. tooltest_py+=" --verbose"
  141. mmgen_tool+=" --verbose"
  142. objattrtest_py+=" --verbose"
  143. scrambletest_py+=" --verbose" ;;
  144. *) exit ;;
  145. esac
  146. done
  147. [ "$MMGEN_DISABLE_COLOR" ] || {
  148. RED="\e[31;1m" GREEN="\e[32;1m" YELLOW="\e[33;1m" BLUE="\e[34;1m" MAGENTA="\e[35;1m" CYAN="\e[36;1m"
  149. RESET="\e[0m"
  150. }
  151. [ "$MSYS2" -a ! "$FAST" ] && tooltest2_py+=' --fork'
  152. [ "$EXACT_OUTPUT" -o "$VERBOSE" ] || objtest_py+=" -S"
  153. shift $((OPTIND-1))
  154. [ "$SDIST_TEST" -a -z "$MMGEN_TEST_RELEASE_IN_SDIST" ] && {
  155. test_dir='.sdist-test'
  156. rm -rf build dist MMGen.egg-info $test_dir
  157. python3 -m build --no-isolation --sdist
  158. mkdir $test_dir
  159. tar -C $test_dir -axf dist/*.tar.gz
  160. cd $test_dir/MMGen-*
  161. python3 setup.py build_ext --inplace
  162. echo -e "\n${BLUE}Running 'test/test-release $ORIG_ARGS'$RESET $YELLOW[PWD=$PWD]$RESET\n"
  163. export MMGEN_TEST_RELEASE_IN_SDIST=1
  164. test/test-release.sh $ORIG_ARGS
  165. exit
  166. }
  167. case $1 in
  168. '') tests=$dfl_tests ;;
  169. 'default') tests=$dfl_tests ;;
  170. 'extra') tests=$extra_tests ;;
  171. 'noalt') tests=$noalt_tests
  172. SKIP_ALT_DEP=1
  173. test_py+=" --no-altcoin"
  174. unit_tests_py+=" --no-altcoin-deps"
  175. scrambletest_py+=" --no-altcoin" ;;
  176. 'quick') tests=$quick_tests ;;
  177. 'qskip') tests=$qskip_tests ;;
  178. *) tests="$*" ;;
  179. esac
  180. set -e
  181. do_test() {
  182. set +x
  183. tests="t_$1"
  184. skips="t_$1_skip"
  185. while read skip test; do
  186. [ "$test" ] || continue
  187. echo "${!skips}" | grep -q $skip && continue
  188. if [ "$LIST_CMDS" ]; then
  189. echo $test
  190. else
  191. test_disp=$YELLOW${test/\#/$RESET$MAGENTA\#}$RESET
  192. if [ "${test:0:1}" == '#' ]; then
  193. echo -e "$test_disp"
  194. else
  195. echo -e "${GREEN}Running:$RESET $test_disp"
  196. eval "$test" || {
  197. echo -e $RED"test-release.sh: test '$CUR_TEST' failed at command '$test'"$RESET
  198. exit 1
  199. }
  200. fi
  201. fi
  202. done <<<${!tests}
  203. }
  204. i_misc='Miscellaneous'
  205. s_misc='Testing various subsystems'
  206. t_misc="
  207. - python3 -m mmgen.altcoin $altcoin_mod_opts
  208. "
  209. f_misc='Miscellaneous tests completed'
  210. i_obj='Data object'
  211. s_obj='Testing data objects'
  212. t_obj="
  213. - $objtest_py --coin=btc
  214. - $objtest_py --getobj --coin=btc
  215. - $objtest_py --coin=btc --testnet=1
  216. - $objtest_py --coin=ltc
  217. - $objtest_py --coin=ltc --testnet=1
  218. - $objtest_py --coin=eth
  219. - $objattrtest_py
  220. "
  221. f_obj='Data object tests completed'
  222. [ "$PYTHONOPTIMIZE" ] && {
  223. echo -e "${YELLOW}PYTHONOPTIMIZE set, skipping object tests$RESET"
  224. t_obj_skip='-'
  225. }
  226. i_color='Color'
  227. s_color='Testing terminal colors'
  228. t_color="- $colortest_py"
  229. f_color='Terminal color tests completed'
  230. i_dep='Dependency'
  231. s_dep='Testing for installed dependencies'
  232. t_dep="- $unit_tests_py testdep dep daemon.exec"
  233. f_dep='Dependency tests completed'
  234. i_unit='Unit'
  235. s_unit='The bitcoin and bitcoin-bchn mainnet daemons must be running for the following tests'
  236. t_unit="- $unit_tests_py --exclude testdep,dep,daemon"
  237. f_unit='Unit tests completed'
  238. i_hash='Internal hash function implementations'
  239. s_hash='Testing internal hash function implementations'
  240. t_hash="
  241. 256 $python test/hashfunc.py sha256 $rounds_max
  242. 512 $python test/hashfunc.py sha512 $rounds_max # native SHA512 - not used by the MMGen wallet
  243. keccak $python test/hashfunc.py keccak $rounds_max
  244. ripemd160 $python mmgen/contrib/ripemd160.py $VERBOSE
  245. "
  246. f_hash='Hash function tests completed'
  247. [ "$ARM32" ] && t_hash_skip='512' # gmpy produces invalid init constants
  248. [ "$MSYS2" ] && t_hash_skip='512 keccak' # 2:py_long_long issues, 3:no pysha3 for keccak reference
  249. [ "$SKIP_ALT_DEP" ] && t_hash_skip+=' keccak'
  250. i_ref='Miscellaneous reference data'
  251. s_ref='The following tests will test some generated values against reference data'
  252. t_ref="
  253. - $scrambletest_py
  254. "
  255. f_ref='Miscellaneous reference data tests completed'
  256. i_altref='Altcoin reference file'
  257. s_altref='The following tests will test some generated altcoin files against reference data'
  258. t_altref="
  259. - $test_py ref_altcoin # generated addrfiles verified against checksums
  260. "
  261. f_altref='Altcoin reference file tests completed'
  262. i_alts='Gen-only altcoin'
  263. s_alts='The following tests will test generation operations for all supported altcoins'
  264. t_alts="
  265. - # speed tests, no verification:
  266. - $gentest_py --coin=etc 1 $rounds
  267. - $gentest_py --coin=etc --use-internal-keccak-module 1 $rounds_min
  268. - $gentest_py --coin=eth 1 $rounds
  269. - $gentest_py --coin=eth --use-internal-keccak-module 1 $rounds_min
  270. - $gentest_py --coin=xmr 1 $rounds
  271. - $gentest_py --coin=xmr --use-internal-keccak-module 1 $rounds_min
  272. - $gentest_py --coin=zec 1 $rounds
  273. - $gentest_py --coin=zec --type=zcash_z 1 $rounds_mid
  274. - # verification against external libraries and tools:
  275. - # pycoin
  276. - $gentest_py --all-coins --type=legacy 1:pycoin $rounds
  277. - $gentest_py --all-coins --type=compressed 1:pycoin $rounds
  278. - $gentest_py --all-coins --type=segwit 1:pycoin $rounds
  279. - $gentest_py --all-coins --type=bech32 1:pycoin $rounds
  280. - $gentest_py --all-coins --type=legacy --testnet=1 1:pycoin $rounds
  281. - $gentest_py --all-coins --type=compressed --testnet=1 1:pycoin $rounds
  282. - $gentest_py --all-coins --type=segwit --testnet=1 1:pycoin $rounds
  283. - $gentest_py --all-coins --type=bech32 --testnet=1 1:pycoin $rounds
  284. - # keyconv
  285. - $gentest_py --all-coins --type=legacy 1:keyconv $rounds
  286. - $gentest_py --all-coins --type=compressed 1:keyconv $rounds
  287. e # ethkey
  288. e $gentest_py --coin=eth 1:ethkey $rounds
  289. e $gentest_py --coin=eth --use-internal-keccak-module 2:ethkey $rounds_mid
  290. m # moneropy
  291. m $gentest_py --coin=xmr all:moneropy $rounds_mid # very slow, please be patient!
  292. z # zcash-mini
  293. z $gentest_py --coin=zec --type=zcash_z all:zcash-mini $rounds_mid
  294. "
  295. [ "$MSYS2" ] && t_alts_skip='m z' # no moneropy (pysha3), zcash-mini (golang)
  296. [ "$ARM32" ] && t_alts_skip='z e'
  297. f_alts='Gen-only altcoin tests completed'
  298. create_tmpdir() {
  299. if [ "$MSYS2" ]; then
  300. TMPDIR='/tmp/mmgen-test-release'
  301. else
  302. TMPDIR='/tmp/mmgen-test-release-'$(cat /dev/urandom | base32 - | head -n1 | cut -b 1-16)
  303. fi
  304. mkdir -p $TMPDIR
  305. }
  306. rm -rf /tmp/mmgen-test-release*
  307. create_tmpdir
  308. i_xmr='Monero'
  309. s_xmr='Testing Monero operations'
  310. t_xmr="
  311. - $test_py --coin=xmr
  312. "
  313. f_xmr='Monero tests completed'
  314. i_eth='Ethereum'
  315. s_eth='Testing transaction and tracking wallet operations for Ethereum'
  316. t_eth="
  317. oe $test_py --coin=eth --daemon-id=openethereum ethdev
  318. geth $test_py --coin=eth --daemon-id=geth ethdev
  319. parity $test_py --coin=etc ethdev
  320. "
  321. f_eth='Ethereum tests completed'
  322. [ "$FAST" ] && t_eth_skip='oe'
  323. [ "$ARM32" -o "$ARM64" ] && t_eth_skip='oe parity'
  324. i_autosign='Autosign'
  325. s_autosign='The bitcoin, bitcoin-bchn and litecoin mainnet and testnet daemons must be running for the following test'
  326. t_autosign="- $test_py autosign"
  327. f_autosign='Autosign test completed'
  328. i_autosign_btc='Autosign BTC'
  329. s_autosign_btc='The bitcoin mainnet and testnet daemons must be running for the following test'
  330. t_autosign_btc="- $test_py autosign_btc"
  331. f_autosign_btc='Autosign BTC test completed'
  332. i_autosign_live='Autosign Live'
  333. s_autosign_live="The bitcoin mainnet and testnet daemons must be running for the following test\n"
  334. s_autosign_live+="${YELLOW}Mountpoint, '/etc/fstab' and removable device must be configured "
  335. s_autosign_live+="as described in 'mmgen-autosign --help'${RESET}"
  336. t_autosign_live="- $test_py autosign_live"
  337. f_autosign_live='Autosign Live test completed'
  338. i_btc='Bitcoin mainnet'
  339. s_btc='The bitcoin (mainnet) daemon must both be running for the following tests'
  340. t_btc="
  341. - $test_py --exclude regtest,autosign,ref_altcoin
  342. - $test_py --segwit
  343. - $test_py --segwit-random
  344. - $test_py --bech32
  345. - $python scripts/compute-file-chksum.py $REFDIR/*testnet.rawtx >/dev/null 2>&1
  346. "
  347. f_btc='Bitcoin mainnet tests completed'
  348. i_btc_tn='Bitcoin testnet'
  349. s_btc_tn='The bitcoin testnet daemon must both be running for the following tests'
  350. t_btc_tn="
  351. - $test_py --testnet=1
  352. - $test_py --testnet=1 --segwit
  353. - $test_py --testnet=1 --segwit-random
  354. - $test_py --testnet=1 --bech32
  355. "
  356. f_btc_tn='Bitcoin testnet tests completed'
  357. i_btc_rt='Bitcoin regtest'
  358. s_btc_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
  359. t_btc_rt="- $test_py regtest"
  360. f_btc_rt='Regtest (Bob and Alice) mode tests for BTC completed'
  361. i_bch='BitcoinCashNode (BCH) mainnet'
  362. s_bch='The bitcoin-bchn mainnet daemon must both be running for the following tests'
  363. t_bch="- $test_py --coin=bch --exclude regtest"
  364. f_bch='BitcoinCashNode (BCH) mainnet tests completed'
  365. i_bch_tn='BitcoinCashNode (BCH) testnet'
  366. s_bch_tn='The bitcoin-bchn testnet daemon must both be running for the following tests'
  367. t_bch_tn="- $test_py --coin=bch --testnet=1 --exclude regtest"
  368. f_bch_tn='BitcoinCashNode (BCH) testnet tests completed'
  369. i_bch_rt='BitcoinCashNode (BCH) regtest'
  370. s_bch_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
  371. t_bch_rt="- $test_py --coin=bch regtest"
  372. f_bch_rt='Regtest (Bob and Alice) mode tests for BCH completed'
  373. i_ltc='Litecoin'
  374. s_ltc='The litecoin mainnet daemon must both be running for the following tests'
  375. t_ltc="
  376. - $test_py --coin=ltc --exclude regtest
  377. - $test_py --coin=ltc --segwit
  378. - $test_py --coin=ltc --segwit-random
  379. - $test_py --coin=ltc --bech32
  380. "
  381. f_ltc='Litecoin mainnet tests completed'
  382. i_ltc_tn='Litecoin testnet'
  383. s_ltc_tn='The litecoin testnet daemon must both be running for the following tests'
  384. t_ltc_tn="
  385. - $test_py --coin=ltc --testnet=1 --exclude regtest
  386. - $test_py --coin=ltc --testnet=1 --segwit
  387. - $test_py --coin=ltc --testnet=1 --segwit-random
  388. - $test_py --coin=ltc --testnet=1 --bech32
  389. "
  390. f_ltc_tn='Litecoin testnet tests completed'
  391. i_ltc_rt='Litecoin regtest'
  392. s_ltc_rt="The following tests will test MMGen's regtest (Bob and Alice) mode"
  393. t_ltc_rt="- $test_py --coin=ltc regtest"
  394. f_ltc_rt='Regtest (Bob and Alice) mode tests for LTC completed'
  395. i_tool2='Tooltest2'
  396. s_tool2="The following tests will run '$tooltest2_py' for all supported coins"
  397. t_tool2="
  398. - $tooltest2_py --tool-api # test the tool_api subsystem
  399. - $tooltest2_py --tool-api --testnet=1
  400. e $tooltest2_py --tool-api --coin=eth
  401. a $tooltest2_py --tool-api --coin=xmr
  402. a $tooltest2_py --tool-api --coin=zec
  403. - $tooltest2_py
  404. - $tooltest2_py --testnet=1
  405. a $tooltest2_py --coin=ltc
  406. a $tooltest2_py --coin=ltc --testnet=1
  407. a $tooltest2_py --coin=bch
  408. a $tooltest2_py --coin=bch --testnet=1
  409. a $tooltest2_py --coin=zec
  410. a $tooltest2_py --coin=xmr
  411. a $tooltest2_py --coin=dash
  412. e $tooltest2_py --coin=eth
  413. e $tooltest2_py --coin=eth --testnet=1
  414. e $tooltest2_py --coin=eth --token=mm1
  415. e $tooltest2_py --coin=eth --token=mm1 --testnet=1
  416. e $tooltest2_py --coin=etc
  417. - $tooltest2_py --fork # run once with --fork so commands are actually executed
  418. "
  419. f_tool2='tooltest2 tests completed'
  420. [ "$SKIP_ALT_DEP" ] && t_tool2_skip='a e' # skip ETH,ETC: txview requires py_ecc
  421. i_tool='Tooltest'
  422. s_tool="The following tests will run '$tooltest_py' for all supported coins"
  423. t_tool="
  424. - $tooltest_py --coin=btc cryptocoin
  425. - $tooltest_py --coin=btc mnemonic
  426. a $tooltest_py --coin=ltc cryptocoin
  427. a $tooltest_py --coin=eth cryptocoin
  428. a $tooltest_py --coin=etc cryptocoin
  429. a $tooltest_py --coin=dash cryptocoin
  430. a $tooltest_py --coin=doge cryptocoin
  431. a $tooltest_py --coin=emc cryptocoin
  432. a $tooltest_py --coin=xmr cryptocoin
  433. a $tooltest_py --coin=zec cryptocoin
  434. z $tooltest_py --coin=zec --type=zcash_z cryptocoin
  435. "
  436. [ "$MSYS2" -o "$ARM32" ] && t_tool_skip='z'
  437. [ "$SKIP_ALT_DEP" ] && t_tool_skip='a z'
  438. f_tool='tooltest tests completed'
  439. i_gen='Gentest'
  440. s_gen="The following tests will run '$gentest_py' for configured coins and address types"
  441. t_gen="
  442. - # speed tests, no verification:
  443. - $gentest_py --coin=btc 1 $rounds
  444. - $gentest_py --coin=btc --type=compressed 1 $rounds
  445. - $gentest_py --coin=btc --type=segwit 1 $rounds
  446. - $gentest_py --coin=btc --type=bech32 1 $rounds
  447. a $gentest_py --coin=ltc 1 $rounds
  448. a $gentest_py --coin=ltc --type=compressed 1 $rounds
  449. a $gentest_py --coin=ltc --type=segwit 1 $rounds
  450. a $gentest_py --coin=ltc --type=bech32 1 $rounds
  451. - # wallet dumps:
  452. - $gentest_py --type=compressed 1 $REFDIR/btcwallet.dump
  453. - $gentest_py --type=segwit 1 $REFDIR/btcwallet-segwit.dump
  454. - $gentest_py --type=bech32 1 $REFDIR/btcwallet-bech32.dump
  455. - $gentest_py --type=compressed --testnet=1 1 $REFDIR/btcwallet-testnet.dump
  456. a $gentest_py --coin=ltc --type=compressed 1 $REFDIR/litecoin/ltcwallet.dump
  457. a $gentest_py --coin=ltc --type=segwit 1 $REFDIR/litecoin/ltcwallet-segwit.dump
  458. a $gentest_py --coin=ltc --type=bech32 1 $REFDIR/litecoin/ltcwallet-bech32.dump
  459. a $gentest_py --coin=ltc --type=compressed --testnet=1 1 $REFDIR/litecoin/ltcwallet-testnet.dump
  460. - # libsecp256k1 vs python-ecdsa:
  461. - $gentest_py 1:2 $rounds
  462. - $gentest_py --type=segwit 1:2 $rounds
  463. - $gentest_py --type=bech32 1:2 $rounds
  464. - $gentest_py --testnet=1 1:2 $rounds
  465. - $gentest_py --testnet=1 --type=segwit 1:2 $rounds
  466. a $gentest_py --coin=ltc 1:2 $rounds
  467. a $gentest_py --coin=ltc --type=segwit 1:2 $rounds
  468. a $gentest_py --coin=ltc --testnet=1 1:2 $rounds
  469. a $gentest_py --coin=ltc --testnet=1 --type=segwit 1:2 $rounds
  470. - # all backends vs pycoin:
  471. - $gentest_py all:pycoin $rounds
  472. "
  473. [ "$SKIP_ALT_DEP" ] && t_gen_skip='a'
  474. f_gen='gentest tests completed'
  475. prompt_skip() {
  476. echo -n "Enter 's' to skip, or ENTER to continue: "; read -n1; echo
  477. [ "$REPLY" == 's' ] && return 0
  478. return 1
  479. }
  480. run_tests() {
  481. [ "$LIST_CMDS" ] || echo "Running tests: $1"
  482. for t in $1; do
  483. if [ "$SKIP_ALT_DEP" ]; then
  484. ok=$(for a in $noalt_tests; do if [ $t == $a ]; then echo 'ok'; fi; done)
  485. if [ ! "$ok" ]; then
  486. echo -e "${BLUE}Skipping altcoin test '$t'$RESET"
  487. continue
  488. fi
  489. fi
  490. if [ "$LIST_CMDS" ]; then
  491. eval echo -e '\\n#' $(echo \$i_$t) "\($t\)"
  492. else
  493. eval echo -e "'\n'"\${GREEN}'###' Running $(echo \$i_$t) tests\$RESET
  494. eval echo -e $(echo \$s_$t)
  495. fi
  496. [ "$PAUSE" ] && prompt_skip && continue
  497. CUR_TEST=$t
  498. do_test $t
  499. [ "$LIST_CMDS" ] || eval echo -e $(echo \$f_$t)
  500. done
  501. }
  502. check_args() {
  503. for i in $tests; do
  504. echo "$dfl_tests $extra_tests" | grep -q "\<$i\>" || {
  505. echo "$i: unrecognized argument"
  506. exit 1
  507. }
  508. done
  509. }
  510. remove_skipped_tests() {
  511. tests=$(for t in $tests; do
  512. [ "$(for s in $SKIP_LIST; do [ $t == $s ] && echo y; done)" ] && continue
  513. echo $t
  514. done)
  515. tests=$(echo $tests)
  516. }
  517. remove_skipped_tests
  518. check_args
  519. start_time=$(date +%s)
  520. run_tests "$tests"
  521. elapsed=$(($(date +%s)-start_time))
  522. elapsed_fmt=$(printf %02d:%02d $((elapsed/60)) $((elapsed%60)))
  523. [ "$LIST_CMDS" ] || {
  524. if [ "$MMGEN_TEST_SUITE_DETERMINISTIC" ]; then
  525. echo -e "${GREEN}All OK"
  526. else
  527. echo -e "${GREEN}All OK. Total elapsed time: $elapsed_fmt$RESET"
  528. fi
  529. }