Files
LithosAnanke/tools/hermes_tripod_smoke.sh
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

130 lines
3.7 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# Hermes Tripod integration test — exercises all 6 inter-VM message paths.
# Uses the DEFER VM-EXEC / IS VM-EXEC mechanism from init.4th to inject a
# name-length dispatcher shim before Hermes loads.
#
# Run: bash tools/hermes_tripod_smoke.sh
#
# Pass/fail: greps for '^>>>' lines; checks expected recv order and
# that the arena is clean (0) after reap.
SF=./build/amd64/standard/starforth
CORE_INIT=./capsules/core/init.4th
HERMES=./capsules/hermes/init.4th
BACKUP=${CORE_INIT}.tripod_bak
cleanup() {
if [ -f "$BACKUP" ]; then
mv "$BACKUP" "$CORE_INIT"
fi
}
trap cleanup EXIT INT TERM
cp "$CORE_INIT" "$BACKUP"
# Build combined init: core block 1 (contains DEFER VM-EXEC / IS VM-EXEC-STUB)
# + VM-EXEC dispatcher shim block
# + Hermes capsule blocks
# + 6-path test blocks
#
# NOTE: read from BACKUP — redirect to CORE_INIT would truncate it first.
{
cat "$BACKUP"
cat <<'SHIMBLOCK'
Block 9996
( Tripod VM-EXEC dispatcher shim )
: VM-EXEC-TRIPOD ( paddr plen name-addr name-len -- )
>R >R 2DROP R> R>
DUP 4 = IF 2DROP ." [Hera recv]" CR EXIT THEN
DUP 6 = IF 2DROP ." [Hermes recv]" CR EXIT THEN
2DROP ." [Artemis recv]" CR ;
' VM-EXEC-TRIPOD IS VM-EXEC
SHIMBLOCK
cat "$HERMES"
cat <<'TESTBLOCK'
Block 9997
( Hermes Tripod integration test — 6-path sequence )
: TRIP-ZERO-6 ( -- )
MSG-ARENA MSG-SCAN !
6 0 DO
0 MSG-SCAN @ MSG-HEAT!
MSG-SCAN @ MSG-CELLS CELLS + MSG-SCAN !
LOOP ;
CD-INIT
." >>> Tripod integration test" CR
." >>> [1] Hera->Hermes SPAWN-EVENT" CR
SPAWN-EVENT 0 1 S" boot" MSG-SEND
." >>> [2] Hera->Artemis store request" CR
10 0 2 S" boot-rec" MSG-SEND
." >>> [3] Hermes->Hera delivery confirm" CR
SPAWN-EVENT 1 0 S" ok" MSG-SEND
." >>> [4] Hermes->Artemis log store" CR
11 1 2 S" msglog" MSG-SEND
." >>> [5] Artemis->Hera ACK" CR
12 2 0 S" stored" MSG-SEND
." >>> [6] Artemis->Hermes route result" CR
13 2 1 S" result" MSG-SEND
." >>> HERMES-TICK (cool all 6)" CR
HERMES-TICK
." >>> HERMES-TICK ok" CR
TRIP-ZERO-6 MSG-REAP
." >>> MSG-ARENA clean (expect 0): " MSG-ARENA MSG-TYPE@ . CR
." >>> === Tripod integration complete ===" CR
BYE
TESTBLOCK
} > "$CORE_INIT"
OUTPUT=$($SF --log-none 2>&1)
echo "$OUTPUT" | grep '^>>>\|\[\(Hera\|Hermes\|Artemis\) recv\]'
# Validation checks
PASS=0
FAIL=0
check() {
label="$1"
pattern="$2"
if echo "$OUTPUT" | grep -qF "$pattern"; then
echo " PASS: $label"
PASS=$((PASS + 1))
else
echo " FAIL: $label (expected: $pattern)"
FAIL=$((FAIL + 1))
fi
}
echo ""
echo "=== Validation ==="
check "test started" ">>> Tripod integration test"
check "path1 header" ">>> [1] Hera->Hermes SPAWN-EVENT"
check "path1 recv" "[Hermes recv]"
check "path2 header" ">>> [2] Hera->Artemis store request"
check "path2 recv" "[Artemis recv]"
check "path3 header" ">>> [3] Hermes->Hera delivery confirm"
check "path3 recv" "[Hera recv]"
check "path4 header" ">>> [4] Hermes->Artemis log store"
check "path4 recv" "[Artemis recv]"
check "path5 header" ">>> [5] Artemis->Hera ACK"
check "path5 recv" "[Hera recv]"
check "path6 header" ">>> [6] Artemis->Hermes route result"
check "path6 recv" "[Hermes recv]"
check "HERMES-TICK ok" ">>> HERMES-TICK ok"
check "arena clean" ">>> MSG-ARENA clean (expect 0): 0"
check "integration complete" ">>> === Tripod integration complete ==="
echo ""
echo "Result: $PASS passed, $FAIL failed"
if [ "$FAIL" -eq 0 ]; then
echo "TRIPOD SMOKE: PASS"
exit 0
else
echo "TRIPOD SMOKE: FAIL"
exit 1
fi