test-release.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. # Tested on Linux, MinGW-64
  3. set -e
  4. GREEN="\e[32;1m" YELLOW="\e[33;1m" RESET="\e[0m" BRANCH=$1
  5. REFDIR=test/ref
  6. if uname -a | grep -qi mingw; then SUDO='' MINGW=1; else SUDO='sudo' MINGW=''; fi
  7. function check {
  8. [ "$BRANCH" ] || { echo 'No branch specified. Exiting'; exit; }
  9. [ "$(git diff $BRANCH)" == "" ] || {
  10. echo "Unmerged changes from branch '$BRANCH'. Exiting"
  11. exit
  12. }
  13. git diff $BRANCH >/dev/null 2>&1 || exit
  14. }
  15. function install {
  16. set -x
  17. eval "$SUDO rm -rf .test-release"
  18. git clone --branch $BRANCH --single-branch . .test-release
  19. cd .test-release
  20. ./setup.py sdist
  21. mkdir pydist && cd pydist
  22. if [ "$MINGW" ]; then unzip ../dist/mmgen-*.zip; else tar zxvf ../dist/mmgen-*gz; fi
  23. cd mmgen-*
  24. scripts/deinstall.sh
  25. [ "$MINGW" ] && ./setup.py build --compiler=mingw32
  26. eval "$SUDO ./setup.py install"
  27. }
  28. function do_test {
  29. set +x
  30. for i in "${CMDS[@]}"; do
  31. echo -e "\n${GREEN}Running:$RESET $YELLOW$i$RESET"
  32. eval "$i"
  33. done
  34. }
  35. check
  36. (install)
  37. eval "cd .test-release/pydist/mmgen-*"
  38. CMDS=(
  39. 'test/test.py -On'
  40. 'test/test.py -On --segwit dfl_wallet main ref ref_other'
  41. 'test/test.py -On --segwit-random dfl_wallet main'
  42. )
  43. do_test
  44. CMDS=('test/test.py -On regtest')
  45. do_test
  46. # tooltest tests both segwit and non-segwit
  47. CMDS=(
  48. 'test/tooltest.py'
  49. "test/gentest.py -q 2 $REFDIR/btcwallet.dump"
  50. "test/gentest.py -q --testnet=1 2 $REFDIR/btcwallet-testnet.dump"
  51. 'test/gentest.py -q 1:2 10'
  52. 'test/gentest.py -q --segwit 1:2 10'
  53. # "scripts/tx-old2new.py -S $REFDIR/tx_*raw >/dev/null 2>&1"
  54. "scripts/compute-file-chksum.py $REFDIR/*testnet.rawtx >/dev/null 2>&1"
  55. )
  56. do_test
  57. echo -e "\n${GREEN}All OK$RESET"