#!/bin/bash ################################################################################ # run-all-tests.sh # Comprehensive test runner for all ROM groomer test suites # # This script runs all available test suites and provides a comprehensive # overview of the system's health and compliance with standards. # # Usage: ./run-all-tests.sh ################################################################################ # Get the directory of the current script SCRIPT_DIR="$(dirname "$(realpath "$0")")" # Determine the project root directory PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Change to script directory cd "$SCRIPT_DIR" echo "========================================================================" echo " ROM GROOMER COMPREHENSIVE TEST SUITE" echo "========================================================================" echo echo "Running all test suites to validate system health and compliance..." echo # Initialize counters TOTAL_TESTS=0 TOTAL_PASSED=0 TOTAL_FAILED=0 SUITE_RESULTS=() # Function to run a test suite and capture results run_test_suite() { local suite_name="$1" local script_name="$2" echo "=========================================" echo "Running: $suite_name" echo "=========================================" if [[ -f "$script_name" && -x "$script_name" ]]; then # Run the test and capture output local output output=$(./"$script_name" 2>&1) local exit_code=$? echo "$output" # Extract test counts from output local passed failed total functions if echo "$output" | grep -q "All tests passed!"; then # New format: "All tests passed! Assertions: 16, Test Functions: 11" if echo "$output" | grep -q "Assertions:"; then passed=$(echo "$output" | grep "All tests passed!" | sed -n 's/.*Assertions: \([0-9]*\).*/\1/p') functions=$(echo "$output" | grep "All tests passed!" | sed -n 's/.*Test Functions: \([0-9]*\).*/\1/p') failed=0 total=$passed else # Fallback to old format passed=$(echo "$output" | grep "All tests passed!" | sed -n 's/.*(\([0-9]*\)\/[0-9]*).*/\1/p') failed=0 total=$passed functions=$passed fi elif echo "$output" | grep -q "Some tests failed."; then # New format: "Some tests failed. Assertions Passed: 5, Failed: 2, Test Functions: 3" if echo "$output" | grep -q "Assertions Passed:"; then passed=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Assertions Passed: \([0-9]*\).*/\1/p') failed=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Failed: \([0-9]*\).*/\1/p') functions=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Test Functions: \([0-9]*\).*/\1/p') total=$((passed + failed)) else # Fallback to old format passed=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Passed: \([0-9]*\).*/\1/p') failed=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Failed: \([0-9]*\).*/\1/p') total=$(echo "$output" | grep "Some tests failed." | sed -n 's/.*Total: \([0-9]*\).*/\1/p') functions=$total fi else # Fallback parsing passed=0 failed=1 total=1 functions=1 fi # Update totals TOTAL_TESTS=$((TOTAL_TESTS + total)) TOTAL_PASSED=$((TOTAL_PASSED + passed)) TOTAL_FAILED=$((TOTAL_FAILED + failed)) # Record suite result if [[ $exit_code -eq 0 ]]; then SUITE_RESULTS+=("✓ $suite_name: $passed assertions across $functions test functions") else SUITE_RESULTS+=("✗ $suite_name: $passed/$total assertions across $functions test functions ($failed failed)") fi echo else echo "⚠ Test suite not found or not executable: $script_name" SUITE_RESULTS+=("⚠ $suite_name: Not available") echo fi } # Run all test suites run_test_suite "Build Script Naming Standards" "test-build-script-naming.sh" run_test_suite "Build Script Content Validation" "test-build-script-content.sh" run_test_suite "Specific Fixes Validation" "test-specific-fixes.sh" run_test_suite "Setup Wizard" "test-setup-wizard.sh" run_test_suite "Enhanced Utilities" "test-utils.sh" run_test_suite "Pre-flight Checks" "test-preflight-checks.sh" run_test_suite "Integration Workflow" "test-integration.sh" # Print comprehensive summary echo "========================================================================" echo " COMPREHENSIVE SUMMARY" echo "========================================================================" echo echo "Test Suite Results:" for result in "${SUITE_RESULTS[@]}"; do echo " $result" done echo echo "Overall Statistics:" echo " Total Tests Run: $TOTAL_TESTS" echo " Total Passed: $TOTAL_PASSED" echo " Total Failed: $TOTAL_FAILED" echo if [[ $TOTAL_FAILED -eq 0 ]]; then echo "🎉 ALL TESTS PASSED! The ROM groomer system is fully compliant." echo echo "System Health: ✅ EXCELLENT" echo "Standards Compliance: ✅ FULL" echo "Build Script Quality: ✅ VALIDATED" echo exit 0 else echo "❌ Some tests failed. Please review the failures above." echo echo "System Health: ⚠ NEEDS ATTENTION" echo "Failed Tests: $TOTAL_FAILED" echo exit 1 fi