- Added a comprehensive guide on running Rhai tests within the SAL library. This includes instructions for running all tests, tests for specific modules, and individual tests. - Created a shell script (`run_rhai_tests.sh`) to simplify running all Rhai tests and provide a summary of results. This improves the testing workflow and makes it easier to identify failures.
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/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
|