aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / ck_mind_phases_test.sh
| 1 | #!/bin/sh |
| 2 | # Focused host-only production mind renderer regression; no UI boot or image build. |
| 3 | set -eu |
| 4 | cd "$(dirname "$0")/.." |
| 5 | K=native/kernel |
| 6 | OUT=${1:-target/native-kernel-mind-phases} |
| 7 | mkdir -p "$OUT" |
| 8 | CC=${HOSTCC:-cc} |
| 9 | "$CC" -std=gnu11 -O2 -Wall -Wextra -Werror -I "$K/ui" -o "$OUT/mind-phases-test" \ |
| 10 | "$K/ui/tests/mind_phases_test.c" "${MIND_SOURCE:-$K/ui/mind.c}" \ |
| 11 | "$K/ui/paint.c" "$K/ui/night.c" "$K/ui/sky_real.c" "$K/ui/sky_data.c" "$K/ui/allen_font.c" |
| 12 | "$OUT/mind-phases-test" "$OUT" "${2:-}" |
| 13 | |
| 14 | if [ "$#" -lt 2 ]; then |
| 15 | for control in warm large-disc suppressed halo; do |
| 16 | if "$OUT/mind-phases-test" - "--$control-control" > "$OUT/control-$control.log" 2>&1; then |
| 17 | echo "MIND_PHASES: FAIL detector accepted $control control" |
| 18 | exit 1 |
| 19 | else |
| 20 | status=$? |
| 21 | [ "$status" -eq 1 ] || exit "$status" |
| 22 | fi |
| 23 | echo "MIND_PHASES: rejected $control control" |
| 24 | done |
| 25 | # Exact source mutants exercise the production point/tail/heart paths. |
| 26 | # Python is a hosted test oracle only; no production dependency is added. |
| 27 | python3 - "$K/ui/mind.c" "$OUT" <<'PY' |
| 28 | from pathlib import Path |
| 29 | import sys |
| 30 | source = Path(sys.argv[1]).read_text() |
| 31 | mutations = { |
| 32 | "warm-tail": ("16 - k * 4, CK_RGB(48, 112, 192)", "16 - k * 4, CK_RGB(255, 222, 176)"), |
| 33 | "white-heart": ("ck_mix(CK_RGB(32, 72, 144), CK_RGB(48, 112, 192), m->heart)", |
| 34 | "ck_mix(CK_RGB(255, 210, 170), CK_RGB(255, 250, 240), m->heart)"), |
| 35 | "bright-point": ("ck_mix(CK_RGB(32, 72, 144), CK_RGB(48, 112, 192), m->act[i])", |
| 36 | "ck_mix(CK_RGB(206, 222, 255), CK_RGB(255, 214, 160), m->act[i])"), |
| 37 | "large-point": ("int32_t rad = 16;", "int32_t rad = 96;"), |
| 38 | "large-heart": ("m->hr = 24;", "m->hr = 160;"), |
| 39 | } |
| 40 | for name, (old, new) in mutations.items(): |
| 41 | if source.count(old) != 1: |
| 42 | raise SystemExit("mutant anchor changed: " + name) |
| 43 | Path(sys.argv[2], "mutant-" + name + ".c").write_text(source.replace(old, new)) |
| 44 | PY |
| 45 | for mutant in warm-tail white-heart bright-point large-point large-heart; do |
| 46 | "$CC" -std=gnu11 -O2 -Wall -Wextra -Werror -I "$K/ui" -o "$OUT/mutant-$mutant-test" \ |
| 47 | "$K/ui/tests/mind_phases_test.c" "$OUT/mutant-$mutant.c" \ |
| 48 | "$K/ui/paint.c" "$K/ui/night.c" "$K/ui/sky_real.c" "$K/ui/sky_data.c" "$K/ui/allen_font.c" |
| 49 | if "$OUT/mutant-$mutant-test" - > "$OUT/mutant-$mutant.log" 2>&1; then |
| 50 | echo "MIND_PHASES: FAIL accepted source mutant $mutant" |
| 51 | exit 1 |
| 52 | else |
| 53 | status=$? |
| 54 | [ "$status" -eq 1 ] || exit "$status" |
| 55 | fi |
| 56 | echo "MIND_PHASES: rejected source mutant $mutant" |
| 57 | done |
| 58 | # Only the full run (renderer, every control and every source mutant) earns the PASS line; |
| 59 | # a focused run with a second argument prints none. |
| 60 | echo "AIENOS_MIND_PHASES: PASS" |
| 61 | fi |