test.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # Advanced test runner with multi-agent support
  3. # Usage: ./scripts/test.sh [agent] [model] [options]
  4. set -e
  5. # Colors
  6. GREEN='\033[0;32m'
  7. BLUE='\033[0;34m'
  8. YELLOW='\033[1;33m'
  9. RED='\033[0;31m'
  10. NC='\033[0m' # No Color
  11. # Defaults
  12. AGENT=${1:-all}
  13. MODEL=${2:-opencode/grok-code-fast}
  14. shift 2 2>/dev/null || true
  15. EXTRA_ARGS="$@"
  16. echo -e "${BLUE}🧪 OpenCode Agents Test Runner${NC}"
  17. echo -e "${BLUE}================================${NC}"
  18. echo ""
  19. echo -e "Agent: ${GREEN}${AGENT}${NC}"
  20. echo -e "Model: ${GREEN}${MODEL}${NC}"
  21. if [ -n "$EXTRA_ARGS" ]; then
  22. echo -e "Extra: ${YELLOW}${EXTRA_ARGS}${NC}"
  23. fi
  24. echo ""
  25. # Navigate to framework directory
  26. cd "$(dirname "$0")/../evals/framework" || exit 1
  27. # Check if dependencies are installed
  28. if [ ! -d "node_modules" ]; then
  29. echo -e "${YELLOW}⚠️ Dependencies not installed. Running npm install...${NC}"
  30. npm install
  31. echo ""
  32. fi
  33. # Run tests
  34. if [ "$AGENT" = "all" ]; then
  35. echo -e "${YELLOW}Running tests for ALL agents...${NC}"
  36. npm run eval:sdk -- --model="$MODEL" $EXTRA_ARGS
  37. else
  38. echo -e "${YELLOW}Running tests for ${AGENT}...${NC}"
  39. npm run eval:sdk -- --agent="$AGENT" --model="$MODEL" $EXTRA_ARGS
  40. fi
  41. EXIT_CODE=$?
  42. echo ""
  43. if [ $EXIT_CODE -eq 0 ]; then
  44. echo -e "${GREEN}✅ Tests complete!${NC}"
  45. else
  46. echo -e "${RED}❌ Tests failed with exit code ${EXIT_CODE}${NC}"
  47. fi
  48. echo -e "${BLUE}View results: npm run dashboard${NC}"
  49. echo ""
  50. exit $EXIT_CODE