First properly evaluated CPM test: log-test, with golden file,

evaluate script and script to cut off CPM text files at ctrl-z (EOF)
This commit is contained in:
Philip Zembrod 2023-07-02 00:11:52 +02:00
parent 415fd869e1
commit 20a2715203
6 changed files with 48 additions and 4 deletions

View File

@ -12,7 +12,7 @@ cpmfilesdir = cpmfiles
fth: $(fthfiles)
clean:
rm -f *.log
rm -f *.log *.golden *.result
rm -rf $(runcpmdir)
rm -f msdos
@ -54,10 +54,19 @@ logtest.log: $(patsubst %, $(cpmfilesdir)/%, volks4th.com) \
echo "exit" >> $(runcpmdir)/input.script
./emulator/run-in-runcpm.sh volks4th
cp $(runcpmdir)/output.log output.log
cp $(runcpmdir)/A/0/LOGFILE.TXT $@
../../tools/trunc-ctrl-z.py $(runcpmdir)/A/0/LOGFILE.TXT \
$(runcpmdir)/logfile.txt
dos2unix -n $(runcpmdir)/logfile.txt $@
emu: $(runcpmdir)/RunCPM
%.golden: tests/golden/%.golden
cp -p $< $@
%.result: %.log %.golden tests/evaluate-test.sh
rm -f $@
tests/evaluate-test.sh $(basename $@)
$(runcpmdir)/RunCPM: $(whitch_runcpm)
test -d $(runcpmdir) || mkdir -p $(runcpmdir)
cp $< $@

16
8080/CPM/tests/evaluate-test.sh Executable file
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,4 @@
ok
.( hello world) cr hello world
ok
logclose

File diff suppressed because one or more lines are too long

View File

@ -86,7 +86,7 @@ Output: alsologtofile
alsologtofile ;
: logclose ( -- )
cr display logflush logfile closefile ;
cr display &26 logc! logflush logfile closefile ;

15
tools/trunc-ctrl-z.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python3
import sys
inFileName, outFileName = sys.argv[1], sys.argv[2]
inFile = open(inFileName, "rb")
source = inFile.read()
destination = bytearray()
for b in source:
if b == 26:
break
destination.append(b)
# result.append('')
outFile = open(outFileName, "wb")
outFile.write(destination)