#!/usr/bin/env bash # Runs the automation tests headless. Usage: Scripts/run-tests.sh [Filter] # Scripts/run-tests.sh -> Salty.* (everything) # Scripts/run-tests.sh Core -> Salty.Core.* # UE_ROOT points at the engine install (default D:/UE_5.8). Exit code is non-zero when any test fails. set -u UE_ROOT="${UE_ROOT:-D:/UE_5.8}" ROOT="$(cd "$(dirname "$0")/.." && pwd)" PROJECT="$ROOT/Salty.uproject" FILTER="Salty${1:+.$1}" REPORT="$ROOT/Saved/Automation/Reports" LOG="$ROOT/Saved/Logs/RunTests.log" mkdir -p "$REPORT" "$(dirname "$LOG")" "$UE_ROOT/Engine/Binaries/Win64/UnrealEditor-Cmd.exe" "$(cygpath -w "$PROJECT" 2>/dev/null || echo "$PROJECT")" \ -ExecCmds="Automation RunTests $FILTER; Quit" \ -ReportExportPath="$(cygpath -w "$REPORT" 2>/dev/null || echo "$REPORT")" \ -unattended -nopause -NullRHI -nosplash -log -abslog="$(cygpath -w "$LOG" 2>/dev/null || echo "$LOG")" >/dev/null 2>&1 ENGINE_EXIT=$? # The engine's exit code is not a reliable verdict; the "Test Completed" lines are. Startup prints two # "LogAutomationTest: Error: Condition failed" lines before any test runs; they are the engine's, not ours. grep -E "Test Completed\. Result=" "$LOG" | sed -E 's/^.*Test Completed\. //' PASSED=$(grep -c "Test Completed. Result={Success}" "$LOG") FAILED=$(grep -c "Test Completed. Result={Fail" "$LOG") echo "passed=$PASSED failed=$FAILED filter=$FILTER" if [ "$FAILED" -gt 0 ]; then echo "RESULT: FAILED"; exit 1; fi if [ "$PASSED" -eq 0 ]; then echo "RESULT: NO TESTS RAN (engine exit $ENGINE_EXIT). See $LOG"; exit 2; fi echo "RESULT: PASSED"