- Migrate individual modules to independent crates - Refactor dependencies for improved modularity - Update build system and testing infrastructure - Update documentation to reflect new structure
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| # run_rhai_tests.sh
 | |
| # Script to run all Rhai tests in both rhai_tests directory and package-specific test directories
 | |
| 
 | |
| # 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
 | |
| 
 | |
| # Create log file
 | |
| LOG_FILE="run_rhai_tests.log"
 | |
| > $LOG_FILE  # Clear log file if it exists
 | |
| 
 | |
| # Function to log messages to both console and log file
 | |
| log() {
 | |
|     echo -e "$1" | tee -a $LOG_FILE
 | |
| }
 | |
| 
 | |
| # Print header
 | |
| log "${BLUE}=======================================${NC}"
 | |
| log "${BLUE}      Running All Rhai Tests          ${NC}"
 | |
| log "${BLUE}=======================================${NC}"
 | |
| 
 | |
| # Find all test runner scripts in both old and new locations
 | |
| RUNNERS=$(find rhai_tests -name "run_all_tests.rhai" 2>/dev/null; find */tests/rhai -name "run_all_tests.rhai" 2>/dev/null)
 | |
| 
 | |
| # 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 (handle both old and new path structures)
 | |
|     if [[ $runner == rhai_tests/* ]]; then
 | |
|         # Old structure: rhai_tests/module/run_all_tests.rhai
 | |
|         module=$(echo $runner | cut -d'/' -f2)
 | |
|     else
 | |
|         # New structure: package/tests/rhai/run_all_tests.rhai
 | |
|         module=$(echo $runner | cut -d'/' -f1)
 | |
|     fi
 | |
| 
 | |
|     log "\n${YELLOW}Running tests for module: ${module}${NC}"
 | |
|     log "${YELLOW}-------------------------------------${NC}"
 | |
| 
 | |
|     # Run the test runner
 | |
|     herodo $runner | tee -a $LOG_FILE
 | |
|     TEST_RESULT=${PIPESTATUS[0]}
 | |
| 
 | |
|     # Check if the test passed
 | |
|     if [ $TEST_RESULT -eq 0 ]; then
 | |
|         log "${GREEN}✓ Module ${module} tests passed${NC}"
 | |
|         PASSED_MODULES=$((PASSED_MODULES + 1))
 | |
|     else
 | |
|         log "${RED}✗ Module ${module} tests failed${NC}"
 | |
|         FAILED_MODULES=$((FAILED_MODULES + 1))
 | |
|     fi
 | |
| 
 | |
|     TOTAL_MODULES=$((TOTAL_MODULES + 1))
 | |
| done
 | |
| 
 | |
| # Print summary
 | |
| log "\n${BLUE}=======================================${NC}"
 | |
| log "${BLUE}            Test Summary              ${NC}"
 | |
| log "${BLUE}=======================================${NC}"
 | |
| log "Total modules tested: ${TOTAL_MODULES}"
 | |
| log "Passed: ${GREEN}${PASSED_MODULES}${NC}"
 | |
| log "Failed: ${RED}${FAILED_MODULES}${NC}"
 | |
| 
 | |
| # Set exit code based on test results
 | |
| if [ $FAILED_MODULES -eq 0 ]; then
 | |
|     log "\n${GREEN}All tests passed!${NC}"
 | |
|     exit 0
 | |
| else
 | |
|     log "\n${RED}Some tests failed!${NC}"
 | |
|     exit 1
 | |
| fi
 |