First automated make test for MSDOS volks4th.com in dosbox.

This commit is contained in:
Philip Zembrod 2022-01-06 14:55:53 +01:00
parent d704e50d71
commit 5373de9c36
6 changed files with 73 additions and 0 deletions

18
8086/msdos/Makefile Normal file
View File

@ -0,0 +1,18 @@
test: logtest.result
clean:
rm -f *.log *.LOG *.result *.golden
logtest.log: volks4th.com tests/LOG2FILE.FB tests/LOGTEST.FB emulator/run-in-dosbox.sh
./emulator/run-in-dosbox.sh volks4th.com logtest
logtest.golden: tests/golden/logtest.golden
cp -p $< $@
%.result: %.log %.golden tests/evaluate-test.sh
rm -f $@
tests/evaluate-test.sh $(basename $@)

View File

@ -0,0 +1,36 @@
#!/bin/bash
set -e
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")"
forth="$1"
srcbasename="$2"
forthcmd=""
if [ -n "${srcbasename}" ]; then
forthcmd="include ${srcbasename}.fb"
logname="${srcbasename}.log"
doslogname="$(echo ${logname}|tr '[:lower:]' '[:upper:]')"
rm -f "${logname}" "${doslogname}"
fi
exit=""
bye=""
if [ -z "${KEEPEMU}" ]; then
exit="-c exit"
bye="bye"
fi
auto_c=""
autocmd=""
if [ -n "${forth}" ]; then
auto_c="-c"
autocmd="${forth} path f:\\;f:\\tests ${forthcmd} ${bye}"
fi
dosbox -c "mount f ${basedir}" -c "f:" "${auto_c}" "${autocmd}" $exit
if [ -n "${srcbasename}" ]; then
dos2unix -n "${doslogname}" "${logname}"
fi

View File

@ -0,0 +1 @@
\ logging to a text file phz 03jan22 \ load screen phz 04jan22 1 2 +thru \ log-type log-emit log-cr alsologtofile phz 04jan22 context @ dos also context ! \ vocabulary log dos also log definitions file logfile variable logfcb : log-type 2dup (type ds@ -rot logfcb @ lfputs ; : log-emit dup (emit logfcb @ fputc ; : log-cr (cr #cr logfcb @ fputc #lf logfcb @ fputc ; Output: alsologtofile log-emit log-cr log-type (del (page (at (at? ; \ logopen logclose phz 04jan22 : logopen ( -- ) logfile make isfile@ dup freset logfcb ! alsologtofile ; : logclose ( -- ) display logfcb @ fclose ;

View File

@ -0,0 +1 @@
\ logtest.fb phz 04jan22 basic tests for log2file.fb \ loadscreen phz 04jan22 include log2file.fb logopen logtest.log .( logtest done) cr logclose

View File

@ -0,0 +1,16 @@
#!/bin/bash
testsdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
basedir="$(realpath --relative-to="$PWD" "${testsdir}/..")"
testname="$1"
diff --ignore-trailing-space "${basedir}/${testname}.golden" \
"${basedir}/${testname}.log" > tmp.result
exitcode=$?
test $exitcode -eq 0 \
&& echo "PASS: ${testname}" >> tmp.result \
|| echo "FAIL: ${testname}" >> tmp.result
cat tmp.result
mv tmp.result "${basedir}/${testname}.result"
exit $exitcode

View File

@ -0,0 +1 @@
logtest done