#!/bin/bash # run-all-tests.sh — Three-tier test runner for cl-tty # Exits non-zero if any tier fails. # Run from the project root: ./run-all-tests.sh set -euo pipefail DIR="$(cd "$(dirname "$0")" && pwd)" FAIL=0 # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BOLD='\033[1m' NC='\033[0m' summary() { if [ "$1" -eq 0 ]; then echo -e " ${GREEN}✓${NC} $2" else echo -e " ${RED}✗${NC} $2" FAIL=1 fi } echo -e "\n${BOLD}═══ Tier 1: FiveAM Unit Tests ═══${NC}" cd "$DIR" if sbcl --noinform --eval '(load "~/quicklisp/setup.lisp")' \ --eval '(push (truename ".") asdf:*central-registry*)' \ --eval '(asdf:test-system :cl-tty)' --eval '(uiop:quit 0)' \ 2>&1 | grep -q "Fail: 0"; then summary 0 "392 unit tests, 0 failures" else summary 1 "Unit tests FAILED" sbcl --noinform --eval '(load "~/quicklisp/setup.lisp")' \ --eval '(push (truename ".") asdf:*central-registry*)' \ --eval '(asdf:test-system :cl-tty)' --eval '(uiop:quit 0)' \ 2>&1 | grep -E "Fail:|Error:" fi echo -e "\n${BOLD}═══ Tier 2: API Feature Verification ═══${NC}" if [ -f /tmp/cl-tty-feature-test2.py ]; then if python3 /tmp/cl-tty-feature-test2.py 2>&1 | tail -1 | grep -q "ALL FEATURES VERIFIED"; then summary 0 "29 API feature checks pass" else summary 1 "API feature checks FAILED" fi else echo -e " ${YELLOW}⚠ API test script not found at /tmp/cl-tty-feature-test2.py${NC}" echo -e " ${YELLOW} Run: python3 /tmp/cl-tty-feature-test2.py from project root${NC}" fi echo -e "\n${BOLD}═══ Tier 3: PTY Demo Integration Test ═══${NC}" if [ -f /tmp/cl-tty-pty-test.py ]; then if python3 /tmp/cl-tty-pty-test.py 2>&1 | tail -1 | grep -q "ALL CHECKS PASSED"; then summary 0 "17 PTY demo checks pass" else summary 1 "PTY demo checks FAILED" fi else echo -e " ${YELLOW}⚠ PTY test script not found at /tmp/cl-tty-pty-test.py${NC}" echo -e " ${YELLOW} Run: python3 /tmp/cl-tty-pty-test.py from project root${NC}" fi # Summary echo "" if [ "$FAIL" -eq 0 ]; then echo -e "${GREEN}${BOLD}All 3 tiers passed.${NC}" else echo -e "${RED}${BOLD}Some tiers failed.${NC}" fi exit "$FAIL"