#!/usr/bin/env bash
# gate-289: each leg unpiped, exit code to its own file. Never pipe a verdict.
cd "$(dirname "$0")/../.." || exit 99
O=.spt/gate
leg() { n=$1; shift; date -u +%H:%M:%SZ > "$O/$n.start"; "$@" > "$O/$n.raw" 2>&1; echo "EXIT=$?" > "$O/$n.exit"; date -u +%H:%M:%SZ > "$O/$n.end"; }
leg build   cargo build -p spt -p spt-daemon
leg compile cargo test -p spt -p spt-daemon --no-run
leg unit_d  cargo test -p spt-daemon --lib -- refuse peer_reply reclassify unbounded_carrier
leg int_wrb cargo test -p spt-daemon --test wan_reply_bound
leg unit_s  cargo test -p spt --bin spt -- silent_peer every_send_outcome knock_refusals classify_
leg clippy  cargo clippy -p spt -p spt-daemon --all-targets -- -D warnings
leg treqs   traceable-reqs check
echo done > "$O/ALL.done"
