31 lines
873 B
Bash
Executable File
31 lines
873 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define the directory and log file
|
|
bu='\033[4;34m'
|
|
rb='\033[1;31m'
|
|
gb='\033[1;32m'
|
|
reset='\033[0m'
|
|
INVALID_DIR="maps/invalid"
|
|
LOG_FILE="test.log"
|
|
|
|
# Overwrite the log file
|
|
> "$LOG_FILE"
|
|
|
|
# Iterate through all files in the invalid directory
|
|
for file in "$INVALID_DIR"/*; do
|
|
test_name=$(basename "$file" | sed -e 's/\..*$//')
|
|
# echo -e "${bu}Testing $test_name...${reset}"
|
|
# Run the file with ./cub3D and send SIGINT after 1 second
|
|
timeout 1 ./cub3D "$file" > /dev/null 2>&1
|
|
if [ $? -eq 1 ]; then
|
|
# Print OK! [filename] if exit status is 1
|
|
echo -e "${gb}OK!${reset} $test_name"
|
|
echo "OK! $file" >> "$LOG_FILE"
|
|
else
|
|
# Print KO! [filename] and append the file name to the log file if exit status is not 1
|
|
echo -e "${rb}KO!${reset} $test_name"
|
|
echo "KO! $file" >> "$LOG_FILE"
|
|
fi
|
|
# echo "----------------------------------------"
|
|
# echo ""
|
|
done |