mmgen-regtest: test suite support, mswin bugfixes

tx.view(): refactor, bugfixes
new script: test-release.sh
This commit is contained in:
philemon 2017-09-19 22:14:00 +03:00
commit 50f55b9790
Signed by untrusted user who does not match committer: mmgen
GPG key ID: 62DBE9E5212F05BE
16 changed files with 652 additions and 162 deletions

68
scripts/test-release.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash
# Tested on Linux, MinGW-64
set -e
GREEN="\e[32;1m" YELLOW="\e[33;1m" RESET="\e[0m" BRANCH=$1
REFDIR=test/ref
if uname -a | grep -qi mingw; then SUDO='' MINGW=1; else SUDO='sudo' MINGW=''; fi
function check {
[ "$BRANCH" ] || { echo 'No branch specified. Exiting'; exit; }
[ "$(git diff $BRANCH)" == "" ] || {
echo "Unmerged changes from branch '$BRANCH'. Exiting"
exit
}
git diff $BRANCH >/dev/null 2>&1 || exit
}
function install {
set -x
eval "$SUDO rm -rf .test-release"
git clone --branch $BRANCH --single-branch . .test-release
cd .test-release
./setup.py sdist
mkdir pydist && cd pydist
if [ "$MINGW" ]; then unzip ../dist/mmgen-*.zip; else tar zxvf ../dist/mmgen-*gz; fi
cd mmgen-*
scripts/deinstall.sh
[ "$MINGW" ] && ./setup.py build --compiler=mingw32
eval "$SUDO ./setup.py install"
}
function do_test {
set +x
for i in "${CMDS[@]}"; do
echo -e "\n${GREEN}Running:$RESET $YELLOW$i$RESET"
eval "$i"
done
}
check
(install)
eval "cd .test-release/pydist/mmgen-*"
CMDS=(
'test/test.py -On'
'test/test.py -On --segwit dfl_wallet main ref ref_other'
'test/test.py -On --segwit-random dfl_wallet main'
)
do_test
CMDS=('test/test.py -On regtest')
do_test
# tooltest tests both segwit and non-segwit
CMDS=(
'test/tooltest.py'
"test/gentest.py -q 2 $REFDIR/btcwallet.dump"
"test/gentest.py -q --testnet=1 2 $REFDIR/btcwallet-testnet.dump"
'test/gentest.py -q 1:2 10'
'test/gentest.py -q --segwit 1:2 10'
# "scripts/tx-old2new.py -S $REFDIR/tx_*raw >/dev/null 2>&1"
"scripts/compute-file-chksum.py $REFDIR/*testnet.rawtx >/dev/null 2>&1"
)
do_test
echo -e "\n${GREEN}All OK$RESET"

View file

@ -10,7 +10,8 @@ try:
sys.argv.pop(0)
execfile(sys.argv[0])
except SystemExit:
sys.exit(int(str(sys.exc_info()[1])))
e = sys.exc_info()
sys.exit(int(str(e[1])))
except:
l = traceback.format_exception(*sys.exc_info())
exc = l.pop()
@ -18,3 +19,4 @@ except:
def yellow(s): return '{e}[33;1m{}{e}[0m'.format(s,e='\033')
sys.stdout.write('{}{}'.format(yellow(''.join(l)),red(exc)))
traceback.print_exc(file=f)