From 2300d45f8b2a16b8f1623dbdbeb58c1d48c7a1d0 Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Mon, 23 May 2022 17:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90CI=E3=80=91run=20all=20demo=20ci=20bef?= =?UTF-8?q?ore=20exit=20in=20windows=20(#42700)=20(#42897)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cherry-pick PR #42700 --- paddle/fluid/inference/api/demo_ci/run.sh | 46 ++++++++++++++------ paddle/fluid/inference/tests/infer_ut/run.sh | 2 +- paddle/scripts/paddle_build.bat | 13 ++++-- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/paddle/fluid/inference/api/demo_ci/run.sh b/paddle/fluid/inference/api/demo_ci/run.sh index 290c547c986..c8a78a168a8 100755 --- a/paddle/fluid/inference/api/demo_ci/run.sh +++ b/paddle/fluid/inference/api/demo_ci/run.sh @@ -106,6 +106,9 @@ mkdir -p build cd build rm -rf * +# run all test cases before exit +EXIT_CODE=0 + for WITH_STATIC_LIB in ON OFF; do if [ $(echo `uname` | grep "Win") != "" ]; then # TODO(wilber, T8T9): Do we still need to support windows gpu static library @@ -128,8 +131,8 @@ for WITH_STATIC_LIB in ON OFF; do --dirname=$DATA_DIR/word2vec/word2vec.inference.model \ --use_gpu=$use_gpu if [ $? -ne 0 ]; then - echo "simple_on_word2vec demo runs fail." - exit 1 + echo "simple_on_word2vec use_gpu:${use_gpu} runs failed " > ${current_dir}/test_summary.txt + EXIT_CODE=1 fi done @@ -153,8 +156,8 @@ for WITH_STATIC_LIB in ON OFF; do --refer=$DATA_DIR/$vis_demo_name/result.txt \ --use_gpu=$use_gpu if [ $? -ne 0 ]; then - echo "vis demo $vis_demo_name runs fail." - exit 1 + echo "vis demo $vis_demo_name use_gpu:${use_gpu} runs failed " >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi done done @@ -179,8 +182,8 @@ for WITH_STATIC_LIB in ON OFF; do --data=$DATA_DIR/mobilenet/data.txt \ --refer=$DATA_DIR/mobilenet/result.txt if [ $? -ne 0 ]; then - echo "trt demo trt_mobilenet_demo runs fail." - exit 1 + echo "trt_mobilenet_demo runs failed." >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi fi else @@ -200,8 +203,8 @@ for WITH_STATIC_LIB in ON OFF; do --dirname=$DATA_DIR/word2vec/word2vec.inference.model \ --use_gpu=$use_gpu if [ $? -ne 0 ]; then - echo "simple_on_word2vec demo runs fail." - exit 1 + echo "simple_on_word2vec use_gpu:${use_gpu} runs failed " >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi done fi @@ -222,8 +225,8 @@ for WITH_STATIC_LIB in ON OFF; do --refer=$DATA_DIR/$vis_demo_name/result.txt \ --use_gpu=$use_gpu if [ $? -ne 0 ]; then - echo "vis demo $vis_demo_name runs fail." - exit 1 + echo "vis demo $vis_demo_name use_gpu:${use_gpu} runs failed " >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi done done @@ -244,8 +247,8 @@ for WITH_STATIC_LIB in ON OFF; do --data=$DATA_DIR/mobilenet/data.txt \ --refer=$DATA_DIR/mobilenet/result.txt if [ $? -ne 0 ]; then - echo "trt demo trt_mobilenet_demo runs fail." - exit 1 + echo "trt_mobilenet_demo runs failed " >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi fi @@ -264,10 +267,25 @@ for WITH_STATIC_LIB in ON OFF; do ./onnxruntime_mobilenet_demo \ --modeldir=$DATA_DIR/MobileNetV2/MobileNetV2 if [ $? -ne 0 ]; then - echo "onnxruntime demo onnxruntime_mobilenet_demo runs fail." - exit 1 + echo "onnxruntime_mobilenet_demo runs failed " >> ${current_dir}/test_summary.txt + EXIT_CODE=1 fi fi fi done + set +x + +if [[ -f ${current_dir}/test_summary.txt ]];then + echo " " + echo "Summary demo_ci Failed Tests ..." + echo "=====================test summary======================" + echo "The following tests Failed: " + cat ${current_dir}/test_summary.txt + echo "========================================================" + echo " " +fi + +set -x + +exit ${EXIT_CODE} diff --git a/paddle/fluid/inference/tests/infer_ut/run.sh b/paddle/fluid/inference/tests/infer_ut/run.sh index 331608a2cbc..a78bc2b85d2 100755 --- a/paddle/fluid/inference/tests/infer_ut/run.sh +++ b/paddle/fluid/inference/tests/infer_ut/run.sh @@ -309,7 +309,7 @@ echo " " if [[ -f ${exe_dir}/test_summary.txt ]];then echo " " - echo "Summary Failed Tests ..." + echo "Summary infer_ut Failed Tests ..." echo "=====================test summary======================" echo "The following tests Failed: " cat ${exe_dir}/test_summary.txt diff --git a/paddle/scripts/paddle_build.bat b/paddle/scripts/paddle_build.bat index 38077878be7..94d8654a31a 100644 --- a/paddle/scripts/paddle_build.bat +++ b/paddle/scripts/paddle_build.bat @@ -302,10 +302,14 @@ if %errorlevel% NEQ 0 exit /b 1 call :cmake || goto cmake_error call :build || goto build_error -call :test_inference || goto test_inference_error -call :test_inference_ut || goto test_inference_ut_error +call :test_inference +if %errorlevel% NEQ 0 set error_code=%errorlevel% +call :test_inference_ut +if %errorlevel% NEQ 0 set error_code=%errorlevel% + call :zip_cc_file || goto zip_cc_file_error call :zip_c_file || goto zip_c_file_error +if %error_code% NEQ 0 goto test_inference_error goto:success rem "Other configurations are added here" @@ -758,12 +762,15 @@ for /F %%i in ("%libsize%") do ( cd /d %work_dir%\paddle\fluid\inference\api\demo_ci %cache_dir%\tools\busybox64.exe bash run.sh %work_dir:\=/% %WITH_MKL% %WITH_GPU% %cache_dir:\=/%/inference_demo %WITH_TENSORRT% %TENSORRT_ROOT% %WITH_ONNXRUNTIME% %MSVC_STATIC_CRT% "%CUDA_TOOLKIT_ROOT_DIR%" + goto:eof :test_inference_error ::echo 1 > %cache_dir%\error_code.txt ::type %cache_dir%\error_code.txt -echo Testing fluid library for inference failed! +echo ========================================== +echo Testing inference library failed! +echo ========================================== exit /b 1 rem --------------------------------------------------------------------------------------------- -- GitLab