6 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
7 *c*,-n*) ECHO_N= ECHO_C='
9 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
10 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
13 mkdir results >/dev/null 2>&1
16 # Verify that all test cases match
22 echo $ECHO_N "Test $1: $ECHO_C"
23 for asm in ${srcdir}/$2/*.asm
25 a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'`
28 og=`echo ${asm} | sed 's,.asm$,.hex,'`
30 eg=`echo ${asm} | sed 's,.asm$,.errwarn,'`
31 if test \! -f ${eg}; then
35 # Run within a subshell to prevent signal messages from displaying.
36 sh -c "cat ${asm} | ./yasm $4 -o results/${o} - 2>results/${e}" >/dev/null 2>/dev/null
38 if test $status -gt 128; then
39 # We should never get a coredump!
40 echo $ECHO_N "C$ECHO_C"
41 eval "failed$failedct='C: ${a} crashed!'"
42 failedct=`expr $failedct + 1`
43 elif test $status -gt 0; then
44 echo ${asm} | grep err >/dev/null
45 if test $? -gt 0; then
46 # YASM detected errors but shouldn't have!
47 echo $ECHO_N "E$ECHO_C"
48 eval "failed$failedct='E: ${a} returned an error code!'"
49 failedct=`expr $failedct + 1`
51 # We got errors, check to see if they match:
52 if diff -w ${eg} results/${e} >/dev/null; then
53 # Error/warnings match, it passes!
54 echo $ECHO_N ".$ECHO_C"
55 passedct=`expr $passedct + 1`
57 # Error/warnings don't match.
58 echo $ECHO_N "W$ECHO_C"
59 eval "failed$failedct='W: ${a} did not match errors and warnings!'"
60 failedct=`expr $failedct + 1`
64 echo ${asm} | grep -v err >/dev/null
65 if test $? -gt 0; then
66 # YASM didn't detect errors but should have!
67 echo $ECHO_N "E$ECHO_C"
68 eval "failed$failedct='E: ${a} did not return an error code!'"
69 failedct=`expr $failedct + 1`
71 ./test_hd results/${o} > results/${oh}
72 if diff -w ${og} results/${oh} >/dev/null; then
73 if diff -w ${eg} results/${e} >/dev/null; then
74 # Both object file and error/warnings match, it passes!
75 echo $ECHO_N ".$ECHO_C"
76 passedct=`expr $passedct + 1`
78 # Error/warnings don't match.
79 echo $ECHO_N "W$ECHO_C"
80 eval "failed$failedct='W: ${a} did not match errors and warnings!'"
81 failedct=`expr $failedct + 1`
84 # Object file doesn't match.
85 echo $ECHO_N "O$ECHO_C"
86 eval "failed$failedct='O: ${a} did not match object file!'"
87 failedct=`expr $failedct + 1`
93 ct=`expr $failedct + $passedct`
94 per=`expr 100 \* $passedct / $ct`
96 echo " +$passedct-$failedct/$ct $per%"
98 while test $i -lt $failedct; do
99 eval "failure=\$failed$i"