Files
rose-ash/run-tests.sh
giles 482bc0ca5e Remove Python SX tests from run-tests.sh — sx_ref.py being eliminated
OCaml kernel is the evaluator. Python host tests via sx_ref.py are
no longer relevant to the deploy gate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 13:46:32 +00:00

105 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# ===========================================================================
# run-tests.sh — Run ALL test suites. Exit non-zero if any fail.
#
# Usage:
# ./run-tests.sh # run everything
# ./run-tests.sh --quick # skip Playwright (fast CI check)
# ./run-tests.sh --sx-only # SX language tests only (JS + Python + OCaml)
# ===========================================================================
set -euo pipefail
cd "$(dirname "$0")"
QUICK=false
SX_ONLY=false
for arg in "$@"; do
case "$arg" in
--quick) QUICK=true ;;
--sx-only) SX_ONLY=true ;;
esac
done
FAILURES=()
PASSES=()
run_suite() {
local name="$1"
shift
echo ""
echo "============================================================"
echo " $name"
echo "============================================================"
if "$@"; then
PASSES+=("$name")
else
FAILURES+=("$name")
fi
}
# -------------------------------------------------------------------
# 1. Build SX bundles
# -------------------------------------------------------------------
echo "=== Building SX bundles ==="
python3 hosts/javascript/cli.py --output shared/static/scripts/sx-browser.js
python3 hosts/javascript/cli.py --extensions continuations --spec-modules types \
--output shared/static/scripts/sx-full-test.js
# -------------------------------------------------------------------
# 2. JavaScript SX tests (standard + full)
# -------------------------------------------------------------------
run_suite "JS standard (spec tests)" \
node hosts/javascript/run_tests.js
run_suite "JS full (spec + continuations + types + VM)" \
node hosts/javascript/run_tests.js --full
# -------------------------------------------------------------------
# 3. OCaml SX tests
# -------------------------------------------------------------------
if [ -x hosts/ocaml/_build/default/bin/run_tests.exe ]; then
run_suite "OCaml (spec tests)" \
hosts/ocaml/_build/default/bin/run_tests.exe
else
echo ""
echo "[SKIP] OCaml tests — binary not built (run: cd hosts/ocaml && dune build)"
fi
# -------------------------------------------------------------------
# 5. Playwright tests (browser)
# -------------------------------------------------------------------
if [ "$QUICK" = false ] && [ "$SX_ONLY" = false ]; then
run_suite "Playwright — isomorphic SSR" \
npx playwright test --reporter=list
run_suite "Playwright — SX demos (98 tests)" \
python3 -m pytest sx/tests/test_demos.py -v --tb=short
fi
# -------------------------------------------------------------------
# Summary
# -------------------------------------------------------------------
echo ""
echo "============================================================"
echo " TEST SUMMARY"
echo "============================================================"
for p in "${PASSES[@]}"; do
echo " PASS: $p"
done
for f in "${FAILURES[@]}"; do
echo " FAIL: $f"
done
echo "============================================================"
if [ ${#FAILURES[@]} -gt 0 ]; then
echo ""
echo " ${#FAILURES[@]} suite(s) FAILED — deploy blocked."
echo ""
exit 1
else
echo ""
echo " All ${#PASSES[@]} suites passed."
echo ""
exit 0
fi