未验证 提交 c1c3e217 编写于 作者: Y YUNSHEN XIE 提交者: GitHub

retry will not be executed when the number of failed ut is greater than 20 (#28374)

* retry will not be executed when the number of failed ut is greater than 20

* add log display

* fix some error

* fix some error

* fix some error

* fix some error
上级 ea851796
...@@ -568,35 +568,46 @@ EOF ...@@ -568,35 +568,46 @@ EOF
retry_time=3 retry_time=3
exec_times=0 exec_times=0
exec_time_array=('first' 'second' 'third') exec_time_array=('first' 'second' 'third')
exec_retry_threshold=20
if [ -n "$failed_test_lists" ];then if [ -n "$failed_test_lists" ];then
mactest_error=1 mactest_error=1
while ( [ $exec_times -lt $retry_time ] && [ -n "${failed_test_lists}" ] ) read need_retry_ut_str <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(" | sed 's/(//' | sed 's/- //' )
do need_retry_ut_arr=(${need_retry_ut_str})
retry_unittests_record="$retry_unittests_record$failed_test_lists" need_retry_ut_count=${#need_retry_ut_arr[@]}
failed_test_lists_ult=`echo "${failed_test_lists}"` if [ $need_retry_ut_count -lt $exec_retry_threshold ];then
read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(" | sed 's/(//' | sed 's/- //' ) while ( [ $exec_times -lt $retry_time ] && [ -n "${failed_test_lists}" ] )
echo "=========================================" do
echo "This is the ${exec_time_array[$exec_times]} time to re-run" retry_unittests_record="$retry_unittests_record$failed_test_lists"
echo "=========================================" failed_test_lists_ult=`echo "${failed_test_lists}"`
echo "The following unittest will be re-run:" read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(" | sed 's/(//' | sed 's/- //' )
echo "${retry_unittests}" echo "========================================="
echo "=========================================" echo "This is the ${exec_time_array[$exec_times]} time to re-run"
echo "========================================="
retry_unittests_regular='' echo "The following unittest will be re-run:"
for line in ${retry_unittests[@]} ; echo "${retry_unittests}"
do echo "========================================="
if [[ "$retry_unittests_regular" == "" ]];then
retry_unittests_regular="^$line$" retry_unittests_regular=''
else for line in ${retry_unittests[@]} ;
retry_unittests_regular="$retry_unittests_regular|^$line$" do
fi if [[ "$retry_unittests_regular" == "" ]];then
done retry_unittests_regular="^$line$"
rm -f $tmp_dir/* else
failed_test_lists='' retry_unittests_regular="$retry_unittests_regular|^$line$"
ctest -R "($retry_unittests_regular)" --output-on-failure -j $2 | tee $tmpfile fi
collect_failed_tests done
exec_times=$[$exec_times+1] rm -f $tmp_dir/*
done failed_test_lists=''
ctest -R "($retry_unittests_regular)" --output-on-failure -j $2 | tee $tmpfile
collect_failed_tests
exec_times=$[$exec_times+1]
done
else
echo "========================================="
echo "There are more than 20 failed unit tests, so no unit test retry!!!"
echo "========================================="
fi
fi fi
#mactest_error=$? #mactest_error=$?
ut_endTime_s=`date +%s` ut_endTime_s=`date +%s`
...@@ -1080,71 +1091,81 @@ set +x ...@@ -1080,71 +1091,81 @@ set +x
retry_unittests_record='' retry_unittests_record=''
retry_time=3 retry_time=3
exec_time_array=('first' 'second' 'third') exec_time_array=('first' 'second' 'third')
exec_retry_threshold=20
if [ -n "$failed_test_lists" ];then if [ -n "$failed_test_lists" ];then
while ( [ $exec_times -lt $retry_time ] && [ -n "${failed_test_lists}" ] ) read need_retry_ut_str <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
do need_retry_ut_arr=(${need_retry_ut_str})
need_retry_ut_count=${#need_retry_ut_arr[@]}
retry_unittests_record="$retry_unittests_record$failed_test_lists" if [ $need_retry_ut_count -lt $exec_retry_threshold ];then
failed_test_lists_ult=`echo "${failed_test_lists}" |grep -Po '[^ ].*$'` while ( [ $exec_times -lt $retry_time ] && [ -n "${failed_test_lists}" ] )
read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' ) do
echo "========================================="
echo "This is the ${exec_time_array[$exec_times]} time to re-run"
echo "========================================="
echo "The following unittest will be re-run:"
echo "${failed_test_lists_ult}"
for line in ${retry_unittests[@]} ; retry_unittests_record="$retry_unittests_record$failed_test_lists"
do failed_test_lists_ult=`echo "${failed_test_lists}" |grep -Po '[^ ].*$'`
read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
one_card_tests=$single_card_tests'|'$single_card_tests_1 echo "========================================="
echo "This is the ${exec_time_array[$exec_times]} time to re-run"
read tmp_one_tmp <<< "$( echo $one_card_tests | grep -oEi $line )" echo "========================================="
read tmp_mul_tmp <<< "$( echo $multiple_card_tests | grep -oEi $line )" echo "The following unittest will be re-run:"
read exclusive_tmp <<< "$( echo $exclusive_tests | grep -oEi $line )" echo "${failed_test_lists_ult}"
if [[ "$tmp_one_tmp" != "" ]]; then for line in ${retry_unittests[@]} ;
if [[ "$one_card_retry" == "" ]]; then do
one_card_retry="^$line$"
else one_card_tests=$single_card_tests'|'$single_card_tests_1
one_card_retry="$one_card_retry|^$line$"
fi read tmp_one_tmp <<< "$( echo $one_card_tests | grep -oEi $line )"
elif [[ "$tmp_mul_tmp" != "" ]]; then read tmp_mul_tmp <<< "$( echo $multiple_card_tests | grep -oEi $line )"
if [[ "$multiple_card_retry" == "" ]]; then read exclusive_tmp <<< "$( echo $exclusive_tests | grep -oEi $line )"
multiple_card_retry="^$line$"
if [[ "$tmp_one_tmp" != "" ]]; then
if [[ "$one_card_retry" == "" ]]; then
one_card_retry="^$line$"
else
one_card_retry="$one_card_retry|^$line$"
fi
elif [[ "$tmp_mul_tmp" != "" ]]; then
if [[ "$multiple_card_retry" == "" ]]; then
multiple_card_retry="^$line$"
else
multiple_card_retry="$multiple_card_retry|^$line$"
fi
else else
multiple_card_retry="$multiple_card_retry|^$line$" if [[ "$exclusive_retry" == "" ]];then
exclusive_retry="^$line$"
else
exclusive_retry="$exclusive_retry|^$line$"
fi
fi fi
else
if [[ "$exclusive_retry" == "" ]];then
exclusive_retry="^$line$"
else
exclusive_retry="$exclusive_retry|^$line$"
fi
fi
done done
if [[ "$one_card_retry" != "" ]]; then if [[ "$one_card_retry" != "" ]]; then
card_test "$one_card_retry" 1 card_test "$one_card_retry" 1
fi fi
if [[ "$multiple_card_retry" != "" ]]; then if [[ "$multiple_card_retry" != "" ]]; then
card_test "$multiple_card_retry" 2 card_test "$multiple_card_retry" 2
fi fi
if [[ "$exclusive_retry" != "" ]]; then if [[ "$exclusive_retry" != "" ]]; then
card_test "$exclusive_retry" card_test "$exclusive_retry"
fi fi
exec_times=$[$exec_times+1] exec_times=$[$exec_times+1]
failed_test_lists='' failed_test_lists=''
collect_failed_tests collect_failed_tests
rm -f $tmp_dir/* rm -f $tmp_dir/*
one_card_retry='' one_card_retry=''
multiple_card_retry='' multiple_card_retry=''
exclusive_retry='' exclusive_retry=''
retry_unittests='' retry_unittests=''
done done
else
echo "========================================="
echo "There are more than 20 failed unit tests, so no unit test retry!!!"
echo "========================================="
fi
fi fi
if [[ "$EXIT_CODE" != "0" ]]; then if [[ "$EXIT_CODE" != "0" ]]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册