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

fix modified_retry_method_only_win (#31404)

* fix modified_retry_method_only_win

* fix bug

* fix retry bug on windows
上级 dcce54ea
...@@ -221,6 +221,7 @@ non_parallel_job_2=$(echo $non_parallel_job | cut -d "," -f 2) ...@@ -221,6 +221,7 @@ non_parallel_job_2=$(echo $non_parallel_job | cut -d "," -f 2)
failed_test_lists='' failed_test_lists=''
tmp_dir=`mktemp -d` tmp_dir=`mktemp -d`
function collect_failed_tests() { function collect_failed_tests() {
set +e
for file in `ls $tmp_dir`; do for file in `ls $tmp_dir`; do
grep -q 'The following tests FAILED:' $tmp_dir/$file grep -q 'The following tests FAILED:' $tmp_dir/$file
exit_code=$? exit_code=$?
...@@ -232,6 +233,7 @@ function collect_failed_tests() { ...@@ -232,6 +233,7 @@ function collect_failed_tests() {
${failuretest}" ${failuretest}"
fi fi
done done
set -e
} }
function run_unittest() { function run_unittest() {
...@@ -247,7 +249,7 @@ function run_unittest() { ...@@ -247,7 +249,7 @@ function run_unittest() {
echo "************************************************************************" echo "************************************************************************"
export CUDA_VISIBLE_DEVICES=0 export CUDA_VISIBLE_DEVICES=0
tmpfile=$tmp_dir/$RANDOM tmpfile=$tmp_dir/$RANDOM
(ctest -R "$test_case" -E "$disable_ut_quickly|$diable_wingpu_test|$long_time_test" -LE "${nightly_label}" --output-on-failure -C Release -j $parallel_job --repeat until-pass:4 after-timeout:4 | tee $tmpfile ) & (ctest -R "$test_case" -E "$disable_ut_quickly|$diable_wingpu_test|$long_time_test" -LE "${nightly_label}" --output-on-failure -C Release -j $parallel_job | tee $tmpfile ) &
wait; wait;
} }
...@@ -259,8 +261,9 @@ function unittests_retry(){ ...@@ -259,8 +261,9 @@ function unittests_retry(){
exec_times=0 exec_times=0
exec_retry_threshold=10 exec_retry_threshold=10
retry_unittests=$(echo "${failed_test_lists}" | grep -oEi "\-.+\(" | sed 's/(//' | sed 's/- //' ) retry_unittests=$(echo "${failed_test_lists}" | grep -oEi "\-.+\(" | sed 's/(//' | sed 's/- //' )
need_retry_ut_counts=$(echo "$ut_lists" |awk -F ' ' '{print }'| sed '/^$/d' | wc -l) need_retry_ut_counts=$(echo "$retry_unittests" |awk -F ' ' '{print }'| sed '/^$/d' | wc -l)
retry_unittests_regular=$(echo "$retry_unittests" |awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}') retry_unittests_regular=$(echo "$retry_unittests" |awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}')
tmpfile=$tmp_dir/$RANDOM
if [ $need_retry_ut_counts -lt $exec_retry_threshold ];then if [ $need_retry_ut_counts -lt $exec_retry_threshold ];then
retry_unittests_record='' retry_unittests_record=''
...@@ -271,7 +274,7 @@ function unittests_retry(){ ...@@ -271,7 +274,7 @@ function unittests_retry(){
cur_order='first' cur_order='first'
elif ( [[ "$exec_times" == "1" ]] );then elif ( [[ "$exec_times" == "1" ]] );then
cur_order='second' cur_order='second'
elif ( [[ "$exec_times" == "1" ]] );then elif ( [[ "$exec_times" == "2" ]] );then
cur_order='third' cur_order='third'
fi fi
echo "=========================================" echo "========================================="
...@@ -282,7 +285,8 @@ function unittests_retry(){ ...@@ -282,7 +285,8 @@ function unittests_retry(){
echo "=========================================" echo "========================================="
rm -f $tmp_dir/* rm -f $tmp_dir/*
failed_test_lists='' failed_test_lists=''
ctest -R "($retry_unittests_regular)" --output-on-failure -C Release -j $parallel_job| tee $tmpfile (ctest -R "($retry_unittests_regular)" --output-on-failure -C Release -j $parallel_job| tee $tmpfile ) &
wait;
collect_failed_tests collect_failed_tests
exec_times=$(echo $exec_times | awk '{print $0+1}') exec_times=$(echo $exec_times | awk '{print $0+1}')
done done
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册