tools/tests: remove scas requirement

I'm about to break compatibility with scas. Before I do that, I
need to adjusts tests. Instead of running scas to compare results,
we commit expected result as binaries directly in the repo.
This commit is contained in:
Virgil Dupras 2019-07-20 17:13:57 -04:00
parent 0c0db41477
commit a7afbe091e
12 changed files with 1618 additions and 9 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python3
# Generate almost all possible combination for instructions from instruction
# tables
# When zasm supported instructions change, use this script to update
# allinstrs.asm
import sys
@ -108,6 +110,11 @@ def genargs(argspec):
grp = argGrpTbl[argspec]
return [argspecTbl[a] for a in grp]
# process a 'n' arg into an 'e' one
def eargs(args):
newargs = ['$+'+s for s in args[:-1]]
return newargs + ['$-'+s for s in args[:-1]]
def p(line):
if line not in BLACKLIST:
print(line)
@ -131,12 +138,16 @@ def main():
if n in {'BIT', 'SET', 'RES'}:
# we only want to keep 1, 2, 4
args1 = args1[:3]
if n in {'JR', 'DJNZ'} and a1 == 'n':
args1 = eargs(args1)
if n == 'IM':
args1 = [0, 1, 2]
if args1:
for arg1 in args1:
args2 = genargs(a2)
if args2:
if n in {'JR', 'DJNZ'} and a2 == 'n':
args2 = eargs(args2)
for arg2 in args2:
p(f"{n} {arg1}, {arg2}")
else:

View File

@ -3,7 +3,6 @@
set -e
TMPFILE=$(mktemp)
SCAS=scas
KERNEL=../../../kernel
APPS=../../../apps
ZASM=../../zasm.sh
@ -12,7 +11,7 @@ ASMFILE=${APPS}/zasm/instr.asm
cmpas() {
FN=$1
shift 1
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "${FN}" | xxd)
EXPECTED=$(xxd ${FN}.expected)
ACTUAL=$(cat ${FN} | $ZASM "$@" | xxd)
if [ "$ACTUAL" == "$EXPECTED" ]; then
echo ok
@ -25,15 +24,9 @@ cmpas() {
fi
}
for fn in test*.asm; do
for fn in *.asm; do
echo "Comparing ${fn}"
cmpas $fn "${KERNEL}" "${APPS}"
done
./geninstrs.py $ASMFILE | \
while read line; do
echo $line | tee "${TMPFILE}"
cmpas ${TMPFILE}
done
./errtests.sh

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
<EFBFBD>0_<><5F>0$o<>

Binary file not shown.

View File

@ -0,0 +1 @@
>D>!>(

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
<EFBFBD><EFBFBD><18>