ctf-tools/capstone/test
Steven Van Acker 7144e756e5 fail hard on any error + verify that all scripts use bash -ex to fail
early on any error + anticipate that some tools can't be installed by
now, but we still want the test to return success to satisfy travis-ci
2017-02-16 22:40:17 +01:00

33 lines
503 B
Bash
Executable file

#!/bin/bash -ex
PY_TEST_FILE=$(mktemp)
cat << END > $PY_TEST_FILE
from capstone import *
import sys
CODE = b"\x55\x48\x8b\x05\xb8\x13\x00\x00"
addresses = [0x1000, 0x1001]
md = Cs(CS_ARCH_X86, CS_MODE_64)
for idx, i in enumerate(md.disasm(CODE, 0x1000)):
if i.address != addresses[idx]:
sys.exit(1)
sys.exit(0)
END
source ${VIRTUALENVWRAPPER_SCRIPT}
set +e
workon ctftools
set -e
python $PY_TEST_FILE
deactivate
set +e
workon ctftools3
set -e
python $PY_TEST_FILE
deactivate
rm $PY_TEST_FILE