""" Run all diagnostics for HealthGuard-AI. This script runs all diagnostic tools in sequence. """ import subprocess import sys import os def run_command(command, description): """Run a command and print its output.""" print(f"\n{'='*50}") print(f"Running: {description}") print(f"Command: {command}") print('='*50) try: result = subprocess.run(command, shell=True, capture_output=True, text=True) print("STDOUT:") print(result.stdout) if result.stderr: print("STDERR:") print(result.stderr) print(f"Return code: {result.returncode}") return result.returncode == 0 except Exception as e: print(f"Error running command: {e}") return False def main(): """Main function to run all diagnostics.""" print("HealthGuard-AI Diagnostics Runner") print("="*50) # Check current directory print(f"Current directory: {os.getcwd()}") # List of diagnostic commands to run diagnostics = [ ("python verify_deployment.py", "Deployment verification"), ("python login_debug.py", "Login component testing"), ("python test_login_flow.py", "Login flow testing"), ("python exact_login_test.py", "Exact login logic testing"), ("python production_login_diagnostic.py", "Production environment diagnostics") ] # Run each diagnostic results = [] for command, description in diagnostics: # Check if file exists before running script_name = command.split()[1] if os.path.exists(script_name): success = run_command(command, description) results.append((description, success)) else: print(f"\nSkipping {description} - {script_name} not found") results.append((description, False)) # Summary print("\n" + "="*50) print("DIAGNOSTICS SUMMARY") print("="*50) passed = 0 failed = 0 for description, success in results: status = "PASSED" if success else "FAILED" print(f"{status}: {description}") if success: passed += 1 else: failed += 1 print(f"\nTotal: {passed} passed, {failed} failed") if failed == 0: print("✓ All diagnostics passed!") else: print("✗ Some diagnostics failed. Check the output above.") if __name__ == "__main__": main()