1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-17 09:38:05 +11:00
collapseos/apps/zasm/tests/runtests.sh
2019-05-14 13:53:12 -04:00

35 lines
536 B
Bash
Executable File

#!/bin/sh
set -e
TMPFILE=$(mktemp)
SCAS=scas
ZASM=../../../tools/emul/zasm
ASMFILE=../instr.asm
cmpas() {
EXPECTED=$($SCAS -o - "$1" | xxd)
ACTUAL=$(cat $1 | $ZASM | xxd)
if [ "$ACTUAL" == "$EXPECTED" ]; then
echo ok
else
echo actual
echo $ACTUAL
echo expected
echo $EXPECTED
exit 1
fi
}
for fn in *.asm; do
echo "Comparing ${fn}"
cmpas $fn
done
./geninstrs.py $ASMFILE | \
while read line; do
echo $line | tee "${TMPFILE}"
cmpas ${TMPFILE}
done