mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-07 02:26:28 +02:00
49 lines
1.1 KiB
Bash
Executable file
49 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
BOLD='\033[1m'
|
|
NC='\033[0m' # No Color
|
|
|
|
wai=$(dirname $(readlink -f "$0")) # Current script directory
|
|
tests=$(ls -d ./*/) # Find tests
|
|
out=$(mktemp)
|
|
test_timeout=20
|
|
abort=1
|
|
|
|
for test in ${tests}
|
|
do
|
|
printf "%-50s%s %s" "- $(basename $test)" "=>"
|
|
cd $test
|
|
timeout $test_timeout ./simulator.py &> "$out"
|
|
|
|
# Ensure timeout
|
|
if [ $? -eq 124 ]
|
|
then
|
|
echo -e "${RED}${BOLD}failed${NC}"
|
|
echo "------------- Test timeout (should not exceed ${test_timeout}s) -------------"
|
|
cat "$out";
|
|
rm "$out"
|
|
exit 2
|
|
fi
|
|
|
|
# Ensure test output
|
|
if [ "$(base64 $out)" == "$(base64 ./out)" ]
|
|
then
|
|
echo -e "${GREEN}${BOLD}passed${NC}"
|
|
else
|
|
echo -e "${RED}${BOLD}failed${NC}"
|
|
echo "------------- Expected -------------"
|
|
cat out
|
|
echo "------------- Got -------------"
|
|
cat "$out";
|
|
rm "$out"
|
|
[ $abort -eq 1 ] && exit 1
|
|
fi
|
|
|
|
# Prepare for next test
|
|
cd - &>/dev/null
|
|
done
|
|
|
|
rm "$out"
|