You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

94 lines
2.8 KiB

#!/bin/zsh
# Test Stability Runner for TimeSafari (Zsh Version)
# Executes the full test suite 10 times and analyzes failure patterns
# Author: Matthew Raymer
# Source common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/test-stability-common.sh"
# Zsh-specific overrides and enhancements
# Override associative array declarations for zsh compatibility
typeset -A test_results
typeset -A test_failures
typeset -A test_successes
typeset -A run_times
typeset -A test_names
# Enhanced progress tracking for zsh
track_test_progress_enhanced() {
local run_number="$1"
local test_file="$2"
log_info "Run $run_number/$TOTAL_RUNS: Executing $test_file"
# Enhanced progress bar with zsh-specific features
local percentage=$((run_number * 100 / TOTAL_RUNS))
local filled=$((run_number * 50 / TOTAL_RUNS))
local empty=$((50 - filled))
# Create enhanced progress bar
local progress_bar=""
for ((i=0; i<filled; i++)); do
progress_bar+="$PROGRESS_CHAR"
done
for ((i=0; i<empty; i++)); do
progress_bar+="$EMPTY_CHAR"
done
# Print enhanced progress with zsh formatting
printf "\r${CYAN}[ZSH]${NC} %s [%d%%] (%d/%d) ${MAGENTA}%s${NC}" \
"$progress_bar" "$percentage" "$run_number" "$TOTAL_RUNS" "$test_file"
}
# Enhanced error handling for zsh
handle_zsh_error() {
local error_code=$?
local error_line=$1
if [ $error_code -ne 0 ]; then
log_error "Zsh error occurred at line $error_line (exit code: $error_code)"
# Additional zsh-specific error handling can be added here
fi
}
# Set up zsh error handling
trap 'handle_zsh_error $LINENO' ERR
# Main execution function with zsh enhancements
main() {
log_info "Starting enhanced test stability analysis with $TOTAL_RUNS runs (Zsh Version)"
log_info "Results will be saved to: $RESULTS_DIR"
echo
# Run all test executions with enhanced tracking
for run_number in $(seq 1 $TOTAL_RUNS); do
track_test_progress_enhanced "$run_number" "test suite"
if run_single_test "$run_number"; then
log_success "Run $run_number completed successfully"
else
log_warning "Run $run_number failed, continuing with remaining runs"
fi
# Enhanced delay with zsh-specific features
if [ "$run_number" -lt $TOTAL_RUNS ]; then
# Use zsh's built-in sleep with progress indication
for i in {1..2}; do
printf "\r${YELLOW}Waiting...${NC} %d/2" "$i"
sleep 1
done
printf "\r%*s\r" "$(tput cols)" ""
fi
done
# Generate and display results
generate_summary_report
display_final_results
log_success "Enhanced test stability analysis complete! (Zsh Version)"
}
# Run main function
main "$@"