fix(v4): #190 POST regenerates the same; #16 sanitizers and hosted-check nightly

Captain Bob, 2026-11-13: "Create the issues then fix them before the long
acceptance test runs"; #16: "Nightly".

#190 -- make -C v4 post79 did not reproduce POST:
- mkpost.py runs v3 with address randomisation off (setarch -R): its
  printed addresses (>IN, FIND) are the same each run, so POST79.md is.
- v4/Makefile post79 builds hosted v3 from this tree's source first and
  uses it, not the lfs/ copy, which can be older.
- post_cases.c and POST79.md regenerated: 539 cases -- LOAD.rest_of_line,
  which v3 gets through since it changed after 2026-10-07. Two runs the
  same. POST_FLOOR 538 -> 539 (#173).
- test_host_unit.c takes the table's count, not 538 typed in the test.

#16 -- scripts/nightly.sh v4-checks: make -C v4 sanitize hosted-check,
logged under logs/<TS>/v4-checks/, refused without qemu-user; nightly.yml
runs it after publishing, before the proofs, installing qemu-user if the
image lacks it.

Evidence (logs/20261113-014927/post79, -024314): before, regenerated with
nothing changed: 539 cases and addresses differing run to run; after: the
same twice, hosted POST 539/539; test, test-32 99 programs 0 failures;
v4-checks 79 programs under the sanitizers 0 failures, the hosted builds
alike. The first verification failed at test_host_unit.c:442 (kept); a
stray v4-checks run stopped at once is kept, labelled (-014453).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 03:19:24 +00:00
parent abfb30d0c4
commit be456d44e9
22 changed files with 408 additions and 320 deletions
+6 -3
View File
@@ -218,13 +218,16 @@ $(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); it needs the
# hosted v3 binary.
# v3's cases and tools/post79_rules.py (tools/mkpost.py), 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)
.PHONY: post post79
post: $(BINDIR)/starforth4-amd64
@$(BINDIR)/starforth4-amd64 < /dev/null
post79:
python3 $(HERE)/tools/mkpost.py
$(MAKE) --no-print-directory -C $(ROOT) -f v3/Makefile $(V3_HOSTED)
python3 $(HERE)/tools/mkpost.py --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
+1 -1
View File
@@ -1,3 +1,3 @@
538
539
# v4 POST: the fewest tests an accepted boot may report (#173). Raise it when POST grows;
# never lower it without Captain Bob. scripts/nightly.sh post-count reads the first line.
+307 -305
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -439,8 +439,11 @@ int main(void)
uint64_t hash = v4_image_dict_hash(hera, &im);
memcpy(before, hera->mem, sizeof before);
host.self = 0; host.n = hera; host.line = post_line; host.say = post_say;
CHECK(v4_post_run(&host, v4_post_cases, v4_post_case_count, &tally) && tally.tests == 538 && tally.pass == 538 && tally.fail == 0
&& strstr(post_said, "PARITY:V4_POST tests=538 pass=538 fail=0\n") != NULL && strstr(post_said, "POST FAIL") == NULL,
char want_line[64]; /* the table's own count, not a number typed here: it was 538, POST grew (#190) */
snprintf(want_line, sizeof want_line, "PARITY:V4_POST tests=%u pass=%u fail=0\n", v4_post_case_count, v4_post_case_count);
CHECK(v4_post_run(&host, v4_post_cases, v4_post_case_count, &tally) && tally.tests == v4_post_case_count
&& tally.pass == v4_post_case_count && tally.fail == 0
&& strstr(post_said, want_line) != NULL && strstr(post_said, "POST FAIL") == NULL,
"and passes POST, which the kernel runs on her: %u of %u, %u failed; \"%s\"", tally.pass, tally.tests, tally.fail, post_said);
CHECK(strcmp(tell(10, "RS1"), "42 42 \n") == 0, "while POST runs, what its cases define is on her: \"%s\"", printed);
CHECK(strstr(tell(10, "COLD"), "Cold Start") != NULL, "the kernel puts her back to the system as it was sealed");
+9 -1
View File
@@ -29,7 +29,9 @@ and the same lines.)
"""
import argparse
import os
import platform
import re
import shutil
import subprocess
import sys
@@ -252,7 +254,13 @@ def run_v3(v3, cases):
script.extend(line[3:] for line in case["lines"])
script.append('." [[E%d]]" BASE @ DECIMAL .S BASE ! ." [[S%d]]"' % (n, n))
script.append("BYE")
done = subprocess.run([v3, "--log-none"], input=("\n".join(script) + "\n").encode("latin-1"),
# With the address space randomised, what v3 prints for an address (>IN, FIND) is different on
# every run, so the report (POST79.md) could never be written twice the same (#190): v3 is run
# with randomisation off (setarch -R), and its addresses are the same each time.
cmd = [v3, "--log-none"]
if shutil.which("setarch"):
cmd = ["setarch", platform.machine(), "-R"] + cmd
done = subprocess.run(cmd, input=("\n".join(script) + "\n").encode("latin-1"),
capture_output=True, timeout=600)
text = ANSI.sub("", done.stdout.decode("latin-1")) # a byte is a character
results = []