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:
@@ -1,3 +1,3 @@
|
||||
539
|
||||
990
|
||||
# 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.
|
||||
|
||||
@@ -635,6 +635,7 @@ int v4_boot_run(const v4_boot *b)
|
||||
int how;
|
||||
|
||||
host.self = (void *)b; host.n = b->n; host.line = post_line; host.say = post_say;
|
||||
host.kernel = 0; /* the hosted product: no kernel, none of its words */
|
||||
if (!v4_post_run(&host, v4_post_cases, v4_post_case_count, &tally)) {
|
||||
say(b, "V4: POST reported failures\nPARITY:FAIL\nPOST: FAILED\n");
|
||||
return 0;
|
||||
|
||||
@@ -1320,6 +1320,7 @@ static int boot(v4_mesh *ms)
|
||||
v4_post_host host;
|
||||
v4_post_tally tally;
|
||||
host.self = ms; host.n = &h->n; host.line = post_line; host.say = post_say;
|
||||
host.kernel = 1; /* she has the kernel's words (physics.4th) */
|
||||
if (!v4_post_run(&host, v4_post_cases, v4_post_case_count, &tally)) { say("V4: POST reported failures\n"); return 0; }
|
||||
v4_dstack_reset(&h->n.ds);
|
||||
{
|
||||
|
||||
+18
-7
@@ -40,15 +40,19 @@ static void say_number(const v4_post_host *h, long long v)
|
||||
int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count, v4_post_tally *tally)
|
||||
{
|
||||
static char out[V4_POST_OUT]; /* what the case being run has printed */
|
||||
v4_cell left[SHOWN_STACK]; /* what it left on the stack, the top first */
|
||||
static v4_cell left[V4_DATA_DEPTH]; /* what it left on the stack, the top first: all of it, to compare (#189: v3's
|
||||
cases leave 101); SHOWN_STACK of it shown */
|
||||
unsigned i, k;
|
||||
|
||||
tally->tests = 0; tally->pass = 0; tally->fail = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
const v4_post_case *c = &cases[i];
|
||||
const int kind = c->expect & V4_POST_KIND;
|
||||
unsigned kept = 0, total = 0, len = 0, depth;
|
||||
int errored = 0, came_back = 1, lost = 0, no_state = 0, quit = 0, ok, how;
|
||||
|
||||
if ((c->expect & V4_POST_KERNEL) && !h->kernel) continue; /* no kernel: its words are not there */
|
||||
|
||||
/* every case starts from the same state */
|
||||
v4_dstack_reset(&h->n->ds);
|
||||
how = h->line(h->self, state_line, (unsigned)sizeof state_line - 1u, out, V4_POST_OUT, &len);
|
||||
@@ -73,26 +77,26 @@ int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count
|
||||
depth = h->n->ds.depth;
|
||||
for (k = 0; k < depth; k++) {
|
||||
v4_cell v = v4_dstack_pop(&h->n->ds);
|
||||
if (k < SHOWN_STACK) left[k] = v;
|
||||
if (k < V4_DATA_DEPTH) left[k] = v;
|
||||
}
|
||||
v4_dstack_reset(&h->n->ds);
|
||||
|
||||
if (!came_back || quit) {
|
||||
ok = 0;
|
||||
} else if (c->expect == V4_POST_ERROR) {
|
||||
} else if (kind == V4_POST_ERROR) {
|
||||
ok = errored;
|
||||
} else if (errored) {
|
||||
ok = 0;
|
||||
} else {
|
||||
ok = depth == c->depth;
|
||||
if (ok && c->expect == V4_POST_STACK) {
|
||||
if (depth > SHOWN_STACK) ok = 0;
|
||||
if (ok && kind == V4_POST_STACK) {
|
||||
if (depth > V4_DATA_DEPTH) ok = 0;
|
||||
for (k = 0; ok && k < depth; k++) ok = left[k] == (v4_cell)c->stack[depth - 1u - k];
|
||||
}
|
||||
if (ok && c->expect == V4_POST_HEAD) {
|
||||
if (ok && kind == V4_POST_HEAD) {
|
||||
ok = c->output_len <= kept;
|
||||
for (k = 0; ok && k < c->output_len; k++) ok = out[k] == c->output[k];
|
||||
} else if (ok && c->expect != V4_POST_DEPTH) {
|
||||
} else if (ok && kind != V4_POST_DEPTH) {
|
||||
ok = total == c->output_len && total <= V4_POST_OUT;
|
||||
for (k = 0; ok && k < total; k++) ok = out[k] == c->output[k];
|
||||
}
|
||||
@@ -124,3 +128,10 @@ int v4_post_run(const v4_post_host *h, const v4_post_case *cases, unsigned count
|
||||
say(h, "\n");
|
||||
return tally->fail == 0;
|
||||
}
|
||||
|
||||
unsigned v4_post_runs(const v4_post_case *cases, unsigned count, int kernel)
|
||||
{
|
||||
unsigned i, n = 0;
|
||||
for (i = 0; i < count; i++) if (kernel || !(cases[i].expect & V4_POST_KERNEL)) n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
+1903
-987
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user