From: Hugo Villeneuve Date: Fri, 29 Nov 2013 04:11:43 +0000 (-0500) Subject: Run each test separately from single shell script X-Git-Tag: v2.0.0~39 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=a46ab59d50824509ac903d9ebe4dea35ff2d8a49;p=emu8051.git Run each test separately from single shell script Each new test is simply a link to opcodes.sh, generatated automatically. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 53f352b..147846b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,28 +2,36 @@ AS51 = asem -SUFFIXES = .hex .asm +SUFFIXES = .hex .asm .sh +# Should find a way to automatically generate each symlink here: TESTS = \ - opcodes - -check_PROGRAMS = mul1.hex mul2.hex div.hex orl.hex anl.hex mov.hex timer0.hex timer1.hex timer2.hex - -mul1.hex: mul1.asm -mul2.hex: mul2.asm -div.hex: div.asm -orl.hex: orl.asm -anl.hex: anl.asm -mov.hex: mov.asm -timer0.hex: timer0.asm -timer1.hex: timer1.asm -timer2.hex: timer2.asm - + mul1.sh mul2.sh \ + div.sh \ + orl.sh anl.sh \ + mov.sh \ + timer0.sh timer1.sh timer2.sh + +mul1.sh: mul1.hex +mul2.sh: mul2.hex +div.sh: div.hex +orl.sh: orl.hex +anl.sh: anl.hex +mov.sh: mov.hex +timer0.sh: timer0.hex +timer1.sh: timer1.hex +timer2.sh: timer2.hex + +# Tell make how to generate a .sh file after a .hex file is generated: +.hex.sh: + ln -sf opcodes.sh $@ + +# Tell make how to generate a .hex file from a .asm source file: .asm.hex: $(AS51) $< -EXTRA_DIST = $(TESTS) +EXTRA_DIST = $(TESTS) *.asm *.hex -CLEANFILES = *~ *.lst *.log +CLEANFILES = *~ *.lst *.hex $(TESTS) MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/opcodes b/tests/opcodes deleted file mode 100755 index 0dba166..0000000 --- a/tests/opcodes +++ /dev/null @@ -1,30 +0,0 @@ -#!/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: //") - - if ! grep -q "${test_str}" ${lf}; then - echo "Failed test: ${test_str}" >> ${lf} - exit 1 - fi - fi - done < ${name}.asm - -done - -exit 0 diff --git a/tests/opcodes.sh b/tests/opcodes.sh new file mode 100755 index 0000000..f6ff764 --- /dev/null +++ b/tests/opcodes.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# Get the symlink name (how we were called): +test_name=`basename $0` + +lf=${test_name}.log + +STOP_ADDRESS="0xFFF0" +XRAM_SIZE="256" + +name=$(basename ${test_name} .sh) +hexfile=${name}.hex + +echo "Testing ${name}.hex" > ${lf} +../src/emu8051-cli -d 2 --xram=${XRAM_SIZE} -s ${STOP_ADDRESS} ${hexfile} >> ${lf} +if test $? -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: //") + + if ! grep -q "${test_str}" ${lf}; then + echo "Failed test: ${test_str}" >> ${lf} + exit 1 + fi + fi +done < ${name}.asm + +exit 0