mirror of
https://github.com/marketideas/qasm.git
synced 2024-12-27 15:29:30 +00:00
77 lines
1.2 KiB
Bash
Executable File
77 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
OUTDIR=./testout
|
|
TMPFILE=/tmp/qasm_out.txt
|
|
|
|
rm -f $TMPFILE
|
|
rm -rf $OUTDIR
|
|
mkdir -p $OUTDIR
|
|
|
|
SRC=`ls ./testdata | grep -E '^([0-9]+)(.*)\.[Ss]'`
|
|
|
|
#for S in $SRC ; do
|
|
# echo $S
|
|
#done
|
|
#exit
|
|
|
|
TOTAL=0
|
|
FAILCT=0
|
|
|
|
for S in $SRC ; do
|
|
|
|
rm -f $TMPFILE
|
|
|
|
S1=$S
|
|
S1=${S1/.S/.bin}
|
|
S1=${S1/.s/.bin}
|
|
|
|
BASE=${S/.S/}
|
|
BASE=${BASE/.s/}
|
|
#./qasm -o 0/$OUTDIR/$S1 ./testdata/$S
|
|
|
|
./qasm --syntax merlin32 -o 0/$OUTDIR/$S1 ./testdata/$S >> $TMPFILE
|
|
|
|
R=?$
|
|
#echo $S " " $S1
|
|
R=`cat $TMPFILE | grep "End qASM assembly"`
|
|
E=`echo $R | awk -e '{ print $6; }'`
|
|
ect=`echo $(($E))`
|
|
|
|
MSHA="Q"
|
|
QSHA="M"
|
|
|
|
if [ -f ./testdata/M32_expected/$BASE ] ; then
|
|
MSHA=`sha256sum ./testdata/M32_expected/$BASE | awk '{ print $1;}'` 2>/dev/null >/dev/null
|
|
fi
|
|
|
|
if [ -f $OUTDIR/$BASE.bin ] ; then
|
|
QSHA=`sha256sum $OUTDIR/$BASE.bin |awk '{print $1;}'` 2>/dev/null >/dev/null
|
|
fi
|
|
#echo "$MSHA $QSHA"
|
|
|
|
shapass=0;
|
|
CX=" "
|
|
|
|
if [ "$MSHA""L" != "$QSHA""L" ] ; then
|
|
shapass=1
|
|
CX="!"
|
|
fi
|
|
|
|
P="PASS: "
|
|
TOTAL=$(($TOTAL+1))
|
|
pct=$(($ect+$shapass))
|
|
if [ $pct != 0 ] ; then
|
|
printf 'FAIL: (%3s) ' $ect
|
|
printf '%s ' $CX
|
|
|
|
FAILCT=$(($FAILCT+1))
|
|
else
|
|
printf "PASS: "
|
|
fi
|
|
echo " $S"
|
|
done
|
|
echo "Total: $TOTAL Fail: $FAILCT"
|
|
|
|
|
|
|