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

New UT should not exceed 15s (#29492)

* added UT should not exceed 15s

* fix error

* UT limit of 15s is the first to be executed

* fix error

* fix error with CI_SKIP_CPP_TEST

* modfied tiemout setting

* fix error
上级 f02aece1
......@@ -422,10 +422,9 @@ function(cc_test_run TARGET_NAME)
# No unit test should exceed 2 minutes.
if (WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
elseif (APPLE)
endif()
if (APPLE)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 20)
else()
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 120)
endif()
endif()
endfunction()
......@@ -814,11 +813,9 @@ function(py_test TARGET_NAME)
if (WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
elseif (APPLE)
endif()
if (APPLE)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 20)
else()
# No unit test should exceed 2 minutes in Linux.
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 120)
endif()
endif()
......
......@@ -64,8 +64,12 @@ function init() {
# set CI_SKIP_CPP_TEST if only *.py changed
# In order to avoid using in some CI(such as daily performance), the current
# branch must not be `${BRANCH}` which is usually develop.
if [ "$(git branch | grep "^\*" | awk '{print $2}')" != "${BRANCH}" ]; then
git diff --name-only ${BRANCH} | grep -v "\.py$" || export CI_SKIP_CPP_TEST=ON
if [ ${CI_SKIP_CPP_TEST:-ON} == "OFF" ];then
echo "CI_SKIP_CPP_TEST=OFF"
else
if [ "$(git branch | grep "^\*" | awk '{print $2}')" != "${BRANCH}" ]; then
git diff --name-only ${BRANCH} | grep -v "\.py$" || export CI_SKIP_CPP_TEST=ON
fi
fi
}
......@@ -1010,15 +1014,15 @@ function card_test() {
tmpfile=$tmp_dir/$tmpfile_rand"_"$i
if [ ${TESTING_DEBUG_MODE:-OFF} == "ON" ] ; then
if [[ $cardnumber == $CUDA_DEVICE_COUNT ]]; then
(ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" -V | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
(ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" -V --timeout 120 | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
else
(env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" -V | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
(env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" --timeout 120 -V | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
fi
else
if [[ $cardnumber == $CUDA_DEVICE_COUNT ]]; then
(ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
(ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" --timeout 120 --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
else
(env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
(env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -E "($disable_ut_quickly)" --timeout 120 --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) &
fi
fi
done
......@@ -1045,6 +1049,17 @@ set +x
if [ ${PRECISION_TEST:-OFF} == "ON" ]; then
precision_cases=`python $PADDLE_ROOT/tools/get_pr_ut.py`
fi
bash $PADDLE_ROOT/tools/check_added_ut.sh
if [ -a "$PADDLE_ROOT/added_ut" ];then
added_uts=^$(awk BEGIN{RS=EOF}'{gsub(/\n/,"$|^");print}' $PADDLE_ROOT/added_ut)$
ctest -R "(${added_uts})" --output-on-failure --repeat-until-fail 3 --timeout 15;added_ut_error=$?
if [ "$added_ut_error" != 0 ];then
echo "========================================"
echo "Added UT should not exceed 15 seconds"
echo "========================================"
exit 8;
fi
fi
EXIT_CODE=0;
test_cases=$(ctest -N -V) # get all test cases
exclusive_tests='' # cases list which would be run exclusively
......
......@@ -245,8 +245,6 @@ function(py_test_modules TARGET_NAME)
endif()
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
else()
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 120)
endif()
endif()
endfunction()
......@@ -288,9 +286,7 @@ function(bash_test_modules TARGET_NAME)
endif()
if(bash_test_modules_LABELS)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT ${timeout} LABELS ${bash_test_modules_LABELS})
else()
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT ${timeout})
set_tests_properties(${TARGET_NAME} PROPERTIES LABELS ${bash_test_modules_LABELS})
endif()
endfunction()
......@@ -332,9 +328,7 @@ function(parallel_bash_test_modules TARGET_NAME)
endif()
if(parallel_bash_test_modules_LABELS)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT ${timeout} LABELS ${parallel_bash_test_modules_LABELS})
else()
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT ${timeout})
set_tests_properties(${TARGET_NAME} PROPERTIES LABELS ${parallel_bash_test_modules_LABELS})
endif()
endfunction()
......
......@@ -19,6 +19,7 @@ if [ -z ${BRANCH} ]; then
BRANCH="develop"
fi
export CI_SKIP_CPP_TEST=OFF
PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
CURDIR=`pwd`
cd $PADDLE_ROOT
......@@ -40,3 +41,4 @@ rm /$PADDLE_ROOT/br-ut /$PADDLE_ROOT/pr-ut $PADDLE_ROOT/paddle/scripts/paddle_bu
git checkout $CURBRANCH
git branch -D prec_added_ut
cd $CURDIR
export CI_SKIP_CPP_TEST=
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册