runtest (925B)
1 #!/bin/bash 2 3 if [ ! -f "$1" ]; then 4 echo FAIL: No such file: $1 5 echo FAIL > "out/$1.status" 6 exit 0 7 fi 8 9 echo "" 10 echo TEST: $1 11 12 mkdir -p out/tests/ 13 14 if ! ./out/a16 "$1" "out/$1.hex" ; then 15 echo FAIL: $1 '(assmembly error)' 16 echo FAIL > "out/$1.status" 17 exit 0 18 fi 19 20 if ! ./out/cpu16-vsim -trace "out/$1.vcd" -load "out/$1.hex" > "out/$1.raw" ; then 21 echo FAIL: Error simulating $1 22 echo FAIL > "out/$1.status" 23 exit 0 24 fi 25 26 # extract WRItes from log and test 27 grep '^:WRI' "out/$1.raw" > "out/$1.log" 28 grep '^;[0-9a-fA-F]' "$1" | sed 's/;/:WRI /g' > "out/$1.tmpl" 29 30 # extract REGister state from log and test (if test includes them) 31 if grep -q '^;R' "$1" ; then 32 grep '^:REG' "out/$1.raw" >> "out/$1.log" 33 grep '^;R' "$1" | sed 's/;/:REG /g' >> "out/$1.tmpl" 34 fi 35 36 if ! diff "out/$1.tmpl" "out/$1.log" ; then 37 echo FAIL: $1 '(results differ)' 38 echo FAIL > "out/$1.status" 39 exit 0 40 else 41 echo PASS: $1 42 echo PASS > "out/$1.status" 43 fi