af2c561c6b
Up until now, invalid source input had undefined behavior. We're now beginning to define that behavior so that zasm can be a bit more usable.
38 lines
626 B
Bash
Executable File
38 lines
626 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
TMPFILE=$(mktemp)
|
|
SCAS=scas
|
|
KERNEL=../../../kernel
|
|
APPS=../../../apps
|
|
ZASM=../../emul/zasm/zasm
|
|
ASMFILE=${APPS}/zasm/instr.asm
|
|
|
|
cmpas() {
|
|
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -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 test*.asm; do
|
|
echo "Comparing ${fn}"
|
|
cmpas $fn
|
|
done
|
|
|
|
./geninstrs.py $ASMFILE | \
|
|
while read line; do
|
|
echo $line | tee "${TMPFILE}"
|
|
cmpas ${TMPFILE}
|
|
done
|
|
|
|
./errtests.sh
|