2019-04-18 11:03:20 +10:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TMPFILE=$(mktemp)
|
|
|
|
SCAS=scas
|
2019-05-20 01:19:41 +10:00
|
|
|
KERNEL=../../../kernel
|
2019-05-18 10:47:43 +10:00
|
|
|
APPS=../../../apps
|
2019-05-17 21:23:59 +10:00
|
|
|
ZASM=../../emul/zasm/zasm
|
2019-05-18 10:47:43 +10:00
|
|
|
ASMFILE=${APPS}/zasm/instr.asm
|
2019-04-18 11:03:20 +10:00
|
|
|
|
2019-05-01 05:51:39 +10:00
|
|
|
cmpas() {
|
2019-05-20 01:19:41 +10:00
|
|
|
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "$1" | xxd)
|
2019-05-01 05:51:39 +10:00
|
|
|
ACTUAL=$(cat $1 | $ZASM | xxd)
|
2019-04-18 11:03:20 +10:00
|
|
|
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
|
|
|
echo ok
|
|
|
|
else
|
|
|
|
echo actual
|
|
|
|
echo $ACTUAL
|
|
|
|
echo expected
|
|
|
|
echo $EXPECTED
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-01 05:51:39 +10:00
|
|
|
}
|
|
|
|
|
2019-05-28 01:04:31 +10:00
|
|
|
for fn in test*.asm; do
|
2019-05-15 03:53:12 +10:00
|
|
|
echo "Comparing ${fn}"
|
|
|
|
cmpas $fn
|
|
|
|
done
|
|
|
|
|
2019-05-01 05:51:39 +10:00
|
|
|
./geninstrs.py $ASMFILE | \
|
|
|
|
while read line; do
|
|
|
|
echo $line | tee "${TMPFILE}"
|
|
|
|
cmpas ${TMPFILE}
|
|
|
|
done
|
|
|
|
|
2019-05-28 01:04:31 +10:00
|
|
|
./errtests.sh
|