提交 2cab4f2b 编写于 作者: L liuyq-617

[TD-2617]<test>restore log of failed case

上级 2c0b4c2a
...@@ -6,7 +6,16 @@ GREEN='\033[1;32m' ...@@ -6,7 +6,16 @@ GREEN='\033[1;32m'
GREEN_DARK='\033[0;32m' GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m' GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
branch=(${branch////_})
echo "$branch"
fi
}
function runSimCaseOneByOne { function runSimCaseOneByOne {
while read -r line; do while read -r line; do
if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then
...@@ -44,6 +53,11 @@ function runSimCaseOneByOnefq { ...@@ -44,6 +53,11 @@ function runSimCaseOneByOnefq {
out_log=`tail -1 out.log ` out_log=`tail -1 out.log `
if [[ $out_log =~ 'failed' ]];then if [[ $out_log =~ 'failed' ]];then
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
cp -r ../../../sim ~/sim_$(git_branch)_`date "+%Y_%m_%d_%H:%M:%S"`
else
cp -r ../../sim ~/sim_$(git_branch)_`date "+%Y_%m_%d_%H:%M:%S" `
fi
exit 8 exit 8
fi fi
end_time=`date +%s` end_time=`date +%s`
...@@ -95,6 +109,7 @@ function runPyCaseOneByOnefq { ...@@ -95,6 +109,7 @@ function runPyCaseOneByOnefq {
end_time=`date +%s` end_time=`date +%s`
out_log=`tail -1 pytest-out.log ` out_log=`tail -1 pytest-out.log `
if [[ $out_log =~ 'failed' ]];then if [[ $out_log =~ 'failed' ]];then
cp -r ../../sim ~/sim_$(git_branch)_`date "+%Y_%m_%d_%H:%M:%S" `
exit 8 exit 8
fi fi
echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log echo execution time of $case was `expr $end_time - $start_time`s. | tee -a pytest-out.log
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册