未验证 提交 7745ad55 编写于 作者: L LoveAn 提交者: GitHub

Add details to the summary for show more error informations (#27165)

* Add details to the summary and test it, test=document_fix

* Add set +e before example, test=document_fix

* Remove test code, test=document_fix

* Optimize summary information and test it, test=document_fix

* Remove test code, test=document_fix
上级 19228bd1
......@@ -296,13 +296,13 @@ function check_style() {
commit_files=on
for file_name in `git diff --numstat upstream/$BRANCH |awk '{print $NF}'`;do
if ! pre-commit run --files $file_name ; then
git diff
commit_files=off
fi
done
if [ $commit_files == 'off' ];then
echo "code format error"
git diff 2>&1
exit 4
fi
trap : 0
......@@ -1447,7 +1447,7 @@ function example() {
cd ${PADDLE_ROOT}/tools
python sampcd_processor.py cpu;example_error=$?
if [ "$example_error" != "0" ];then
echo "Code instance execution failed"
echo "Code instance execution failed" >&2
exit 5
fi
}
......@@ -1456,15 +1456,25 @@ function summary_check_problems() {
set +x
local check_style_code=$1
local example_code=$2
local check_style_info=$3
local example_info=$4
if [ $check_style_code -ne 0 -o $example_code -ne 0 ];then
echo "========================================"
echo "summary problems:"
if [ $check_style_code -ne 0 -a $example_code -ne 0 ];then
echo "There are 2 errors: Code format error and Example code error."
else
[ $check_style_code -ne 0 ] && echo "There is 1 error: Code format error."
[ $example_code -ne 0 ] && echo "There is 1 error: Example code error."
fi
echo "========================================"
if [ $check_style_code -ne 0 ];then
echo "- Check code style failed! Please check the log and fix problems."
echo "*****Code format error***** Please fix it according to the diff information:"
echo "$check_style_info" | grep "code format error" -A $(echo "$check_style_info" | wc -l)
fi
if [ $example_code -ne 0 ];then
echo "- Check example code failed! Please check the log and fix problems."
echo "*****Example code error***** Please fix the error listed in the information:"
echo "$example_info" | grep "API check -- Example Code" -A $(echo "$example_info" | wc -l)
fi
[ $check_style_code -ne 0 ] && exit $check_style_code
[ $example_code -ne 0 ] && exit $example_code
......@@ -1486,15 +1496,16 @@ function main() {
;;
build_and_check)
set +e
$(check_style >&2)
check_style_info=$(check_style)
check_style_code=$?
generate_upstream_develop_api_spec ${PYTHON_ABI:-""} ${parallel_number}
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
check_sequence_op_unittest
generate_api_spec ${PYTHON_ABI:-""} "PR"
$(example >&2)
set +e
example_info=$(example)
example_code=$?
summary_check_problems $check_style_code $example_code
summary_check_problems $check_style_code $example_code "$check_style_info" "$example_info"
assert_api_spec_approvals
;;
build)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册