From 31154daa71dc44b71b4b573d09bc9cda73cb389e Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 4 Oct 2025 14:30:58 -0400 Subject: [PATCH] feat: Enhance agent test suite with improved pre-flight checks and error handling --- scripts/agent_test_suite.sh | 56 ++++++++++++++++------- scripts/setup-vcpkg-windows.bat | 81 --------------------------------- 2 files changed, 40 insertions(+), 97 deletions(-) delete mode 100644 scripts/setup-vcpkg-windows.bat diff --git a/scripts/agent_test_suite.sh b/scripts/agent_test_suite.sh index b6ec7126..1963b8f4 100755 --- a/scripts/agent_test_suite.sh +++ b/scripts/agent_test_suite.sh @@ -21,20 +21,41 @@ echo "" # Clear results file > "$RESULTS_FILE" -# Check if z3ed exists -if [ ! -f "$Z3ED" ]; then - echo -e "${RED}✗ z3ed not found at $Z3ED${NC}" - echo " Try building with: cmake --build build_rooms" - exit 1 -fi -echo -e "${GREEN}✓ z3ed found${NC}" +# --- Pre-flight Checks --- +print_header "Performing Pre-flight Checks" -# Check if ROM exists -if [ ! -f "$ROM" ]; then - echo -e "${RED}✗ ROM not found at $ROM${NC}" +if [ -z "$1" ]; then + echo "❌ Error: No AI provider specified." + echo "Usage: $0 " + exit 1 +fi +PROVIDER=$1 +echo "✅ Provider: $PROVIDER" + +# Check binaries and files +for f in "$Z3ED_BIN" "$ROM_PATH" "$TEST_DIR/../prompt_catalogue.yaml" "$TEST_DIR/function_schemas.json"; do + if [ ! -f "$f" ]; then + echo -e "${RED}✗ Prerequisite file not found: $f${NC}" + exit 1 + fi +done +echo "✅ Core binaries and files found." + +# Verify schemas +if python3 -m json.tool "$TEST_DIR/function_schemas.json" > /dev/null 2>&1; then + echo "✅ Function schemas JSON is valid." +else + echo "${RED}✗ Invalid JSON in function_schemas.json${NC}" + exit 1 +fi + +# Verify manual tool execution +if "$Z3ED_BIN" agent overworld-find-tile --tile 0x02E --format json --rom "$ROM_PATH" > /dev/null 2>&1; then + echo "✅ Manual tool execution successful." +else + echo "${RED}✗ Manual tool execution failed.${NC}" exit 1 fi -echo -e "${GREEN}✓ ROM found${NC}" # Test Ollama availability OLLAMA_AVAILABLE=false @@ -44,7 +65,6 @@ if command -v ollama &> /dev/null && curl -s http://localhost:11434/api/tags > / echo -e "${GREEN}✓ Ollama available (qwen2.5-coder)${NC}" else echo -e "${YELLOW}⚠ Ollama available but qwen2.5-coder not found${NC}" - echo " Install with: ollama pull qwen2.5-coder:7b" fi else echo -e "${YELLOW}⚠ Ollama not available${NC}" @@ -57,15 +77,19 @@ if [ -n "$GEMINI_API_KEY" ]; then echo -e "${GREEN}✓ Gemini API key configured${NC}" else echo -e "${YELLOW}⚠ Gemini API key not set${NC}" - echo " Set with: export GEMINI_API_KEY='your-key'" fi -if [ "$OLLAMA_AVAILABLE" = false ] && [ "$GEMINI_AVAILABLE" = false ]; then - echo -e "${RED}✗ No AI providers available${NC}" +if [ "$PROVIDER" == "ollama" ] && [ "$OLLAMA_AVAILABLE" = false ]; then + echo -e "${RED}✗ Exiting: Ollama provider requested but not available.${NC}" exit 1 fi -echo "" +if [ "$PROVIDER" == "gemini" ] && [ "$GEMINI_AVAILABLE" = false ]; then + echo -e "${RED}✗ Exiting: Gemini provider requested but GEMINI_API_KEY is not set.${NC}" + exit 1 +fi + +# --- Run Test Suite --- # Test function run_test() { diff --git a/scripts/setup-vcpkg-windows.bat b/scripts/setup-vcpkg-windows.bat deleted file mode 100644 index 0874c7dc..00000000 --- a/scripts/setup-vcpkg-windows.bat +++ /dev/null @@ -1,81 +0,0 @@ -@echo off -REM YAZE vcpkg Setup Script (Batch Version) -REM This script sets up vcpkg for YAZE development on Windows - -setlocal enabledelayedexpansion - -echo ======================================== -echo YAZE vcpkg Setup Script -echo ======================================== - -REM Check if we're in the right directory -if not exist "vcpkg.json" ( - echo ERROR: vcpkg.json not found. Please run this script from the project root directory. - pause - exit /b 1 -) - -echo ✓ vcpkg.json found - -REM Check for Git -where git >nul 2>&1 -if %errorlevel% neq 0 ( - echo ERROR: Git not found. Please install Git for Windows. - echo Download from: https://git-scm.com/download/win - pause - exit /b 1 -) - -echo ✓ Git found - -REM Clone vcpkg if needed -if not exist "vcpkg" ( - echo Cloning vcpkg... - git clone https://github.com/Microsoft/vcpkg.git vcpkg - if %errorlevel% neq 0 ( - echo ERROR: Failed to clone vcpkg - pause - exit /b 1 - ) - echo ✓ vcpkg cloned successfully -) else ( - echo ✓ vcpkg directory already exists -) - -REM Bootstrap vcpkg -if not exist "vcpkg\vcpkg.exe" ( - echo Bootstrapping vcpkg... - cd vcpkg - call bootstrap-vcpkg.bat - if %errorlevel% neq 0 ( - echo ERROR: Failed to bootstrap vcpkg - cd .. - pause - exit /b 1 - ) - cd .. - echo ✓ vcpkg bootstrapped successfully -) else ( - echo ✓ vcpkg already bootstrapped -) - -REM Install dependencies -echo Installing dependencies... -vcpkg\vcpkg.exe install --triplet x64-windows -if %errorlevel% neq 0 ( - echo WARNING: Some dependencies may not have installed correctly -) else ( - echo ✓ Dependencies installed successfully -) - -echo ======================================== -echo ✓ vcpkg setup complete! -echo ======================================== -echo. -echo You can now build YAZE using: -echo .\scripts\build-windows.ps1 -echo or -echo .\scripts\build-windows.bat -echo. - -pause \ No newline at end of file