提交 373e0e50 编写于 作者: L liuyq-617

reduce fail case time cost

上级 827c7bea
...@@ -86,7 +86,7 @@ pipeline { ...@@ -86,7 +86,7 @@ pipeline {
pre_test() pre_test()
sh ''' sh '''
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh pytest ./test-all.sh pytestfq
date''' date'''
} }
} }
...@@ -96,7 +96,7 @@ pipeline { ...@@ -96,7 +96,7 @@ pipeline {
pre_test() pre_test()
sh ''' sh '''
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh b1 ./test-all.sh b1fq
date''' date'''
} }
} }
...@@ -120,7 +120,7 @@ pipeline { ...@@ -120,7 +120,7 @@ pipeline {
sh ''' sh '''
date date
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh b2 ./test-all.sh b2fq
date date
''' '''
} }
...@@ -141,7 +141,7 @@ pipeline { ...@@ -141,7 +141,7 @@ pipeline {
sh ''' sh '''
date date
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh b3 ./test-all.sh b3fq
date''' date'''
} }
} }
......
...@@ -25,6 +25,24 @@ function runSimCaseOneByOne { ...@@ -25,6 +25,24 @@ function runSimCaseOneByOne {
fi fi
done < $1 done < $1
} }
function runSimCaseOneByOnefq {
while read -r line; do
if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then
case=`echo $line | grep sim$ |awk '{print $NF}'`
start_time=`date +%s`
./test.sh -f $case > /dev/null 2>&1 && \
echo -e "${GREEN}$case success${NC}" | tee -a out.log || \
echo -e "${RED}$case failed${NC}" | tee -a out.log
out_log=`tail -1 out.log `
if [[ $out_log =~ 'failed' ]];then
exit 8
fi
end_time=`date +%s`
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a out.log
fi
done < $1
}
function runPyCaseOneByOne { function runPyCaseOneByOne {
while read -r line; do while read -r line; do
...@@ -52,7 +70,32 @@ function runPyCaseOneByOne { ...@@ -52,7 +70,32 @@ function runPyCaseOneByOne {
fi fi
done < $1 done < $1
} }
function runPyCaseOneByOnefq {
while read -r line; do
if [[ $line =~ ^python.* ]]; then
if [[ $line != *sleep* ]]; then
if [[ $line =~ '-r' ]];then
case=`echo $line|awk '{print $4}'`
else
case=`echo $line|awk '{print $NF}'`
fi
start_time=`date +%s`
$line > /dev/null 2>&1 && \
echo -e "${GREEN}$case success${NC}" | tee -a pytest-out.log || \
echo -e "${RED}$case failed${NC}" | tee -a pytest-out.log
end_time=`date +%s`
out_log=`tail -1 pytest-out.log `
if [[ $out_log =~ 'failed' ]];then
exit 8
fi
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log
else
$line > /dev/null 2>&1
fi
fi
done < $1
}
totalFailed=0 totalFailed=0
totalPyFailed=0 totalPyFailed=0
...@@ -78,6 +121,15 @@ if [ "$2" != "python" ]; then ...@@ -78,6 +121,15 @@ if [ "$2" != "python" ]; then
elif [ "$1" == "b3" ]; then elif [ "$1" == "b3" ]; then
echo "### run TSIM b3 test ###" echo "### run TSIM b3 test ###"
runSimCaseOneByOne jenkins/basic_3.txt runSimCaseOneByOne jenkins/basic_3.txt
elif [ "$1" == "b1fq" ]; then
echo "### run TSIM b1 test ###"
runSimCaseOneByOnefq jenkins/basic_1.txt
elif [ "$1" == "b2fq" ]; then
echo "### run TSIM b2 test ###"
runSimCaseOneByOnefq jenkins/basic_2.txt
elif [ "$1" == "b3fq" ]; then
echo "### run TSIM b3 test ###"
runSimCaseOneByOnefq jenkins/basic_3.txt
elif [ "$1" == "smoke" ] || [ -z "$1" ]; then elif [ "$1" == "smoke" ] || [ -z "$1" ]; then
echo "### run TSIM smoke test ###" echo "### run TSIM smoke test ###"
runSimCaseOneByOne basicSuite.sim runSimCaseOneByOne basicSuite.sim
...@@ -137,6 +189,9 @@ if [ "$2" != "sim" ]; then ...@@ -137,6 +189,9 @@ if [ "$2" != "sim" ]; then
elif [ "$1" == "pytest" ]; then elif [ "$1" == "pytest" ]; then
echo "### run Python full test ###" echo "### run Python full test ###"
runPyCaseOneByOne fulltest.sh runPyCaseOneByOne fulltest.sh
elif [ "$1" == "pytestfq" ]; then
echo "### run Python full test ###"
runPyCaseOneByOnefq fulltest.sh
elif [ "$1" == "p1" ]; then elif [ "$1" == "p1" ]; then
echo "### run Python_1 test ###" echo "### run Python_1 test ###"
runPyCaseOneByOne pytest_1.sh runPyCaseOneByOne pytest_1.sh
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册