mirror of
https://github.com/forth-ev/VolksForth.git
synced 2024-11-29 05:49:26 +00:00
First automated make test for MSDOS volks4th.com in dosbox.
This commit is contained in:
parent
d704e50d71
commit
5373de9c36
18
8086/msdos/Makefile
Normal file
18
8086/msdos/Makefile
Normal 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 $@)
|
||||
|
36
8086/msdos/emulator/run-in-dosbox.sh
Executable file
36
8086/msdos/emulator/run-in-dosbox.sh
Executable 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
|
1
8086/msdos/tests/LOG2FILE.FB
Normal file
1
8086/msdos/tests/LOG2FILE.FB
Normal 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 ;
|
1
8086/msdos/tests/LOGTEST.FB
Normal file
1
8086/msdos/tests/LOGTEST.FB
Normal 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
|
16
8086/msdos/tests/evaluate-test.sh
Executable file
16
8086/msdos/tests/evaluate-test.sh
Executable 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
|
1
8086/msdos/tests/golden/logtest.golden
Normal file
1
8086/msdos/tests/golden/logtest.golden
Normal file
@ -0,0 +1 @@
|
||||
logtest done
|
Loading…
Reference in New Issue
Block a user