make test-all.sh flexible to manually execute.

This commit is contained in:
Shuduo Sang 2020-06-10 10:17:44 +08:00
parent d20c24f9b3
commit b0810ef391
1 changed files with 51 additions and 42 deletions

View File

@ -24,65 +24,74 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m' GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
echo "### run TSIM test case ###" totalFailed=0
cd script totalPyFailed=0
[ -f out.log ] && rm -f out.log
if [ "$1" == "cron" ]; then current_dir=`pwd`
echo "### run TSIM regression test ###"
runSimCaseOneByOne regressionSuite.sim
elif [ "$1" == "full" ]; then
echo "### run TSIM full test ###"
runSimCaseOneByOne fullGeneralSuite.sim
else
echo "### run TSIM smoke test ###"
runSimCaseOneByOne basicSuite.sim
fi
totalSuccess=`grep 'success' out.log | wc -l` if [ "$2" != "python" ]; then
totalBasic=`grep success out.log | grep Suite | wc -l` echo "### run TSIM test case ###"
cd $current_dir/script
if [ "$totalSuccess" -gt "0" ]; then [ -f out.log ] && rm -f out.log
totalSuccess=`expr $totalSuccess - $totalBasic` if [ "$1" == "cron" ]; then
fi echo "### run TSIM regression test ###"
runSimCaseOneByOne regressionSuite.sim
elif [ "$1" == "full" ]; then
echo "### run TSIM full test ###"
runSimCaseOneByOne fullGeneralSuite.sim
else
echo "### run TSIM smoke test ###"
runSimCaseOneByOne basicSuite.sim
fi
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}" totalSuccess=`grep 'success' out.log | wc -l`
totalBasic=`grep success out.log | grep Suite | wc -l`
totalFailed=`grep 'failed\|fault' out.log | wc -l` if [ "$totalSuccess" -gt "0" ]; then
totalSuccess=`expr $totalSuccess - $totalBasic`
fi
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"
totalFailed=`grep 'failed\|fault' out.log | wc -l`
# echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" # echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
if [ "$totalFailed" -ne "0" ]; then if [ "$totalFailed" -ne "0" ]; then
echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
# exit $totalFailed # exit $totalFailed
fi
fi fi
echo "### run Python test case ###" if [ "$2" != "sim" ]; then
cd ../pytest echo "### run Python test case ###"
cd $current_dir/pytest
[ -f pytest-out.log ] && rm -f pytest-out.log [ -f pytest-out.log ] && rm -f pytest-out.log
if [ "$1" == "cron" ]; then if [ "$1" == "cron" ]; then
echo "### run Python regression test ###" echo "### run Python regression test ###"
runPyCaseOneByOne regressiontest.sh runPyCaseOneByOne regressiontest.sh
elif [ "$1" == "full" ]; then elif [ "$1" == "full" ]; then
echo "### run Python full test ###" echo "### run Python full test ###"
runPyCaseOneByOne fulltest.sh runPyCaseOneByOne fulltest.sh
else else
echo "### run Python smoke test ###" echo "### run Python smoke test ###"
runPyCaseOneByOne smoketest.sh runPyCaseOneByOne smoketest.sh
fi fi
totalPySuccess=`grep 'successfully executed' pytest-out.log | wc -l` totalPySuccess=`grep 'successfully executed' pytest-out.log | wc -l`
if [ "$totalPySuccess" -gt "0" ]; then if [ "$totalPySuccess" -gt "0" ]; then
echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}" echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
fi fi
totalPyFailed=`grep 'failed\|fault' pytest-out.log | wc -l` totalPyFailed=`grep 'failed\|fault' pytest-out.log | wc -l`
if [ "$totalPyFailed" -ne "0" ]; then if [ "$totalPyFailed" -ne "0" ]; then
echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}" echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
# exit $totalPyFailed # exit $totalPyFailed
fi
fi fi
exit $(($totalFailed + $totalPyFailed)) exit $(($totalFailed + $totalPyFailed))