mirror of
http://git.hugovil.com/git/emu8051.git
synced 2025-05-09 00:51:03 +08:00
Add framework for regression testing
This commit is contained in:
parent
594b0ac005
commit
7a22c370ea
@ -23,4 +23,5 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in \
|
||||
$(ac_aux_dir)/install-sh $(ac_aux_dir)/missing \
|
||||
$(ac_aux_dir)/mkinstalldirs $(ac_aux_dir)/config.guess \
|
||||
$(ac_aux_dir)/config.sub $(ac_aux_dir)/ltmain.sh \
|
||||
$(ac_aux_dir)/compile
|
||||
$(ac_aux_dir)/compile \
|
||||
$(ac_aux_dir)/test-driver
|
||||
|
@ -1,10 +1,13 @@
|
||||
# tests for emu8051
|
||||
# Regression tests for emu8051
|
||||
|
||||
AS51 = asem
|
||||
|
||||
SUFFIXES = .hex .asm
|
||||
|
||||
bin_PROGRAMS = mul1.hex mul2.hex
|
||||
TESTS = \
|
||||
opcodes
|
||||
|
||||
check_PROGRAMS = mul1.hex mul2.hex
|
||||
|
||||
mul1.hex: mul1.asm
|
||||
|
||||
@ -13,6 +16,8 @@ mul2.hex: mul2.asm
|
||||
.asm.hex:
|
||||
$(AS51) $<
|
||||
|
||||
CLEANFILES = *~ *.lst
|
||||
EXTRA_DIST = $(TESTS)
|
||||
|
||||
CLEANFILES = *~ *.lst *.log
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
@ -1,9 +1,9 @@
|
||||
; Test program to verify correct emu8051 operation
|
||||
;
|
||||
; Test desc: MUL AB (no overflow)
|
||||
; Test output1: ACC = 0xC2
|
||||
; Test output2: B = 0x00
|
||||
; Test output2: PSW = 0x01
|
||||
; Test output1: A = $C2
|
||||
; Test output2: B = $00
|
||||
; Test output3: PSW = $01
|
||||
|
||||
CSEG
|
||||
|
||||
@ -13,4 +13,5 @@
|
||||
MOV B, #002h
|
||||
MUL AB ; CY should be cleared, OV should be cleared
|
||||
|
||||
LJMP 0FFF0h
|
||||
END
|
||||
|
@ -1,9 +1,9 @@
|
||||
; Test program to verify correct emu8051 operation
|
||||
;
|
||||
; Test desc: MUL AB (overflow)
|
||||
; Test output1: ACC = 0x5B
|
||||
; Test output2: B = 0x0B
|
||||
; Test output3: PSW = 0x05
|
||||
; Test output1: A = $5B
|
||||
; Test output2: B = $0B
|
||||
; Test output3: PSW = $05
|
||||
|
||||
CSEG
|
||||
|
||||
@ -13,4 +13,5 @@
|
||||
MOV B, #013h
|
||||
MUL AB ; CY should be cleared, OV should be cleared
|
||||
|
||||
LJMP 0FFF0h
|
||||
END
|
||||
|
30
tests/opcodes
Executable file
30
tests/opcodes
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
lf=test.log
|
||||
|
||||
STOP_ADDRESS="0xFFF0"
|
||||
XRAM_SIZE="256"
|
||||
|
||||
for f in *.hex; do
|
||||
name=$(basename ${f} .hex)
|
||||
|
||||
echo "Testing ${name}" > ${lf}
|
||||
../src/emu8051-cli -d 2 --xram=${XRAM_SIZE} -s ${STOP_ADDRESS} ${f} >> ${lf}
|
||||
if $? -ne 0; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
while read line; do
|
||||
if echo ${line} | grep -q "; Test output"; then
|
||||
test_str=$(echo ${line} | sed "s/^; Test output[0-9]: //")
|
||||
|
||||
if ! grep -q "${test_str}" ${lf}; then
|
||||
echo "Failed test: ${test_str}" >> ${lf}
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done < ${name}.asm
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user