$(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
-# 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
.asm.hex:
$(AS51) $<
-CLEANFILES = *~ *.lst
+EXTRA_DIST = $(TESTS)
+
+CLEANFILES = *~ *.lst *.log
MAINTAINERCLEANFILES = Makefile.in
; 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
MOV B, #002h
MUL AB ; CY should be cleared, OV should be cleared
+ LJMP 0FFF0h
END
; 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
MOV B, #013h
MUL AB ; CY should be cleared, OV should be cleared
+ LJMP 0FFF0h
END
--- /dev/null
+#!/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