Files
LithosAnanke/scripts/test_nightly_post_count.sh
T
Claude 4738aee4c0 ci: acceptance asserts POST's test count against a floor in the tree (#173)
Captain Bob, 2026-11-12: "Yes". Acceptance checked POST: PASSED, so a POST
that lost cases still passed. Now scripts/nightly.sh post-count, which the
stick-high stage runs after dict-hash: each of the four boots must report
PARITY:V4_POST with every test passed and at least the floor's tests --
v4/system/POST_FLOOR, 538 today, raised when POST grows and never lowered
without Captain Bob. A boot with no POST line, not run, or no floor file is
refused, not skipped.

scripts/test_nightly_post_count.sh, written first and seen to fail (the stage
not existing), then 7 cases: 538 and 600 pass; fewer than the floor, a
failure, no POST line, a boot not run, no floor -- refused. Run on the boots
of the last protocol (d7b2f6bf): all four 538 of 538. logs/20261112-185620/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
2026-11-12 18:56:20 +00:00

47 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# test_nightly_post_count.sh -- the tests of `scripts/nightly.sh post-count` (#173): every boot of the
# acceptance reports POST with at least the floor's tests (v4/system/POST_FLOOR), all passed. No
# QEMU: each case is a scratch NIGHTLY_OUT with accept-<boot>.txt files and serial logs, and a
# scratch POST_FLOOR.
#
# Prints PASS:/FAIL: per check and RESULT:; exits 0 only if every check passes.
set -uo pipefail
NIGHTLY="$(cd "$(dirname "$0")" && pwd)/nightly.sh"
T=$(mktemp -d)
trap 'rm -rf "$T"' EXIT
ok=1
boot() { # boot <boot> <tests> <pass> <fail> | boot <boot> none
local b=$1 log="$T/logs/$1.log"
mkdir -p "$T/out" "$T/logs"
printf 'LOG: %s\nRESULT: PASS\n' "$log" > "$T/out/accept-$b.txt"
if [ "$2" = none ]; then printf 'POST: PASSED\n' > "$log"
else printf 'PARITY:V4_POST tests=%s pass=%s fail=%s\nPOST: PASSED\n' "$2" "$3" "$4" > "$log"; fi
}
all() { for b in amd64 aarch64 riscv64 stick-high; do boot "$b" "$@"; done; }
expect() { # expect <pass|refuse> "what"
local want=$1 what=$2 out rc
out=$(NIGHTLY_OUT="$T/out" POST_FLOOR_FILE="$T/floor" bash "$NIGHTLY" post-count 2>&1); rc=$?
if { [ "$want" = pass ] && [ $rc -eq 0 ]; } ||
{ [ "$want" = refuse ] && [ $rc -eq 1 ] && grep -q "POST" <<<"$out"; }; then
echo "PASS: $what"
else
echo "FAIL: $what (exit $rc)"; printf ' %s\n' "$out" | head -4; ok=0
fi
}
echo 538 > "$T/floor"
all 538 538 0; expect pass "four boots, 538 of 538, floor 538: pass"
all 600 600 0; expect pass "POST grew past the floor: pass"
boot riscv64 537 537 0; expect refuse "one boot ran fewer tests than the floor (537 < 538): refused"
all 538 538 0; boot aarch64 538 537 1; expect refuse "one boot with a failure: refused"
all 538 538 0; boot stick-high none; expect refuse "one boot with no PARITY:V4_POST line: refused"
all 538 538 0; rm -f "$T/out/accept-amd64.txt"; expect refuse "one boot not run: refused"
all 538 538 0; rm -f "$T/floor"; expect refuse "no floor in the tree: refused, not skipped"
echo "RESULT: $([ $ok = 1 ] && echo PASS || echo FAIL)"
[ $ok = 1 ]