mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:48:06 +11:00
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:
parent
0c0db41477
commit
a7afbe091e
1602
tools/tests/zasm/allinstrs.asm
Normal file
1602
tools/tests/zasm/allinstrs.asm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tools/tests/zasm/allinstrs.asm.expected
Normal file
BIN
tools/tests/zasm/allinstrs.asm.expected
Normal file
Binary file not shown.
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Generate almost all possible combination for instructions from instruction
|
# Generate almost all possible combination for instructions from instruction
|
||||||
# tables
|
# tables
|
||||||
|
# When zasm supported instructions change, use this script to update
|
||||||
|
# allinstrs.asm
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -108,6 +110,11 @@ def genargs(argspec):
|
|||||||
grp = argGrpTbl[argspec]
|
grp = argGrpTbl[argspec]
|
||||||
return [argspecTbl[a] for a in grp]
|
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):
|
def p(line):
|
||||||
if line not in BLACKLIST:
|
if line not in BLACKLIST:
|
||||||
print(line)
|
print(line)
|
||||||
@ -131,12 +138,16 @@ def main():
|
|||||||
if n in {'BIT', 'SET', 'RES'}:
|
if n in {'BIT', 'SET', 'RES'}:
|
||||||
# we only want to keep 1, 2, 4
|
# we only want to keep 1, 2, 4
|
||||||
args1 = args1[:3]
|
args1 = args1[:3]
|
||||||
|
if n in {'JR', 'DJNZ'} and a1 == 'n':
|
||||||
|
args1 = eargs(args1)
|
||||||
if n == 'IM':
|
if n == 'IM':
|
||||||
args1 = [0, 1, 2]
|
args1 = [0, 1, 2]
|
||||||
if args1:
|
if args1:
|
||||||
for arg1 in args1:
|
for arg1 in args1:
|
||||||
args2 = genargs(a2)
|
args2 = genargs(a2)
|
||||||
if args2:
|
if args2:
|
||||||
|
if n in {'JR', 'DJNZ'} and a2 == 'n':
|
||||||
|
args2 = eargs(args2)
|
||||||
for arg2 in args2:
|
for arg2 in args2:
|
||||||
p(f"{n} {arg1}, {arg2}")
|
p(f"{n} {arg1}, {arg2}")
|
||||||
else:
|
else:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
TMPFILE=$(mktemp)
|
TMPFILE=$(mktemp)
|
||||||
SCAS=scas
|
|
||||||
KERNEL=../../../kernel
|
KERNEL=../../../kernel
|
||||||
APPS=../../../apps
|
APPS=../../../apps
|
||||||
ZASM=../../zasm.sh
|
ZASM=../../zasm.sh
|
||||||
@ -12,7 +11,7 @@ ASMFILE=${APPS}/zasm/instr.asm
|
|||||||
cmpas() {
|
cmpas() {
|
||||||
FN=$1
|
FN=$1
|
||||||
shift 1
|
shift 1
|
||||||
EXPECTED=$($SCAS -I ${KERNEL} -I ${APPS} -o - "${FN}" | xxd)
|
EXPECTED=$(xxd ${FN}.expected)
|
||||||
ACTUAL=$(cat ${FN} | $ZASM "$@" | xxd)
|
ACTUAL=$(cat ${FN} | $ZASM "$@" | xxd)
|
||||||
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
if [ "$ACTUAL" == "$EXPECTED" ]; then
|
||||||
echo ok
|
echo ok
|
||||||
@ -25,15 +24,9 @@ cmpas() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
for fn in test*.asm; do
|
for fn in *.asm; do
|
||||||
echo "Comparing ${fn}"
|
echo "Comparing ${fn}"
|
||||||
cmpas $fn "${KERNEL}" "${APPS}"
|
cmpas $fn "${KERNEL}" "${APPS}"
|
||||||
done
|
done
|
||||||
|
|
||||||
./geninstrs.py $ASMFILE | \
|
|
||||||
while read line; do
|
|
||||||
echo $line | tee "${TMPFILE}"
|
|
||||||
cmpas ${TMPFILE}
|
|
||||||
done
|
|
||||||
|
|
||||||
./errtests.sh
|
./errtests.sh
|
||||||
|
BIN
tools/tests/zasm/test1.asm.expected
Normal file
BIN
tools/tests/zasm/test1.asm.expected
Normal file
Binary file not shown.
BIN
tools/tests/zasm/test2.asm.expected
Normal file
BIN
tools/tests/zasm/test2.asm.expected
Normal file
Binary file not shown.
1
tools/tests/zasm/test3.asm.expected
Normal file
1
tools/tests/zasm/test3.asm.expected
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD>0_<><5F>0$o<>
|
BIN
tools/tests/zasm/test4.asm.expected
Normal file
BIN
tools/tests/zasm/test4.asm.expected
Normal file
Binary file not shown.
1
tools/tests/zasm/test5.asm.expected
Normal file
1
tools/tests/zasm/test5.asm.expected
Normal file
@ -0,0 +1 @@
|
|||||||
|
>D>!>(
|
BIN
tools/tests/zasm/test6.asm.expected
Normal file
BIN
tools/tests/zasm/test6.asm.expected
Normal file
Binary file not shown.
BIN
tools/tests/zasm/test7.asm.expected
Normal file
BIN
tools/tests/zasm/test7.asm.expected
Normal file
Binary file not shown.
1
tools/tests/zasm/test8.asm.expected
Normal file
1
tools/tests/zasm/test8.asm.expected
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD><18>
|
Loading…
Reference in New Issue
Block a user