From d067e66d39fd4193055e72e4fd5ad08a7fad7631 Mon Sep 17 00:00:00 2001 From: LoveAn Date: Wed, 2 Sep 2020 09:58:41 +0800 Subject: [PATCH] Show more possible problems with build_and_check in file paddle_build.sh (#26846) * Show more possible problems with build_and_check in file paddle_build.sh, test=develop * Remove test codes modified in file device.py for build_and_check, test=document_fix * Fix missing blank space in file device.py, test=document_fix * Final process via summary_check_problems function, test=document_fix --- paddle/scripts/paddle_build.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index f032217668..6414b78172 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -1395,6 +1395,26 @@ function example() { fi } +function summary_check_problems() { + set +x + local check_style_code=$1 + local example_code=$2 + if [ $check_style_code -ne 0 -o $example_code -ne 0 ];then + echo "========================================" + echo "summary problems:" + echo "========================================" + if [ $check_style_code -ne 0 ];then + echo "- Check code style failed! Please check the log and fix problems." + fi + if [ $example_code -ne 0 ];then + echo "- Check example code failed! Please check the log and fix problems." + fi + [ $check_style_code -ne 0 ] && exit $check_style_code + [ $example_code -ne 0 ] && exit $example_code + fi + set -x +} + function main() { local CMD=$1 local parallel_number=$2 @@ -1407,12 +1427,15 @@ function main() { cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number} ;; build_and_check) - check_style + $(check_style >&2) + 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 + $(example >&2) + example_code=$? + summary_check_problems $check_style_code $example_code assert_api_spec_approvals ;; build) -- GitLab