First test rule for the freshly-built-from-fb-src v4th.com, including

a good deal of Makefile and run-in-dosbox.sh refactoring, e.g. the
introduction of a dosfiles/ subdir in which dosbox runs, to eliminate
the need for the Forth PATH word to run tests.
This commit is contained in:
Philip Zembrod 2022-01-31 00:14:47 +01:00
parent 7dc1c34150
commit d8b8f0366e
11 changed files with 150 additions and 44 deletions

View File

@ -6,38 +6,54 @@ fbfiles_uppercase = $(wildcard src/*.FB tests/*.FB)
fthfiles_caseconverted = $(patsubst %.fb, %.fth, \
$(shell ../../tools/echo-tolower.py $(fbfiles_uppercase)))
test: incltest.result logtest.result test-min.result
test: incltest.result logtest.result test-min.result \
test-volks4th-min.result
fth: $(fthfiles) $(fthfiles_caseconverted)
clean:
rm -f *.log *.LOG *.result *.golden
rm -f dosfiles/*
v4th.com: volks4th.com kernel.fb \
emulator/run-in-dosbox.sh
*.log: emulator/run-in-dosbox.sh
# TODO: Make v4th.log contain something and check its contents
v4th.com v4th.log: volks4th.com kernel.fb tests/log2file.fb
rm -f FORTH.COM forth.com v4th.com
./emulator/run-in-dosbox.sh volks4th.com kernel.fb
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh \
volks4th.com "include kernel.fb"
dos2unix -n OUTPUT.LOG v4th.log
mv FORTH.COM v4th.com
v4thfile.com: volks4th.com src/include.fb src/v4thfile.fb \
emulator/run-in-dosbox.sh
rm -f V4THFILE.COM v4thfile.com
./emulator/run-in-dosbox.sh volks4th.com v4thfile.fb
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh volks4th.com "include v4thfile.fb"
mv V4THFILE.COM v4thfile.com
logtest.log: volks4th.com tests/log2file.fb tests/logtest.fb \
emulator/run-in-dosbox.sh
./emulator/run-in-dosbox.sh volks4th.com logtest.fb
logtest.log: volks4th.com tests/log2file.fb tests/logtest.fb
rm -f OUTPUT.LOG
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh volks4th.com "include logtest.fb"
dos2unix -n OUTPUT.LOG $@
incltest.log: v4thfile.com tests/log2file.fb tests/incltest.fth \
emulator/run-in-dosbox.sh
./emulator/run-in-dosbox.sh v4thfile.com incltest.fth
incltest.log: v4thfile.com tests/log2file.fb tests/incltest.fth
rm -f OUTPUT.LOG
FORTHPATH="f:\\;f:\\tests" ./emulator/run-in-dosbox.sh \
v4thfile.com "include incltest.fth"
dos2unix -n OUTPUT.LOG $@
test-min.log: v4thfile.com tests/* emulator/run-in-dosbox.sh
rm -f TEST.LOG
./emulator/run-in-dosbox.sh v4thfile.com test-min.fth
mv TEST.LOG $@
test-volks4th-min.log: v4thfile.com tests/* emulator/run-in-dosbox.sh
rm -f OUTPUT.LOG
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh v4thfile.com "include test-min.fth"
dos2unix -n OUTPUT.LOG $@
test-min.log: dosfiles/v4th.com dosfiles/asm.fb dosfiles/extend.fb \
dosfiles/multi.vid dosfiles/dos.fb dosfiles/include.fb \
$(patsubst tests/%, dosfiles/%, $(wildcard tests/*.*))
rm -f dosfiles/OUTPUT.LOG
(cd dosfiles && ../emulator/run-in-dosbox.sh v4th.com \
"include testprep.fb include test-min.fth")
dos2unix -n dosfiles/OUTPUT.LOG $@
test-min.golden: $(patsubst %, tests/golden/%.golden, prelim core)
cat $? > $@
@ -46,6 +62,10 @@ test-std.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
cat $? > $@
test-volks4th-min.golden: $(patsubst %, tests/golden/%.golden, \
volks4th-prelim core)
cat $? > $@
%.golden: tests/golden/%.golden
cp -p $< $@
@ -54,6 +74,20 @@ test-std.golden: $(patsubst %, tests/golden/%.golden, \
rm -f $@
tests/evaluate-test.sh $(basename $@)
dosfiles/%: %
test -d dosfiles || mkdir dosfiles
cp $< $@
dosfiles/%: src/%
test -d dosfiles || mkdir dosfiles
cp $< $@
dosfiles/%: tests/%
test -d dosfiles || mkdir dosfiles
cp $< $@
src/%.fth: src/%.fb ../../tools/fb2fth.py
../../tools/fb2fth.py $< $@

View File

@ -2,18 +2,12 @@
set -e
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")"
forth="$1"
include_filename="$2"
include_basename="${include_filename%.*}"
forthcmd=""
forthcmd="$2"
exit=""
bye=""
if [ -n "${include_basename}" ]; then
forthcmd="include ${include_filename}"
logname="${include_basename}.log"
if [ -n "${forthcmd}" ]; then
logname="output.log"
doslogname="$(echo ${logname}|tr '[:lower:]' '[:upper:]')"
rm -f "${logname}" "${doslogname}"
if [ -z "${KEEPEMU}" ]; then
@ -24,13 +18,13 @@ fi
auto_c=""
autocmd=""
pathcmd=""
if [ -n "${forth}" ]; then
auto_c="-c"
autocmd="${forth} path f:\\;f:\\src;f:\\tests ${forthcmd} ${bye}"
if [ -n "${FORTHPATH}" ]; then
pathcmd="path ${FORTHPATH}"
fi
autocmd="${forth} ${pathcmd} ${forthcmd} ${bye}"
fi
dosbox -c "mount f ${basedir}" -c "f:" "${auto_c}" "${autocmd}" $exit
if [ -n "${include_basename}" ]; then
dos2unix -n "${doslogname}" "${logname}"
fi
dosbox -c "mount f ." -c "f:" "${auto_c}" "${autocmd}" $exit

View File

@ -25,7 +25,7 @@ Pass #16: testing 2*
Pass #17: testing AND
Pass #18: testing AND
Pass #19: testing AND
PASS exists Pass #20: testing ?F~ ?~~ Pass Error
Pass #20: testing ?F~ ?~~ Pass Error
Pass #21: testing ?~
Pass #22: testing EMIT
Pass #23: testing S"

View File

@ -0,0 +1,41 @@
ANS-SHIM.FTH
PRELIM.FTH
CR CR SOURCE TYPE ( Preliminary test ) CR
SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR
( The next line of output should be blank to test CR ) SOURCE TYPE CR CR
( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR
( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR
( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR
( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR
( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR
( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC
( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC
( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC
( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC
( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC
Pass #11: testing WORD COUNT .MSG
Pass #12: testing = returns all 1's for true
Pass #13: testing = returns 0 for false
Pass #14: testing -1 interpreted correctly
Pass #15: testing 2*
Pass #16: testing 2*
Pass #17: testing AND
Pass #18: testing AND
Pass #19: testing AND
PASS exists Pass #20: testing ?F~ ?~~ Pass Error
Pass #21: testing ?~
Pass #22: testing EMIT
Pass #23: testing S"
Results:
Pass messages #1 to #23 should be displayed above
and no error messages
0 tests failed out of 57 additional tests
--- End of Preliminary Tests ---

View File

@ -1,6 +1,6 @@
include log2file.fb
logopen incltest.log
logopen output.log
.( hello, world) cr
: test-hello ." hello, world, from test-hello" cr ;

View File

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

View File

@ -20,11 +20,11 @@
\ *** Block No. 1, Hexblock 1
\ loadscreen phz 04jan22
\ loadscreen phz 22jan22
include log2file.fb
logopen logtest.log
logopen output.log
.( logtest done) cr
logclose

View File

@ -1,6 +1,6 @@
include log2file.fth
logopen test.log
logopen output.log
include ans-shim.fth
: \vf [compile] \ ; immediate

View File

@ -1,6 +1,6 @@
include log2file.fth
logopen test.log
logopen output.log
include ans-shim.fth
: \vf [compile] \ ; immediate
@ -9,16 +9,14 @@ include prelimtest.fth
include tester.fth
\ 1 verbose !
include core.fr
include coreplustest.fth
include coreplus.fth
include utilities.fth
include errorreport.fth
include util.fth
include errorrep.fth
include coreexttest.fth
include doubletest.fth
include coreext.fth
include double.fth
REPORT-ERRORS
logclose
dos s0:notdone

View File

@ -0,0 +1 @@
\ include file to bundle what test-*.fth need phz 30jan22\ on top of kernel.com \ loadscreen to prepare kernel.com for test-*.fth phz 30jan22 include extend.fb include multi.vid include dos.fb include include.fb include log2file.fb

View File

@ -0,0 +1,38 @@
\ *** Block No. 0, Hexblock 0
\ include file to bundle what test-*.fth need phz 30jan22
\ on top of kernel.com
\ *** Block No. 1, Hexblock 1
\ loadscreen to prepare kernel.com for test-*.fth phz 30jan22
include extend.fb
include multi.vid
include dos.fb
include include.fb
include log2file.fb