feat: Enhance agent test suite with improved pre-flight checks and error handling
This commit is contained in:
@@ -21,20 +21,41 @@ echo ""
|
|||||||
# Clear results file
|
# Clear results file
|
||||||
> "$RESULTS_FILE"
|
> "$RESULTS_FILE"
|
||||||
|
|
||||||
# Check if z3ed exists
|
# --- Pre-flight Checks ---
|
||||||
if [ ! -f "$Z3ED" ]; then
|
print_header "Performing Pre-flight Checks"
|
||||||
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}"
|
|
||||||
|
|
||||||
# Check if ROM exists
|
if [ -z "$1" ]; then
|
||||||
if [ ! -f "$ROM" ]; then
|
echo "❌ Error: No AI provider specified."
|
||||||
echo -e "${RED}✗ ROM not found at $ROM${NC}"
|
echo "Usage: $0 <ollama|gemini|mock>"
|
||||||
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "${GREEN}✓ ROM found${NC}"
|
|
||||||
|
|
||||||
# Test Ollama availability
|
# Test Ollama availability
|
||||||
OLLAMA_AVAILABLE=false
|
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}"
|
echo -e "${GREEN}✓ Ollama available (qwen2.5-coder)${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}⚠ Ollama available but qwen2.5-coder not found${NC}"
|
echo -e "${YELLOW}⚠ Ollama available but qwen2.5-coder not found${NC}"
|
||||||
echo " Install with: ollama pull qwen2.5-coder:7b"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}⚠ Ollama not available${NC}"
|
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}"
|
echo -e "${GREEN}✓ Gemini API key configured${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}⚠ Gemini API key not set${NC}"
|
echo -e "${YELLOW}⚠ Gemini API key not set${NC}"
|
||||||
echo " Set with: export GEMINI_API_KEY='your-key'"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$OLLAMA_AVAILABLE" = false ] && [ "$GEMINI_AVAILABLE" = false ]; then
|
if [ "$PROVIDER" == "ollama" ] && [ "$OLLAMA_AVAILABLE" = false ]; then
|
||||||
echo -e "${RED}✗ No AI providers available${NC}"
|
echo -e "${RED}✗ Exiting: Ollama provider requested but not available.${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Test function
|
||||||
run_test() {
|
run_test() {
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user