multini/test/run_test.sh

31 lines
756 B
Bash
Raw Normal View History

2020-04-25 23:42:14 +00:00
#!/bin/bash
DEF='\e[0m'; BLD='\e[1m'; RED='\e[31m'; GRN='\e[32m'; WHT='\e[97m'
2020-11-03 08:20:24 +00:00
2020-04-25 23:42:14 +00:00
ScriptFullname=$(readlink -e "$0")
ScriptName=$(echo "$ScriptFullname" | awk -F '/' '{print $NF;}')
ScriptDir=$(dirname "$ScriptFullname")
2020-11-03 08:20:24 +00:00
TestDir="$ScriptDir/data"
2020-04-25 23:42:14 +00:00
Multini=$(readlink -e "$1")
if [[ -z "$Multini" ]]; then
Multini="$ScriptDir/multini"
fi
RetCode=0
pushd "$TestDir" > /dev/null
while read Test
do
echo -ne "${BLD}${WHT}[----]${DEF} $Test"
Errors=$("$TestDir/$Test" "$Multini")
if [[ $? -ne 0 ]]; then
echo -e "\r${BLD}${WHT}[${RED}FAIL${WHT}]${DEF} $Test"
RetCode=1
echo "$Errors"
else
echo -e "\r${BLD}${WHT}[${GRN} OK ${WHT}]${DEF} $Test"
fi
done < <(find "$TestDir" -type f -name 'test_*.sh' -printf "%f\n")
popd > /dev/null
exit "$RetCode"