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 / allen_route_mutants.sh
| 1 | #!/usr/bin/env bash |
| 2 | # allen_route_mutants.sh -- red before green for the interactive routing layer (aienos#399). |
| 3 | # |
| 4 | # Runs crates/allen-reflex/tests/route.rs once as is (must PASS) and once per host-only mutant feature of |
| 5 | # crates/allen-reflex (must FAIL, else the tests do not catch that mutation): |
| 6 | # route-mutant-grant an approval phrase runs directly instead of going to the owner desk |
| 7 | # route-mutant-dialog-pending pending state taken from the conversation (injectable) instead of the lifecycle |
| 8 | # route-mutant-guest-memory a guest reads owner memory |
| 9 | # Usage: scripts/allen_route_mutants.sh [cargo target dir]. Prints ALLEN_ROUTE_MUTANTS: PASS or FAIL. |
| 10 | set -uo pipefail |
| 11 | repo=$(cd "$(dirname "$0")/.." && pwd) |
| 12 | tgt=${1:-${CARGO_TARGET_DIR:-$repo/target}} |
| 13 | fail=0 |
| 14 | mkdir -p "$tgt" |
| 15 | run() { CARGO_TARGET_DIR="$tgt" cargo test -q --locked --manifest-path "$repo/Cargo.toml" -p allen-reflex --test route "$@" >"$tgt/route-mutant.log" 2>&1; } |
| 16 | if run; then echo "route tests (no mutant): PASS"; else echo "route tests (no mutant): FAIL"; tail -20 "$tgt/route-mutant.log"; fail=1; fi |
| 17 | for m in route-mutant-grant route-mutant-dialog-pending route-mutant-guest-memory; do |
| 18 | if run --features "$m"; then echo "mutant $m: tests PASSED, the mutation is not caught"; fail=1 |
| 19 | else echo "mutant $m: caught ($(grep -cE -- '--- FAILED$' "$tgt/route-mutant.log") tests failed)"; [ "$(grep -cE -- "--- FAILED$" "$tgt/route-mutant.log")" -gt 0 ] || { echo " ...but no test failed (build error?)"; fail=1; }; fi |
| 20 | done |
| 21 | if [ $fail = 0 ]; then echo "ALLEN_ROUTE_MUTANTS: PASS"; else echo "ALLEN_ROUTE_MUTANTS: FAIL"; exit 1; fi |