#!/bin/sh # # Trivial debug script, display test case, compile and run, and display # testcase again PROG="./comp" ASMFILE="./out.s" TMPFILE=`mktemp -t $(basename $0).XXXXXX` trap "rm $TMPFILE" 1 0 make all if [ $? -eq 0 ]; then for TESTFILE in `find ../tests/ -type f -regex ".*\.p[01]"`; do ARGS=" -O0" echo "Testing: $TESTFILE" $PROG $ARGS < $TESTFILE 2>/dev/null 1>/dev/null (echo 2; echo 3) | spim -f $ASMFILE 2>$TMPFILE 1>/dev/null grep -q -e 'syntax error' $TMPFILE if [ $? -eq 0 ]; then cat $TMPFILE echo "File processing: $TESTFILE" echo "===BEGIN CODE ===" cat $TESTFILE echo "===END CODE ===" echo "=== ASSEMBLY CODE ==" cat $ASMFILE echo "=== END ASSEMBLY CODE ===" exit 1 fi done fi