| OLD | NEW |
| 1 #! /bin/sh | 1 #! /bin/sh |
| 2 # $Id: out_test.sh 1825 2007-04-22 03:32:46Z peter $ | 2 # $Id: out_test.sh 2226 2009-07-30 02:19:38Z peter $ |
| 3 | 3 |
| 4 YASM_TEST_SUITE=1 | 4 YASM_TEST_SUITE=1 |
| 5 export YASM_TEST_SUITE | 5 export YASM_TEST_SUITE |
| 6 | 6 |
| 7 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in | 7 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in |
| 8 *c*,-n*) ECHO_N= ECHO_C=' | 8 *c*,-n*) ECHO_N= ECHO_C=' |
| 9 ' ECHO_T=' ' ;; | 9 ' ECHO_T=' ' ;; |
| 10 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; | 10 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; |
| 11 *) ECHO_N= ECHO_C='\c' ECHO_T= ;; | 11 *) ECHO_N= ECHO_C='\c' ECHO_T= ;; |
| 12 esac | 12 esac |
| 13 | 13 |
| 14 mkdir results >/dev/null 2>&1 | 14 mkdir results >/dev/null 2>&1 |
| 15 | 15 |
| 16 # | 16 # |
| 17 # Verify that all test cases match | 17 # Verify that all test cases match |
| 18 # | 18 # |
| 19 | 19 |
| 20 passedct=0 | 20 passedct=0 |
| 21 failedct=0 | 21 failedct=0 |
| 22 | 22 |
| 23 echo $ECHO_N "Test $1: $ECHO_C" | 23 echo $ECHO_N "Test $1: $ECHO_C" |
| 24 for asm in ${srcdir}/$2/*.asm | 24 for asm in ${srcdir}/$2/*.asm |
| 25 do | 25 do |
| 26 a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'` | 26 a=`echo ${asm} | sed 's,^.*/,,;s,.asm$,,'` |
| 27 o=${a}$5 | 27 o=${a}$5 |
| 28 oh=${a}.hx | 28 oh=${a}.hx |
| 29 og=`echo ${asm} | sed 's,.asm$,.hex,'` | 29 og=`echo ${asm} | sed 's,.asm$,.hex,'` |
| 30 e=${a}.ew | 30 e=${a}.ew |
| 31 eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` | 31 eg=`echo ${asm} | sed 's,.asm$,.errwarn,'` |
| 32 if test \! -e ${eg}; then | 32 if test \! -f ${eg}; then |
| 33 eg=/dev/null | 33 eg=/dev/null |
| 34 fi | 34 fi |
| 35 | 35 |
| 36 # Run within a subshell to prevent signal messages from displaying. | 36 # Run within a subshell to prevent signal messages from displaying. |
| 37 sh -c "cat ${asm} | ./yasm $4 -o results/${o} - 2>results/${e}" >/dev/null 2
>/dev/null | 37 sh -c "cat ${asm} | ./yasm $4 -o results/${o} - 2>results/${e}" >/dev/null 2
>/dev/null |
| 38 status=$? | 38 status=$? |
| 39 if test $status -gt 128; then | 39 if test $status -gt 128; then |
| 40 # We should never get a coredump! | 40 # We should never get a coredump! |
| 41 echo $ECHO_N "C$ECHO_C" | 41 echo $ECHO_N "C$ECHO_C" |
| 42 eval "failed$failedct='C: ${a} crashed!'" | 42 eval "failed$failedct='C: ${a} crashed!'" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 fi | 63 fi |
| 64 else | 64 else |
| 65 echo ${asm} | grep -v err >/dev/null | 65 echo ${asm} | grep -v err >/dev/null |
| 66 if test $? -gt 0; then | 66 if test $? -gt 0; then |
| 67 # YASM didn't detect errors but should have! | 67 # YASM didn't detect errors but should have! |
| 68 echo $ECHO_N "E$ECHO_C" | 68 echo $ECHO_N "E$ECHO_C" |
| 69 eval "failed$failedct='E: ${a} did not return an error code!'" | 69 eval "failed$failedct='E: ${a} did not return an error code!'" |
| 70 failedct=`expr $failedct + 1` | 70 failedct=`expr $failedct + 1` |
| 71 else | 71 else |
| 72 ./test_hd results/${o} > results/${oh} | 72 ./test_hd results/${o} > results/${oh} |
| 73 if diff ${og} results/${oh} >/dev/null; then | 73 if diff -w ${og} results/${oh} >/dev/null; then |
| 74 if diff -w ${eg} results/${e} >/dev/null; then | 74 if diff -w ${eg} results/${e} >/dev/null; then |
| 75 # Both object file and error/warnings match, it passes! | 75 # Both object file and error/warnings match, it passes! |
| 76 echo $ECHO_N ".$ECHO_C" | 76 echo $ECHO_N ".$ECHO_C" |
| 77 passedct=`expr $passedct + 1` | 77 passedct=`expr $passedct + 1` |
| 78 else | 78 else |
| 79 # Error/warnings don't match. | 79 # Error/warnings don't match. |
| 80 echo $ECHO_N "W$ECHO_C" | 80 echo $ECHO_N "W$ECHO_C" |
| 81 eval "failed$failedct='W: ${a} did not match errors and warn
ings!'" | 81 eval "failed$failedct='W: ${a} did not match errors and warn
ings!'" |
| 82 failedct=`expr $failedct + 1` | 82 failedct=`expr $failedct + 1` |
| 83 fi | 83 fi |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 | 96 |
| 97 echo " +$passedct-$failedct/$ct $per%" | 97 echo " +$passedct-$failedct/$ct $per%" |
| 98 i=0 | 98 i=0 |
| 99 while test $i -lt $failedct; do | 99 while test $i -lt $failedct; do |
| 100 eval "failure=\$failed$i" | 100 eval "failure=\$failed$i" |
| 101 echo " ** $failure" | 101 echo " ** $failure" |
| 102 i=`expr $i + 1` | 102 i=`expr $i + 1` |
| 103 done | 103 done |
| 104 | 104 |
| 105 exit $failedct | 105 exit $failedct |
| OLD | NEW |