2 exec 3>&2 4>&1 5>output 2>&5 >&5 6>/dev/null
4 echo -n "testing $1 for existence..."
5 test -f $1 || (touch failed;echo -n "not there" >&5;return;)
7 echo -n "testing $1 for wellformedness..."
8 ./swfdump $1 | tail -n 1 | grep '\b0 END\b' >&6 2>&6 || (touch failed;echo -n "wrong end";return;)
9 ./swfdump $1 | grep 'rfxswf|warning|error|bounds' >&6 2>&6 && (touch failed;echo -n "error";return;)
10 ./swfdump $1 2>&1 >&6 | grep '^.*$' >&6 2>&6 && (touch failed;echo -n "swfdump stderr";./swfdump $1 >&6 2>&5;return;)
14 test -f failed || echo '
\e[01;32m succeeded' >&4
15 test -f failed && echo '
\e[01;31m failed' >&4
18 echo '===========================' >&5
20 echo '===========================' >&5
24 echo -n "
\e[01;37mTest \"${test}\"..." >&4
25 echo "================== starting test ${test} ===================" >&5
30 echo "running ${swfc} ${file}...">&5
32 catchsegv ${swfc} $file $@ >test.s 2>test.s2
33 test -s test.s2 && (touch failed;cat test.s2 >&5)
34 grep 'Segmentation fault' test.s && (touch failed)
35 rm -f test.s test.s2 2>&6
53 testswffile output.swf
57 rm -f file1.swf file2.swf
64 .shape monkey "file2.swf"
74 rm -f file.swf output.swf
78 .put mybox end #should cause an error
83 test -f output.swf && touch failed
87 rm -f file.swf output.swf
93 test -f output.swf && touch failed
97 rm -f file.swf output.swf
103 test -f output.swf && touch failed
116 testswffile output.swf
117 ./swfdump output.swf | grep 'File is zlib compressed' >&6 2>&6 || touch failed
128 test -f output.swf && touch failed
141 test -f output.swf && touch failed
145 rm -f test.sc failed file1.swf file2.swf output.swf