#!/bin/bash #!/software/common/gnu/bin/bash # # auto test code to see what is good, working code; no need to look too closely # at working code / figure out what their conceptual error(s) might be. # 1998 nov 1, bsy, created. # # assumes manual untarring, since dir name may change, plus tar could # create new .login / .cshrc files and mess up account. # # Use within the dir. args should be the student's program oic files (but not # their test input files) indir=/home/solaris/ieng9/cs30f/staff/assn3 spim=/home/solaris/ieng9/cs30f/public/bin/spim indir=/home/bsy/cse30f98/assn3 spim=/home/bsy/bin.x86_linux2029/spim scratch=${TMPDIR-/usr/tmp}/test-mips.$$.mips trap 'rm $scratch' 0 1 2 3 15 ulimit -t 5 score=0 if grep -q main "$@" then echo "It looks like their file contains the driver... continuing..." fi while read infile do read output cat $infile "$@" > $scratch theirs=`$spim -file $scratch 2>/dev/null | grep "Function returned"` if [ "x$theirs" = "x$output" ] then echo "$infile: okay" score=`expr $score + 1` else echo "Expected: $output" echo "Got: $theirs" echo "$infile: BAD" fi done < $indir/assn3-mips.tests echo "Passes $score tests"