Improve run.sh

This commit is contained in:
Loic Guegan 2022-09-01 08:12:18 +02:00
parent d9fb7fc2e3
commit 5590a909d9

View file

@ -1,11 +1,5 @@
#!/usr/bin/env bash #!/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 wai=$(dirname $(readlink -f "$0")) # Current script directory
tests=$(ls -d ${wai}/*/) # Find tests tests=$(ls -d ${wai}/*/) # Find tests
out=$(mktemp) out=$(mktemp)
@ -21,7 +15,7 @@ do
# Ensure timeout # Ensure timeout
if [ $? -eq 124 ] if [ $? -eq 124 ]
then then
printf "${RED}${BOLD}failed${NC}\n" echo "failed :("
echo "------------- Test timeout (should not exceed ${test_timeout}s) -------------" echo "------------- Test timeout (should not exceed ${test_timeout}s) -------------"
cat "$out"; cat "$out";
rm "$out" rm "$out"
@ -31,9 +25,9 @@ do
# Ensure test output # Ensure test output
if [ "$(base64 $out)" = "$(base64 ./out)" ] if [ "$(base64 $out)" = "$(base64 ./out)" ]
then then
printf "${GREEN}${BOLD}passed${NC}\n" echo "passed"
else else
printf "${RED}${BOLD}failed${NC}\n" echo "failed :("
echo "------------- Expected -------------" echo "------------- Expected -------------"
cat out cat out
echo "------------- Got -------------" echo "------------- Got -------------"