#!/bin/bash # Comprehensive Test Runner for AI Dictation Service # Runs all test suites with proper error handling and reporting echo "๐Ÿงช AI Dictation Service - Complete Test Runner" echo "==================================================" echo "This will run all test suites:" echo " - Original Dictation Tests" echo " - AI Conversation Tests" echo " - VLLM Integration Tests" echo "==================================================" # Function to run test and capture results run_test() { local test_name=$1 local test_file=$2 local description=$3 echo "" echo "๐Ÿ“‹ Running: $description" echo " File: $test_file" echo "----------------------------------------" if [ -f "$test_file" ]; then if python "$test_file"; then echo "โœ… $test_name: PASSED" return 0 else echo "โŒ $test_name: FAILED" return 1 fi else echo "โš ๏ธ $test_name: SKIPPED (file not found: $test_file)" return 2 fi } # Test counter total_tests=0 passed_tests=0 failed_tests=0 skipped_tests=0 # Run Original Dictation Tests echo "" echo "๐ŸŽค Testing Original Dictation Functionality..." total_tests=$((total_tests + 1)) if run_test "DICTATION" "test_original_dictation.py" "Original voice-to-text dictation"; then passed_tests=$((passed_tests + 1)) elif [ $? -eq 1 ]; then failed_tests=$((failed_tests + 1)) else skipped_tests=$((skipped_tests + 1)) fi # Run AI Conversation Tests echo "" echo "๐Ÿค– Testing AI Conversation Features..." total_tests=$((total_tests + 1)) if run_test "AI_CONVERSATION" "test_suite.py" "AI conversation and VLLM integration"; then passed_tests=$((passed_tests + 1)) elif [ $? -eq 1 ]; then failed_tests=$((failed_tests + 1)) else skipped_tests=$((skipped_tests + 1)) fi # Run VLLM Integration Tests echo "" echo "๐Ÿ”— Testing VLLM Integration..." total_tests=$((total_tests + 1)) if run_test "VLLM" "test_vllm_integration.py" "VLLM endpoint connectivity and performance"; then passed_tests=$((passed_tests + 1)) elif [ $? -eq 1 ]; then failed_tests=$((failed_tests + 1)) else skipped_tests=$((skipped_tests + 1)) fi # System Status Checks echo "" echo "๐Ÿ” Running System Status Checks..." echo "----------------------------------------" # Check if VLLM is running echo "๐Ÿค– Checking VLLM Service..." if curl -s --connect-timeout 3 http://127.0.0.1:8000/health > /dev/null 2>&1; then echo "โœ… VLLM service is running" else echo "โš ๏ธ VLLM service may not be running (this is expected if not started)" fi # Check audio system echo "๐ŸŽค Checking Audio System..." if command -v arecord > /dev/null 2>&1; then echo "โœ… Audio recording available (arecord)" else echo "โš ๏ธ Audio recording not available" fi if command -v aplay > /dev/null 2>&1; then echo "โœ… Audio playback available (aplay)" else echo "โš ๏ธ Audio playback not available" fi # Check notification system echo "๐Ÿ“ข Checking Notification System..." if command -v notify-send > /dev/null 2>&1; then echo "โœ… System notifications available (notify-send)" else echo "โš ๏ธ System notifications not available" fi # Check dictation service status echo "๐Ÿ”ง Checking Dictation Service..." if systemctl --user is-active --quiet dictation.service 2>/dev/null; then echo "โœ… Dictation service is running" elif systemctl --user is-enabled --quiet dictation.service 2>/dev/null; then echo "โš ๏ธ Dictation service is enabled but not running" else echo "โš ๏ธ Dictation service not configured" fi # Test Results Summary echo "" echo "๐Ÿ“Š TEST RESULTS SUMMARY" echo "========================" echo "Total Test Suites: $total_tests" echo "Passed: $passed_tests โœ…" echo "Failed: $failed_tests โŒ" echo "Skipped: $skipped_tests โญ๏ธ" # Overall status if [ $failed_tests -eq 0 ]; then if [ $passed_tests -gt 0 ]; then echo "" echo "๐ŸŽ‰ OVERALL STATUS: SUCCESS โœ…" echo "All available tests passed!" else echo "" echo "โš ๏ธ OVERALL STATUS: NO TESTS RUN" echo "Test files may not be available or dependencies missing" fi else echo "" echo "โŒ OVERALL STATUS: TEST FAILURES DETECTED" echo "Some tests failed. Please review the output above." fi # Recommendations echo "" echo "๐Ÿ’ก RECOMMENDATIONS" echo "==================" echo "1. Ensure all dependencies are installed: uv sync" echo "2. Start VLLM service for full functionality" echo "3. Enable dictation service: systemctl --user enable dictation.service" echo "4. Test with actual microphone input for real-world validation" # Quick test commands echo "" echo "โšก QUICK TEST COMMANDS" echo "=====================" echo "# Test individual components:" echo "python test_original_dictation.py" echo "python test_suite.py" echo "python test_vllm_integration.py" echo "" echo "# Test service status:" echo "systemctl --user status dictation.service" echo "journalctl --user -u dictation.service -f" echo "" echo "# Test VLLM endpoint:" echo "curl -H 'Authorization: Bearer vllm-api-key' http://127.0.0.1:8000/v1/models" echo "" echo "๐Ÿ Test runner complete!" echo "======================="