feat(v4): v3's whole POST is v4's POST -- 990 cases, all passed on Hera (#189)
Phase 7, Task 8: PARITY:V4_POST tests=990 pass=990 fail=0 on Hera (mesh-boot); the hosted
product 945 of them, all passed -- the 45 cases of physics.4th's words need the kernel.
- Enlarged, as ruled ("Enlarge v4 to fit"): a node is 32768 words, its data stack 1024
deep (v3's), host and kernel alike; the dictionary's end moves with them.
- POST's runner compares every value a case leaves (v3's leave 101); V4_POST_KERNEL marks
a case of the kernel's words, and a host without a kernel does not run it.
- mkpost.py --all is POST's table (make -C v4 post79), with docs/v4.0.0/POST.md; it reads a
module's #defines (v3's Mama cases are MAMA_IMPLEMENTED, 0: v3's own POST skips all 20);
it cuts no line between a word and the name it takes.
- Rules for the last of the table: the min/max and array-sum programs written as meant,
CREATE's 26-character name (FORTH-79: 31), many_defs.
- POST_FLOOR 990.
- Tests sized for a 32-deep stack and a 16384-word node made deep-stack-ready
(test_host_depth, test_host_quit, test_host_node, hosted-check, depthsweep.py).
make -C v4 test: all v4 tests passed. make -C kernel/tests test: all passed.
depthsweep at 1024: 230 runs, 0 failures. v4-checks running.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+20
-12
@@ -45,11 +45,18 @@ BINDIR := $(HERE)/build
|
||||
# do not fit 1024 words. Tests named test_host_*.c are therefore built with a
|
||||
# host node of HOST_WORDS words; every other test keeps the mesh-node size.
|
||||
#
|
||||
# The host node's stacks are deeper too (DECOMPOSITION.md D-17): 32 values and
|
||||
# The host node's stacks are deeper too (DECOMPOSITION.md D-17): 1024 values and
|
||||
# 32 return entries, where a mesh node has the F18's 10 and 9. The stack is
|
||||
# its top registers and a ring; the ring sizes are what is set here.
|
||||
HOST_WORDS := 16384
|
||||
HOST_DATA_RING := 30
|
||||
# Enlarged 2026-11-14 (#189 Phase 7, Captain Bob: "Enlarge v4 to fit" v3's whole
|
||||
# POST): 32768 words, not 16384, so the dictionary holds the whole run and v3's
|
||||
# ALLOT 8K; a data stack of 1024, v3's, not 32, for v3's 900-deep cases.
|
||||
HOST_WORDS := 32768
|
||||
HOST_DATA_RING := 1022
|
||||
# hosted-check's deep lines (29 and 26 when the stack was 32): one value past what a line may leave (the prompt
|
||||
# keeps four cells), and as many as WORDS can print with
|
||||
DEEP_OVER := $(shell expr $(HOST_DATA_RING) - 1)
|
||||
DEEP_WORDS := $(shell expr $(HOST_DATA_RING) - 4)
|
||||
HOST_RET_RING := 31
|
||||
# The host node's ROM range (docs/v4.0.0/MACHINE.md section 2): words above
|
||||
# RAM that the machine can fetch and run but never write. Its size is
|
||||
@@ -219,8 +226,9 @@ $(foreach i,$(HOSTED_ISAS),$(eval $(call HOSTED_RULE,$(i))))
|
||||
|
||||
# `make post` boots the amd64 system alone, which is the quick check after a
|
||||
# change to the vocabulary: nucleus, forth79.4th, POST, prompt. `make
|
||||
# post79` writes POST's cases, system/post_cases.c, again from
|
||||
# v3's cases and tools/post79_rules.py (tools/mkpost.py), with the hosted v3
|
||||
# post79` writes POST's cases, system/post_cases.c, again from v3's whole
|
||||
# POST (#189 Phase 7: every module, --all) and tools/post79_rules.py and
|
||||
# tools/post_all_rules.py (tools/mkpost.py; docs/v4.0.0/POST.md), with the hosted v3
|
||||
# binary built first from this tree's source -- v3/Makefile, in its own build
|
||||
# directory; not the lfs/ copy, which can be older (#190).
|
||||
V3_HOSTED = $(shell $(MAKE) -s -C $(ROOT) -f v3/Makefile --eval 'v3bin: ; @echo $$(BINARY)' v3bin 2>/dev/null)
|
||||
@@ -229,7 +237,7 @@ post: $(BINDIR)/starforth4-amd64
|
||||
@$(BINDIR)/starforth4-amd64 < /dev/null
|
||||
post79:
|
||||
$(MAKE) --no-print-directory -C $(ROOT) -f v3/Makefile $(V3_HOSTED)
|
||||
python3 $(HERE)/tools/mkpost.py --v3 $(ROOT)/$(V3_HOSTED)
|
||||
python3 $(HERE)/tools/mkpost.py --all --v3 $(ROOT)/$(V3_HOSTED)
|
||||
|
||||
# `make hosted` builds the three. `make hosted-check` boots each with no
|
||||
# input and requires that all three print the same lines, ending in
|
||||
@@ -255,14 +263,14 @@ hosted-check: $(foreach i,$(HOSTED_ISAS),$(BINDIR)/boot-$(i).txt) $(BINDIR)/star
|
||||
@grep -q "^ok> UNKNOWN WORD: 'T{'$$" $(BINDIR)/after-post-amd64.txt || { echo "hosted-check: POST's harness is on the node"; exit 1; }
|
||||
@printf '5 7 PORT!\n1 2 + .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/noone-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> No one on that port$$' $(BINDIR)/noone-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/noone-amd64.txt || { echo "hosted-check: a write to a port with no one on it was not an error the node came back from"; cat $(BINDIR)/noone-amd64.txt | tail -4; exit 1; }
|
||||
@printf '65536 0 0 0 Q./\n3 .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/qdiv-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> Division by zero$$' $(BINDIR)/qdiv-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/qdiv-amd64.txt || { echo "hosted-check: a division by zero inside the ROM's Q./ was not an error the node came back from"; tail -4 $(BINDIR)/qdiv-amd64.txt; exit 1; }
|
||||
@printf '65536 0 0 0 Q./ D.\n3 .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/qdiv-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> 0 ok$$' $(BINDIR)/qdiv-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/qdiv-amd64.txt || { echo "hosted-check: a division by zero inside the ROM's Q./ did not give 0 and come back (v3's table, ruled 2026-11-14)"; tail -4 $(BINDIR)/qdiv-amd64.txt; exit 1; }
|
||||
@printf '5 AWAIT\n1 2 + .\n7 8 * .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/await-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> Interrupted$$' $(BINDIR)/await-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/await-amd64.txt && grep -q '^ok> 56 ok$$' $(BINDIR)/await-amd64.txt || { echo "hosted-check: a line typed while the node waited did not break the wait and then run"; tail -6 $(BINDIR)/await-amd64.txt; exit 1; }
|
||||
@printf '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29\n1 2 + .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/deep-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> Stack overflow$$' $(BINDIR)/deep-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/deep-amd64.txt || { echo "hosted-check: a line that left 29 values on the stack was not an error the node came back from"; tail -4 $(BINDIR)/deep-amd64.txt; exit 1; }
|
||||
@printf '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26\nWORDS\nDEPTH .\n' | $(BINDIR)/starforth4-amd64 > $(BINDIR)/deepwords-amd64.txt 2>&1; true
|
||||
@grep -q 'DUP' $(BINDIR)/deepwords-amd64.txt && grep -q '^ok> 26 ok$$' $(BINDIR)/deepwords-amd64.txt || { echo "hosted-check: WORDS with 26 values on the stack did not print and come back"; tail -4 $(BINDIR)/deepwords-amd64.txt | cut -c1-200; exit 1; }
|
||||
@printf ': P %d 0 DO I LOOP ; P\n1 2 + .\n' $(DEEP_OVER) | $(BINDIR)/starforth4-amd64 > $(BINDIR)/deep-amd64.txt 2>&1; true
|
||||
@grep -q '^ok> Stack overflow$$' $(BINDIR)/deep-amd64.txt && grep -q '^ok> 3 ok$$' $(BINDIR)/deep-amd64.txt || { echo "hosted-check: a line that left $(DEEP_OVER) values on the stack was not an error the node came back from"; tail -4 $(BINDIR)/deep-amd64.txt; exit 1; }
|
||||
@printf ': P %d 0 DO I LOOP ; P\nWORDS\nDEPTH .\n' $(DEEP_WORDS) | $(BINDIR)/starforth4-amd64 > $(BINDIR)/deepwords-amd64.txt 2>&1; true
|
||||
@grep -q 'DUP' $(BINDIR)/deepwords-amd64.txt && grep -q '^ok> $(DEEP_WORDS) ok$$' $(BINDIR)/deepwords-amd64.txt || { echo "hosted-check: WORDS with $(DEEP_WORDS) values on the stack did not print and come back"; tail -4 $(BINDIR)/deepwords-amd64.txt | cut -c1-200; exit 1; }
|
||||
@printf '1 0 ROUTE\n65 EMIT\n: P 400 0 DO I . LOOP ; P\nNO-ROUTES\nDEPTH .\n1 2 + .\n' | timeout 120 $(BINDIR)/starforth4-amd64 > $(BINDIR)/kport-amd64.txt 2>&1; true
|
||||
@test $$(grep -c '^ok> ERROR$$' $(BINDIR)/kport-amd64.txt) -eq 2 && grep -q '^ok> 3 ok$$' $(BINDIR)/kport-amd64.txt && grep -q '^ok> 0 ok$$' $(BINDIR)/kport-amd64.txt || { echo "hosted-check: with the way to the console set to the kernel's port, a line that prints did not end in an error at the prompt, or left something on the stack, or the node did not come back"; tail -6 $(BINDIR)/kport-amd64.txt; exit 1; }
|
||||
@printf ': S0 S" 1 DROP" 0 0 SEND-ON ; S0\n1 2 + .\n65 1 BLOCK C! 1 BLOCK C@ .\n' | timeout 120 $(BINDIR)/starforth4-amd64 > $(BINDIR)/ksend-amd64.txt 2>&1; true
|
||||
|
||||
Reference in New Issue
Block a user