3 if [ -z "$PYTHON" ]; then
12 if [ -z "$1" -o "$1" == "unit" ]; then
13 echo "=== test_unit ==="
14 $PYTHON -m nose
--version || nose_missing
=1
15 if [ -z "$nose_missing" ]; then
16 $PYTHON -m nose
-v || failed
21 echo "=== test_roundtrip ==="
22 for f
in tests
/pseudoc-roundtrip
/*.lst
; do
24 $PYTHON .
/parse_asm.py
--roundtrip --addr-width=2 --inst-indent=1 $f > $f.out || failed
25 diff -u $f.exp
$f.out || failed
30 echo "=== test_dump_c ==="
31 for f
in tests
/dump-c
/*.lst
; do
33 $PYTHON .
/dump_c.py
$f > $f.out || failed
34 diff -u $f.exp
$f.out || failed
39 echo "=== test_xform ==="
42 if [ ! -z "$1" ]; then
46 for f
in tests
/$pat.lst
; do
48 $PYTHON .
/apply_xform.py
--debug --annotate-calls --funcdb=none
--format=none
$f || failed
49 diff -u $f.exp.bb
$f.out.bb || failed
50 if [ -f $f.exp.dot
]; then
51 diff -u $f.exp.dot
$f.out.dot || failed
57 echo "=== test_decomp ==="
58 for dir
in tests
/decomp
/*; do
62 rm -f $dir/funcdb.yaml
63 $PYTHON .
/apply_xform.py
--log-level=WARNING
--script script_decompile
--format=c
$dir || failed
64 rm -f $dir/funcdb.yaml
65 $PYTHON .
/apply_xform.py
--log-level=ERROR
--script script_decompile
--format=c \
66 --no-dead --no-comments --output-suffix=.out.clean
$dir || failed
67 for f
in $dir/*.lst
; do
68 diff -u $f.exp
$f.out || failed
69 diff -u $f.exp.clean
$f.out.clean || failed
76 echo "=== test_cfg2pseudoc ==="
77 for f
in tests
/cfg2pseudoc
/*.dot
; do
78 if echo $f |
grep -q -E '(0|out)\.dot'; then
82 $PYTHON .
/sabl_cfg2pseudoc.py
$f > $f.lst || failed
83 diff -u $f.lst.exp
$f.lst || failed
84 $PYTHON .
/apply_xform.py
--debug --funcdb=none
$f.lst
>/dev
/null
88 # Be sure to remove any older test output, to miss a case when no new output
90 find tests
-name '*.out*' -exec rm {} \
;
92 if [ -z "$1" -o "$1" == "roundtrip" ]; then
95 if [ -z "$1" -o "$1" == "dump_c" ]; then
98 if [ -z "$1" -o "$1" == "xform" ]; then
101 if [ -z "$1" -o "$1" == "decomp" ]; then
104 if [ -z "$1" -o "$1" == "cfg2pseudoc" ]; then
109 if [ -n "$nose_missing" ]; then
111 echo "WARNING: unit tests were not run due to missing 'nose' package for python3"