diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index 3a46c792ec16796da4971f9d53fc57793f054fa9..faedc75cc7608d91c16f841e59d13bc6ce3fe329 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -198,6 +198,22 @@ if [ "${NEW_OP_TEST_ADDED}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then fi fi +UNITTEST_FILE_CHANGED=`git diff --name-only --diff-filter=AM upstream/$BRANCH |grep -E "test_.*.\.py" || true` +if [ "${UNITTEST_FILE_CHANGED}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + for TEST_FILE in ${UNITTEST_FILE_CHANGED}; + do + HAS_SKIP_CHECK_GRAD_CI=`git diff -U0 upstream/$BRANCH ${PADDLE_ROOT}/${TEST_FILE} |grep "@skip_check_grad_ci" || true` + if [ "${HAS_SKIP_CHECK_GRAD_CI}" != "" ]; then + ERROR_LINES="${ERROR_LINES}\n${TEST_FILE}\n${HAS_SKIP_CHECK_GRAD_CI}\n" + fi + done + if [ "${ERROR_LINES}" != "" ]; then + ERROR_LINES=${ERROR_LINES//+/'\n+\t'} + echo_line="You must have one RD (zhangting2020 (Recommend), luotao1 or phlrain) approval for the usage (either add or delete) of @skip_check_grad_ci. For more information, please refer to: https://github.com/PaddlePaddle/Paddle/wiki/Gradient-Check-Is-Required-for-Op-Test. The corresponding lines are as follows:\n${ERROR_LINES}\n" + check_approval 1 26615455 6836917 43953930 + fi +fi + if [ -n "${echo_list}" ];then echo "****************" echo -e "${echo_list[@]}"