[TD-13894]<fix>: test-all script for 3.0 (#10623)
This commit is contained in:
parent
bf0e4b7828
commit
c3119245fb
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# set -x
|
||||
|
||||
# Color setting
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[1;32m'
|
||||
|
@ -12,19 +14,19 @@ tests_dir=`pwd`
|
|||
IN_TDINTERNAL="community"
|
||||
|
||||
function stopTaosd {
|
||||
echo "Stop taosd"
|
||||
echo "Stop taosd"
|
||||
sudo systemctl stop taosd || echo 'no sudo or systemctl or stop fail'
|
||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||
while [ -n "$PID" ]
|
||||
do
|
||||
while [ -n "$PID" ]
|
||||
do
|
||||
pkill -TERM -x taosd
|
||||
sleep 1
|
||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||
done
|
||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
||||
done
|
||||
}
|
||||
|
||||
function dohavecore(){
|
||||
corefile=`find $corepath -mmin 1`
|
||||
[ -d $corepath ] && corefile=`find $corepath -mmin 1` || return 1
|
||||
if [ -n "$corefile" ];then
|
||||
core_file=`echo $corefile|cut -d " " -f2`
|
||||
proc=`file $core_file|awk -F "execfn:" '/execfn:/{print $2}'|tr -d \' |awk '{print $1}'|tr -d \,`
|
||||
|
@ -56,20 +58,20 @@ function dohavecore(){
|
|||
function runSimCaseOneByOne {
|
||||
while read -r line; do
|
||||
if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then
|
||||
case=`echo $line | grep sim$ |awk '{print $NF}'`
|
||||
case=`echo $line | grep sim$ |awk '{print $NF}'`
|
||||
start_time=`date +%s`
|
||||
date +%F\ %T | tee -a out.log
|
||||
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
|
||||
echo -n $case
|
||||
./test.sh -f $case > /dev/null 2>&1 && \
|
||||
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
./test.sh -f $case > /dev/null 2>&1 \
|
||||
&& ([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log ) \
|
||||
|| ( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
echo -e "${RED} failed${NC}" | tee -a out.log
|
||||
else
|
||||
echo -n $case
|
||||
./test.sh -f $case > /dev/null 2>&1 && \
|
||||
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
( grep -q 'script.*success.*m$' ../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
([ -f ../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
([ -f ../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
echo -e "${RED} failed${NC}" | tee -a out.log
|
||||
fi
|
||||
out_log=`tail -1 out.log `
|
||||
|
@ -89,22 +91,22 @@ function runSimCaseOneByOnefq {
|
|||
for ((i=$start;i<=$end;i++)) ; do
|
||||
line=`sed -n "$i"p jenkins/basic.txt`
|
||||
if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then
|
||||
case=`echo $line | grep sim$ |awk '{print $NF}'`
|
||||
case=`echo $line | grep sim$ |awk '{print $NF}'`
|
||||
|
||||
start_time=`date +%s`
|
||||
date +%F\ %T | tee -a out.log
|
||||
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
|
||||
echo -n $case
|
||||
./test.sh -f $case > case.log 2>&1 && \
|
||||
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
./test.sh -f $case > case.log 2>&1 \
|
||||
&& \
|
||||
([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat case.log )
|
||||
else
|
||||
pwd
|
||||
echo -n $case
|
||||
./test.sh -f $case > ../../sim/case.log 2>&1 && \
|
||||
( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
( grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
|
||||
([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
|
||||
( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && pwd && cat ../../sim/case.log )
|
||||
fi
|
||||
|
||||
|
@ -134,7 +136,6 @@ function runPyCaseOneByOne {
|
|||
while read -r line; do
|
||||
if [[ $line =~ ^python.* ]]; then
|
||||
if [[ $line != *sleep* ]]; then
|
||||
|
||||
if [[ $line =~ '-r' ]];then
|
||||
case=`echo $line|awk '{print $4}'`
|
||||
else
|
||||
|
@ -172,7 +173,6 @@ function runPyCaseOneByOnefq() {
|
|||
line=`sed -n "$i"p fulltest.sh`
|
||||
if [[ $line =~ ^python.* ]]; then
|
||||
if [[ $line != *sleep* ]]; then
|
||||
|
||||
if [[ $line =~ '-r' ]];then
|
||||
case=`echo $line|awk '{print $4}'`
|
||||
else
|
||||
|
@ -239,7 +239,9 @@ totalExampleFailed=0
|
|||
if [ "${OS}" == "Linux" ]; then
|
||||
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
|
||||
if [ -z "$corepath" ];then
|
||||
echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied"
|
||||
[ -d /coredump ] || mkdir /coredump || echo -e "failed to mdkir /coredump"
|
||||
[ -d /coredump ] \
|
||||
&& echo "/coredump/core_%e_%p_%t" > /proc/sys/kernel/core_pattern || echo "Permission denied"
|
||||
corepath="/coredump/"
|
||||
fi
|
||||
fi
|
||||
|
@ -248,6 +250,7 @@ if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" !
|
|||
echo "### run TSIM test case ###"
|
||||
cd $tests_dir/script
|
||||
|
||||
[ -d ../../sim ] || mkdir ../../sim || echo -e "failed to mkdir ../../sim"
|
||||
[ -f out.log ] && rm -f out.log
|
||||
if [ "$1" == "cron" ]; then
|
||||
echo "### run TSIM regression test ###"
|
||||
|
@ -368,16 +371,20 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$2" != "
|
|||
echo "### run Python smoke test ###"
|
||||
runPyCaseOneByOne smoketest.sh
|
||||
fi
|
||||
totalPySuccess=`grep 'success' pytest-out.log | wc -l`
|
||||
|
||||
if [ "$totalPySuccess" -gt "0" ]; then
|
||||
echo -e "\n${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
|
||||
fi
|
||||
if [ -f pytest-out.log ]; then
|
||||
totalPySuccess=`grep 'success' pytest-out.log | wc -l`
|
||||
if [ "$totalPySuccess" -gt "0" ]; then
|
||||
echo -e "\n${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}"
|
||||
fi
|
||||
|
||||
totalPyFailed=`grep 'failed\|fault' pytest-out.log | wc -l`
|
||||
if [ "$totalPyFailed" -ne "0" ]; then
|
||||
echo -e "\n${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
|
||||
# exit $totalPyFailed
|
||||
totalPyFailed=`grep 'failed\|fault' pytest-out.log | wc -l`
|
||||
if [ "$totalPyFailed" -ne "0" ]; then
|
||||
echo -e "\n${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
|
||||
# exit $totalPyFailed
|
||||
fi
|
||||
else
|
||||
echo -e "pytest-out.log not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue