]> granicus.if.org Git - yasm/commitdiff
Check return value correctly (for both error and non-error).
authorPeter Johnson <peter@tortall.net>
Thu, 2 May 2002 03:33:32 +0000 (03:33 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 2 May 2002 03:33:32 +0000 (03:33 -0000)
svn path=/trunk/yasm/; revision=616

modules/objfmts/bin/tests/objfmt_test.sh
src/objfmts/bin/tests/objfmt_test.sh

index 678b86dcecbc488526bb00f27176b28f5aac2de9..7f595d70d1ba21724858598e4c431d284f96e762 100755 (executable)
@@ -30,7 +30,8 @@ do
        echo " FAIL (crashed)."
        failedct=`expr $failedct + 1`
     elif test $status -gt 0; then
-               if `echo ${asm} | grep err`; then
+       echo ${asm} | grep err >/dev/null
+               if test $? -gt 0; then
            # YASM detected errors but shouldn't have!
            echo " FAIL."
            failedct=`expr $failedct + 1`
@@ -52,29 +53,36 @@ do
            fi
        fi
     else
-       echo " PASS."
-       passedct=`expr $passedct + 1`
-       echo -n "$OT: Testing bin objfmt for ${a} output file ..."
-       hexdump -e '1/1 "%02x " "\n"' ${o} > ${oh}
-       if diff -w ${og} ${oh} > /dev/null; then
+       echo ${asm} | grep -v err >/dev/null
+               if test $? -gt 0; then
+           # YASM detected errors but shouldn't have!
+           echo " FAIL."
+           failedct=`expr $failedct + 1`
+       else
            echo " PASS."
            passedct=`expr $passedct + 1`
-           echo -n "$OT: Testing bin objfmt for ${a} error/warnings ..."
-           cat ${e} | sed -e "s,${srcdir}/,./," >${e}.2
-           mv ${e}.2 ${e}
-           if diff -w ${eg} ${e} > /dev/null; then
-               # Both object file and error/warnings match, it passes!
+           echo -n "$OT: Testing bin objfmt for ${a} output file ..."
+           hexdump -e '1/1 "%02x " "\n"' ${o} > ${oh}
+           if diff -w ${og} ${oh} > /dev/null; then
                echo " PASS."
                passedct=`expr $passedct + 1`
+               echo -n "$OT: Testing bin objfmt for ${a} error/warnings ..."
+               cat ${e} | sed -e "s,${srcdir}/,./," >${e}.2
+               mv ${e}.2 ${e}
+               if diff -w ${eg} ${e} > /dev/null; then
+                   # Both object file and error/warnings match, it passes!
+                   echo " PASS."
+                   passedct=`expr $passedct + 1`
+               else
+                   # Error/warnings don't match.
+                   echo " FAIL."
+                   failedct=`expr $failedct + 1`
+               fi
            else
-               # Error/warnings don't match.
+               # Object file doesn't match.
                echo " FAIL."
                failedct=`expr $failedct + 1`
            fi
-       else
-           # Object file doesn't match.
-           echo " FAIL."
-           failedct=`expr $failedct + 1`
        fi
     fi
 done
index 678b86dcecbc488526bb00f27176b28f5aac2de9..7f595d70d1ba21724858598e4c431d284f96e762 100755 (executable)
@@ -30,7 +30,8 @@ do
        echo " FAIL (crashed)."
        failedct=`expr $failedct + 1`
     elif test $status -gt 0; then
-               if `echo ${asm} | grep err`; then
+       echo ${asm} | grep err >/dev/null
+               if test $? -gt 0; then
            # YASM detected errors but shouldn't have!
            echo " FAIL."
            failedct=`expr $failedct + 1`
@@ -52,29 +53,36 @@ do
            fi
        fi
     else
-       echo " PASS."
-       passedct=`expr $passedct + 1`
-       echo -n "$OT: Testing bin objfmt for ${a} output file ..."
-       hexdump -e '1/1 "%02x " "\n"' ${o} > ${oh}
-       if diff -w ${og} ${oh} > /dev/null; then
+       echo ${asm} | grep -v err >/dev/null
+               if test $? -gt 0; then
+           # YASM detected errors but shouldn't have!
+           echo " FAIL."
+           failedct=`expr $failedct + 1`
+       else
            echo " PASS."
            passedct=`expr $passedct + 1`
-           echo -n "$OT: Testing bin objfmt for ${a} error/warnings ..."
-           cat ${e} | sed -e "s,${srcdir}/,./," >${e}.2
-           mv ${e}.2 ${e}
-           if diff -w ${eg} ${e} > /dev/null; then
-               # Both object file and error/warnings match, it passes!
+           echo -n "$OT: Testing bin objfmt for ${a} output file ..."
+           hexdump -e '1/1 "%02x " "\n"' ${o} > ${oh}
+           if diff -w ${og} ${oh} > /dev/null; then
                echo " PASS."
                passedct=`expr $passedct + 1`
+               echo -n "$OT: Testing bin objfmt for ${a} error/warnings ..."
+               cat ${e} | sed -e "s,${srcdir}/,./," >${e}.2
+               mv ${e}.2 ${e}
+               if diff -w ${eg} ${e} > /dev/null; then
+                   # Both object file and error/warnings match, it passes!
+                   echo " PASS."
+                   passedct=`expr $passedct + 1`
+               else
+                   # Error/warnings don't match.
+                   echo " FAIL."
+                   failedct=`expr $failedct + 1`
+               fi
            else
-               # Error/warnings don't match.
+               # Object file doesn't match.
                echo " FAIL."
                failedct=`expr $failedct + 1`
            fi
-       else
-           # Object file doesn't match.
-           echo " FAIL."
-           failedct=`expr $failedct + 1`
        fi
     fi
 done