#!/usr/bin/env bash
# W3 lane battery. Each leg writes its OWN exit file; the wrapper's status is
# never the verdict (a wrapper ends on its last command, not on the legs).
cd "$(dirname "$0")" || exit 99
rm -f B_*.exit

( cargo build -p spt --bins > B_prebuild.raw 2>&1 ); echo $? > B_prebuild.exit
( cargo nextest run -p spt --bins > B_bins.raw 2>&1 ); echo $? > B_bins.exit
( cargo nextest run -p spt-store > B_store.raw 2>&1 ); echo $? > B_store.exit
( cargo nextest run -p spt-live > B_live.raw 2>&1 ); echo $? > B_live.exit
( cargo nextest run -p spt-daemon --lib > B_daemon.raw 2>&1 ); echo $? > B_daemon.exit
( cargo clippy --workspace --all-targets -- -D warnings > B_clippy.raw 2>&1 ); echo $? > B_clippy.exit
( traceable-reqs check > B_treqs.raw 2>&1 ); echo $? > B_treqs.exit
( cargo run -p xtask -- check > B_xtask.raw 2>&1 ); echo $? > B_xtask.exit
echo "BATTERY LEGS DONE"
