qasm/runtests.sh

78 lines
1.2 KiB
Bash
Raw Normal View History

2019-11-17 13:32:32 -08:00
#!/bin/bash
2019-11-20 10:38:23 -08:00
OUTDIR=./qasmout
2019-11-17 13:32:32 -08:00
TMPFILE=/tmp/qasm_out.txt
rm -f $TMPFILE
rm -rf $OUTDIR
mkdir -p $OUTDIR
2019-11-17 17:01:59 -08:00
SRC=`ls ./testdata | grep -E '^([0-9]+)(.*)\.[Ss]'`
2019-11-17 13:32:32 -08:00
2019-11-17 17:01:59 -08:00
#for S in $SRC ; do
# echo $S
#done
#exit
TOTAL=0
FAILCT=0
2019-11-17 13:32:32 -08:00
for S in $SRC ; do
rm -f $TMPFILE
2019-11-17 14:26:06 -08:00
S1=$S
S1=${S1/.S/.bin}
S1=${S1/.s/.bin}
2019-11-17 19:05:50 -08:00
BASE=${S/.S/}
BASE=${BASE/.s/}
2019-11-19 08:38:49 -08:00
#./qasm -o 0/$OUTDIR/$S1 ./testdata/$S
2019-11-19 09:59:03 -08:00
./qasm --syntax merlin32 -o 0/$OUTDIR/$S1 ./testdata/$S >> $TMPFILE
2019-11-17 14:15:45 -08:00
2019-11-17 13:32:32 -08:00
R=?$
2019-11-17 16:14:52 -08:00
#echo $S " " $S1
R=`cat $TMPFILE | grep "End qASM assembly"`
E=`echo $R | awk -e '{ print $6; }'`
ect=`echo $(($E))`
2019-11-17 19:05:50 -08:00
MSHA="Q"
QSHA="M"
2019-11-20 10:38:23 -08:00
if [ -f ./m32out/$BASE.bin ] ; then
MSHA=`sha256sum ./m32out/$BASE.bin | awk '{ print $1;}'` 2>/dev/null >/dev/null
2019-11-17 19:05:50 -08:00
fi
if [ -f $OUTDIR/$BASE.bin ] ; then
QSHA=`sha256sum $OUTDIR/$BASE.bin |awk '{print $1;}'` 2>/dev/null >/dev/null
fi
2019-11-20 10:38:23 -08:00
#echo "MSHA=$MSHA QSHA=$QSHA"
2019-11-17 19:05:50 -08:00
shapass=0;
CX=" "
if [ "$MSHA""L" != "$QSHA""L" ] ; then
shapass=1
CX="!"
fi
2019-11-17 17:01:59 -08:00
P="PASS: "
TOTAL=$(($TOTAL+1))
2019-11-17 19:05:50 -08:00
pct=$(($ect+$shapass))
if [ $pct != 0 ] ; then
printf 'FAIL: (%3s) ' $ect
printf '%s ' $CX
2019-11-17 17:01:59 -08:00
FAILCT=$(($FAILCT+1))
else
printf "PASS: "
2019-11-17 16:14:52 -08:00
fi
2019-11-17 17:01:59 -08:00
echo " $S"
2019-11-17 13:32:32 -08:00
done
2019-11-17 17:01:59 -08:00
echo "Total: $TOTAL Fail: $FAILCT"
2019-11-17 14:15:45 -08:00
2019-11-17 13:32:32 -08:00