cfg.sh 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. #!/bin/bash
  2. #
  3. # mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
  4. # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. all_tests="dep dev lint 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"
  11. groups_desc="
  12. default - All tests minus the extra tests
  13. extra - All tests minus the default tests
  14. noalt - BTC-only tests
  15. quick - Default tests minus btc_tn, bch, bch_rt, ltc and ltc_rt
  16. qskip - The tests skipped in the 'quick' test group
  17. "
  18. init_groups() {
  19. 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 etc xmr'
  20. extra_tests='dep dev lint autosign_btc autosign_live ltc_tn bch_tn'
  21. noalt_tests='dep alt obj color unit hash ref tool tool2 gen autosign_btc btc btc_tn btc_rt'
  22. quick_tests='dep alt obj color unit hash ref tool tool2 gen autosign btc btc_rt altref altgen eth etc xmr'
  23. qskip_tests='lint btc_tn bch bch_rt ltc ltc_rt'
  24. noalt_ok_tests='lint'
  25. [ "$MSYS2" ] && SKIP_LIST='autosign autosign_btc autosign_live'
  26. [ "$ARM32" -o "$ARM64" ] && SKIP_LIST+=' etc'
  27. true
  28. }
  29. init_tests() {
  30. REFDIR='test/ref'
  31. d_alt="altcoin module"
  32. t_alt="
  33. - python3 -m test.altcointest $altcoin_mod_opts
  34. "
  35. d_obj="data objects"
  36. t_obj="
  37. - $objtest_py --coin=btc
  38. - $objtest_py --getobj --coin=btc
  39. - $objtest_py --coin=btc --testnet=1
  40. a $objtest_py --coin=ltc
  41. a $objtest_py --coin=ltc --testnet=1
  42. a $objtest_py --coin=eth
  43. - $objattrtest_py
  44. "
  45. [ "$SKIP_ALT_DEP" ] && t_obj_skip='a'
  46. [ "$PYTHONOPTIMIZE" ] && {
  47. echo -e "${YELLOW}PYTHONOPTIMIZE set, skipping object tests$RESET"
  48. t_obj_skip='-'
  49. }
  50. d_color="color handling"
  51. t_color='- test/colortest.py'
  52. d_dep="system and testing dependencies"
  53. t_dep="- $unit_tests_py testdep dep daemon.exec"
  54. d_dev="developer scripts ${YELLOW}(additional dependencies required)$RESET"
  55. t_dev="
  56. - $cmdtest_py dev
  57. "
  58. d_lint="code errors with static code analyzer"
  59. t_lint="
  60. b $pylint --errors-only mmgen
  61. b $pylint --errors-only test
  62. b $pylint --errors-only --disable=relative-beyond-top-level test/cmdtest_py_d
  63. a $pylint --errors-only --ignore-paths '.*/eth/.*' mmgen
  64. a $pylint --errors-only --ignore-paths '.*/ut_dep.py,.*/ut_testdep.py' test
  65. a $pylint --errors-only --ignore-paths '.*/ct_ethdev.py' --disable=relative-beyond-top-level test/cmdtest_py_d
  66. - $pylint --errors-only examples
  67. "
  68. if [ "$SKIP_ALT_DEP" ]; then t_lint_skip='b'; else t_lint_skip='a'; fi
  69. d_unit="low-level subsystems"
  70. t_unit="- $unit_tests_py --exclude testdep,dep,daemon"
  71. d_hash="internal hash function implementations"
  72. t_hash="
  73. 256 $python test/hashfunc.py sha256 $rounds5x
  74. 512 $python test/hashfunc.py sha512 $rounds5x # native SHA512 - not used by the MMGen wallet
  75. keccak $python test/hashfunc.py keccak $rounds5x
  76. ripemd160 $python mmgen/contrib/ripemd160.py $VERBOSE $fast_opt
  77. "
  78. [ "$ARM32" ] && t_hash_skip='512' # gmpy produces invalid init constants
  79. [ "$MSYS2" ] && t_hash_skip='512' # 2:py_long_long issues
  80. [ "$SKIP_ALT_DEP" ] && t_hash_skip+=' keccak'
  81. d_ref="generated values against reference data"
  82. t_ref="
  83. - $scrambletest_py
  84. "
  85. d_altref="altcoin reference file checks"
  86. t_altref="
  87. - $cmdtest_py ref_altcoin # generated addrfiles verified against checksums
  88. "
  89. d_altgen="altcoin address generation"
  90. t_altgen="
  91. - # speed tests, no verification:
  92. - $gentest_py --coin=etc 1 $rounds10x
  93. - $gentest_py --coin=etc --use-internal-keccak-module 1 $rounds10x
  94. - $gentest_py --coin=eth 1 $rounds10x
  95. - $gentest_py --coin=eth --use-internal-keccak-module 1 $rounds10x
  96. - $gentest_py --coin=xmr 1 $rounds10x
  97. - $gentest_py --coin=xmr --use-internal-keccak-module 1 $rounds10x
  98. - $gentest_py --coin=zec 1 $rounds10x
  99. - $gentest_py --coin=zec --type=zcash_z 1 $rounds10x
  100. - # verification against external libraries and tools:
  101. - # pycoin
  102. - $gentest_py --all-coins --type=legacy 1:pycoin $rounds
  103. - $gentest_py --all-coins --type=compressed 1:pycoin $rounds
  104. - $gentest_py --all-coins --type=segwit 1:pycoin $rounds
  105. - $gentest_py --all-coins --type=bech32 1:pycoin $rounds
  106. - $gentest_py --all-coins --type=legacy --testnet=1 1:pycoin $rounds
  107. - $gentest_py --all-coins --type=compressed --testnet=1 1:pycoin $rounds
  108. - $gentest_py --all-coins --type=segwit --testnet=1 1:pycoin $rounds
  109. - $gentest_py --all-coins --type=bech32 --testnet=1 1:pycoin $rounds
  110. - # keyconv
  111. - $gentest_py --all-coins --type=legacy 1:keyconv $rounds_min
  112. - $gentest_py --all-coins --type=compressed 1:keyconv $rounds_min
  113. e # ethkey
  114. e $gentest_py --coin=eth 1:ethkey $rounds10x
  115. e $gentest_py --coin=eth --use-internal-keccak-module 2:ethkey $rounds5x
  116. m # monero-python
  117. m $gentest_py --coin=xmr 1:monero-python $rounds100x
  118. M $gentest_py --coin=xmr all:monero-python $rounds_min # very slow, please be patient!
  119. z # zcash-mini
  120. z $gentest_py --coin=zec --type=zcash_z all:zcash-mini $rounds50x
  121. "
  122. [ "$MSYS2" ] && t_altgen_skip='z' # no zcash-mini (golang)
  123. [ "$ARM32" ] && t_altgen_skip='z e'
  124. [ "$FAST" ] && t_altgen_skip+=' M'
  125. # ARM ethkey available only on Arch Linux:
  126. [ \( "$ARM32" -o "$ARM64" \) -a "$DISTRO" != 'archarm' ] && t_altgen_skip+=' e'
  127. d_xmr="Monero xmrwallet operations"
  128. t_xmr="
  129. - $HTTP_LONG_TIMEOUT$cmdtest_py$PEXPECT_LONG_TIMEOUT --coin=xmr
  130. "
  131. d_eth="operations for Ethereum using devnet"
  132. t_eth="geth $cmdtest_py --coin=eth ethdev"
  133. d_etc="operations for Ethereum Classic using devnet"
  134. t_etc="parity $cmdtest_py --coin=etc ethdev"
  135. d_autosign="transaction autosigning with automount"
  136. t_autosign="
  137. - $cmdtest_py autosign autosign_clean autosign_automount
  138. - $cmdtest_py --coin=bch autosign_automount
  139. s $cmdtest_py --coin=ltc autosign_automount
  140. - $cmdtest_py --coin=eth autosign_eth
  141. s $cmdtest_py --coin=etc autosign_eth
  142. "
  143. [ "$FAST" ] && t_autosign_skip='s'
  144. d_autosign_btc="transaction and message autosigning (Bitcoin only)"
  145. t_autosign_btc="- $cmdtest_py autosign_btc"
  146. d_autosign_btc="transaction and message autosigning (interactive)"
  147. t_autosign_live="- $cmdtest_py autosign_live"
  148. d_btc="overall operations with emulated RPC data (Bitcoin)"
  149. t_btc="
  150. - $cmdtest_py --exclude regtest,autosign,autosign_clean,autosign_automount,ref_altcoin
  151. - $cmdtest_py --segwit
  152. - $cmdtest_py --segwit-random
  153. - $cmdtest_py --bech32
  154. "
  155. d_btc_tn="overall operations with emulated RPC data (Bitcoin testnet)"
  156. t_btc_tn="
  157. - $cmdtest_py --testnet=1
  158. - $cmdtest_py --testnet=1 --segwit
  159. - $cmdtest_py --testnet=1 --segwit-random
  160. - $cmdtest_py --testnet=1 --bech32
  161. "
  162. d_btc_rt="overall operations using the regtest network (Bitcoin)"
  163. t_btc_rt="
  164. - $cmdtest_py regtest
  165. - $cmdtest_py regtest_legacy
  166. "
  167. d_bch="overall operations with emulated RPC data (Bitcoin Cash Node)"
  168. t_bch="- $cmdtest_py --coin=bch --exclude regtest"
  169. d_bch_tn="overall operations with emulated RPC data (Bitcoin Cash Node testnet)"
  170. t_bch_tn="- $cmdtest_py --coin=bch --testnet=1"
  171. d_bch_rt="overall operations using the regtest network (Bitcoin Cash Node)"
  172. t_bch_rt="- $cmdtest_py --coin=bch regtest"
  173. d_ltc="overall operations with emulated RPC data (Litecoin)"
  174. t_ltc="
  175. - $cmdtest_py --coin=ltc --exclude regtest
  176. - $cmdtest_py --coin=ltc --segwit
  177. - $cmdtest_py --coin=ltc --segwit-random
  178. - $cmdtest_py --coin=ltc --bech32
  179. "
  180. d_ltc_tn="overall operations with emulated RPC data (Litecoin testnet)"
  181. t_ltc_tn="
  182. - $cmdtest_py --coin=ltc --testnet=1
  183. - $cmdtest_py --coin=ltc --testnet=1 --segwit
  184. - $cmdtest_py --coin=ltc --testnet=1 --segwit-random
  185. - $cmdtest_py --coin=ltc --testnet=1 --bech32
  186. "
  187. d_ltc_rt="overall operations using the regtest network (Litecoin)"
  188. t_ltc_rt="- $cmdtest_py --coin=ltc regtest"
  189. d_tool2="'mmgen-tool' utility with data check"
  190. t_tool2="
  191. - $tooltest2_py --tool-api # test the tool_api subsystem
  192. - $tooltest2_py --tool-api --testnet=1
  193. e $tooltest2_py --tool-api --coin=eth
  194. a $tooltest2_py --tool-api --coin=xmr
  195. a $tooltest2_py --tool-api --coin=zec
  196. - $tooltest2_py
  197. - $tooltest2_py --testnet=1
  198. a $tooltest2_py --coin=ltc
  199. a $tooltest2_py --coin=ltc --testnet=1
  200. a $tooltest2_py --coin=bch
  201. a $tooltest2_py --coin=bch --testnet=1
  202. a $tooltest2_py --coin=zec
  203. a $tooltest2_py --coin=xmr
  204. a $tooltest2_py --coin=dash
  205. e $tooltest2_py --coin=eth
  206. e $tooltest2_py --coin=eth --testnet=1
  207. e $tooltest2_py --coin=eth --token=mm1
  208. e $tooltest2_py --coin=eth --token=mm1 --testnet=1
  209. e $tooltest2_py --coin=etc
  210. - $tooltest2_py --fork # run once with --fork so commands are actually executed
  211. "
  212. [ "$SKIP_ALT_DEP" ] && t_tool2_skip='a e' # skip ETH,ETC: txview requires py_ecc
  213. d_tool="'mmgen-tool' utility (all supported coins)"
  214. t_tool="
  215. - $tooltest_py --coin=btc cryptocoin
  216. - $tooltest_py --coin=btc mnemonic
  217. a $tooltest_py --coin=ltc cryptocoin
  218. a $tooltest_py --coin=eth cryptocoin
  219. a $tooltest_py --coin=etc cryptocoin
  220. a $tooltest_py --coin=dash cryptocoin
  221. a $tooltest_py --coin=doge cryptocoin
  222. a $tooltest_py --coin=emc cryptocoin
  223. a $tooltest_py --coin=xmr cryptocoin
  224. a $tooltest_py --coin=zec cryptocoin
  225. z $tooltest_py --coin=zec --type=zcash_z cryptocoin
  226. "
  227. [ "$MSYS2" -o "$ARM32" ] && t_tool_skip='z'
  228. [ "$SKIP_ALT_DEP" ] && t_tool_skip='a z'
  229. d_gen="Bitcoin and Litecoin address generation"
  230. t_gen="
  231. - # speed tests, no verification:
  232. - $gentest_py --coin=btc 1 $rounds10x
  233. - $gentest_py --coin=btc --type=compressed 1 $rounds10x
  234. - $gentest_py --coin=btc --type=segwit 1 $rounds10x
  235. - $gentest_py --coin=btc --type=bech32 1 $rounds10x
  236. a $gentest_py --coin=ltc 1 $rounds10x
  237. a $gentest_py --coin=ltc --type=compressed 1 $rounds10x
  238. a $gentest_py --coin=ltc --type=segwit 1 $rounds10x
  239. a $gentest_py --coin=ltc --type=bech32 1 $rounds10x
  240. - # wallet dumps:
  241. - $gentest_py --type=compressed 1 $REFDIR/btcwallet.dump
  242. - $gentest_py --type=segwit 1 $REFDIR/btcwallet-segwit.dump
  243. - $gentest_py --type=bech32 1 $REFDIR/btcwallet-bech32.dump
  244. - $gentest_py --type=compressed --testnet=1 1 $REFDIR/btcwallet-testnet.dump
  245. a $gentest_py --coin=ltc --type=compressed 1 $REFDIR/litecoin/ltcwallet.dump
  246. a $gentest_py --coin=ltc --type=segwit 1 $REFDIR/litecoin/ltcwallet-segwit.dump
  247. a $gentest_py --coin=ltc --type=bech32 1 $REFDIR/litecoin/ltcwallet-bech32.dump
  248. a $gentest_py --coin=ltc --type=compressed --testnet=1 1 $REFDIR/litecoin/ltcwallet-testnet.dump
  249. - # libsecp256k1 vs python-ecdsa:
  250. - $gentest_py --type=legacy 1:2 $rounds100x
  251. - $gentest_py --type=compressed 1:2 $rounds100x
  252. - $gentest_py --type=segwit 1:2 $rounds100x
  253. - $gentest_py --type=bech32 1:2 $rounds100x
  254. - $gentest_py --testnet=1 1:2 $rounds100x
  255. - $gentest_py --testnet=1 --type=segwit 1:2 $rounds100x
  256. a $gentest_py --coin=ltc 1:2 $rounds100x
  257. a $gentest_py --coin=ltc --type=segwit 1:2 $rounds100x
  258. a $gentest_py --coin=ltc --testnet=1 1:2 $rounds100x
  259. a $gentest_py --coin=ltc --testnet=1 --type=segwit 1:2 $rounds100x
  260. - # all backends vs pycoin:
  261. - $gentest_py all:pycoin $rounds100x
  262. "
  263. [ "$SKIP_ALT_DEP" ] && t_gen_skip='a'
  264. true
  265. }