Files
settled-reach/tests/run-all
T
jpmschweitzerandClaude Opus 4.6 4f21465dbf feat(ci): test runner scripts and Makefile integration (#270)
Six test runner scripts at tests/: run-rust, run-godot, run-ipc-fixtures,
run-ipc-protocol, run-ipc-integration, run-all. Plus run-ipc-benchmark
for Layer 3 timing. All produce structured JSON stdout, support --filter,
and exit 0/non-zero. Makefile targets updated to delegate to scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 12:47:58 +01:00

78 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# tests/run-all: Run all test suites in order (D-030)
# Invokes run-rust, run-godot, run-ipc-fixtures, run-ipc-protocol, run-ipc-integration.
# Exit: 0 = all suites pass, non-zero = any suite failed
# Stdout: {"suite":"all","total":N,"passed":N,"failed":N,"duration_ms":N,"suites":[...]}
set -euo pipefail
FILTER=""
while [[ $# -gt 0 ]]; do
case "$1" in
--filter) FILTER="${2:-}"; shift 2 ;;
--filter=*) FILTER="${1#--filter=}"; shift ;;
*) echo "Unknown argument: $1" >&2; exit 2 ;;
esac
done
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PASS_ARGS=()
[[ -n "$FILTER" ]] && PASS_ARGS+=(--filter "$FILTER")
SUITES=(
run-rust
run-godot
run-ipc-fixtures
run-ipc-protocol
run-ipc-integration
)
START_MS=$(date +%s%3N)
OVERALL_TOTAL=0
OVERALL_PASSED=0
OVERALL_FAILED=0
OVERALL_EXIT=0
SUITE_RESULTS=""
for suite in "${SUITES[@]}"; do
script="$SCRIPT_DIR/$suite"
if [[ ! -x "$script" ]]; then
echo "Warning: $script not found or not executable — skipping" >&2
continue
fi
SUITE_OUT=$(mktemp)
set +e
"$script" "${PASS_ARGS[@]}" >"$SUITE_OUT"
SUITE_EXIT=$?
set -e
SUITE_JSON=$(cat "$SUITE_OUT")
rm -f "$SUITE_OUT"
# Accumulate totals from the suite's JSON output
S_TOTAL=$(echo "$SUITE_JSON" | grep -oE '"total":[0-9]+' | grep -oE '[0-9]+' || echo 0)
S_PASSED=$(echo "$SUITE_JSON" | grep -oE '"passed":[0-9]+' | grep -oE '[0-9]+' || echo 0)
S_FAILED=$(echo "$SUITE_JSON" | grep -oE '"failed":[0-9]+' | grep -oE '[0-9]+' || echo 0)
OVERALL_TOTAL=$(( OVERALL_TOTAL + ${S_TOTAL:-0} ))
OVERALL_PASSED=$(( OVERALL_PASSED + ${S_PASSED:-0} ))
OVERALL_FAILED=$(( OVERALL_FAILED + ${S_FAILED:-0} ))
[[ $SUITE_EXIT -ne 0 ]] && OVERALL_EXIT=1
# Build suites array for JSON
if [[ -n "$SUITE_RESULTS" ]]; then
SUITE_RESULTS="$SUITE_RESULTS,$SUITE_JSON"
else
SUITE_RESULTS="$SUITE_JSON"
fi
done
END_MS=$(date +%s%3N)
DURATION_MS=$((END_MS - START_MS))
printf '{"suite":"all","total":%d,"passed":%d,"failed":%d,"duration_ms":%d,"suites":[%s]}\n' \
"$OVERALL_TOTAL" "$OVERALL_PASSED" "$OVERALL_FAILED" "$DURATION_MS" "$SUITE_RESULTS"
exit $OVERALL_EXIT