#!/bin/bash # run_rhai_tests.sh # Script to run all Rhai tests in the rhai_tests directory # Set colors for output GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[0;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Print header echo -e "${BLUE}=======================================${NC}" echo -e "${BLUE} Running All Rhai Tests ${NC}" echo -e "${BLUE}=======================================${NC}" # Find all test runner scripts RUNNERS=$(find src/rhai_tests -name "run_all_tests.rhai") # Initialize counters TOTAL_MODULES=0 PASSED_MODULES=0 FAILED_MODULES=0 # Run each test runner for runner in $RUNNERS; do # Extract module name from path module=$(echo $runner | cut -d'/' -f3) echo -e "\n${YELLOW}Running tests for module: ${module}${NC}" echo -e "${YELLOW}-------------------------------------${NC}" # Run the test runner herodo --path $runner # Check if the test passed if [ $? -eq 0 ]; then echo -e "${GREEN}✓ Module ${module} tests passed${NC}" PASSED_MODULES=$((PASSED_MODULES + 1)) else echo -e "${RED}✗ Module ${module} tests failed${NC}" FAILED_MODULES=$((FAILED_MODULES + 1)) fi TOTAL_MODULES=$((TOTAL_MODULES + 1)) done # Print summary echo -e "\n${BLUE}=======================================${NC}" echo -e "${BLUE} Test Summary ${NC}" echo -e "${BLUE}=======================================${NC}" echo -e "Total modules tested: ${TOTAL_MODULES}" echo -e "Passed: ${GREEN}${PASSED_MODULES}${NC}" echo -e "Failed: ${RED}${FAILED_MODULES}${NC}" # Set exit code based on test results if [ $FAILED_MODULES -eq 0 ]; then echo -e "\n${GREEN}All tests passed!${NC}" exit 0 else echo -e "\n${RED}Some tests failed!${NC}" exit 1 fi