interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / scripts / allen_route_mutants.sh

21 lines · 1626 bytes Raw Blame History
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.
10set -uo pipefail
11repo=$(cd "$(dirname "$0")/.." && pwd)
12tgt=${1:-${CARGO_TARGET_DIR:-$repo/target}}
13fail=0
14mkdir -p "$tgt"
15run() { CARGO_TARGET_DIR="$tgt" cargo test -q --locked --manifest-path "$repo/Cargo.toml" -p allen-reflex --test route "$@" >"$tgt/route-mutant.log" 2>&1; }
16if run; then echo "route tests (no mutant): PASS"; else echo "route tests (no mutant): FAIL"; tail -20 "$tgt/route-mutant.log"; fail=1; fi
17for 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
20done
21if [ $fail = 0 ]; then echo "ALLEN_ROUTE_MUTANTS: PASS"; else echo "ALLEN_ROUTE_MUTANTS: FAIL"; exit 1; fi