From 7896b51a264fcafeb1e9a9466c89b55e2eb99548 Mon Sep 17 00:00:00 2001 From: wuhuanzhou Date: Wed, 19 May 2021 18:38:50 +0800 Subject: [PATCH] CI skip inference test if only python files modified (#32962) * CI skip inference test if only python files modified, test=develop * fix compilation error on ROCM, test=develop * fix cmake error on PR-CI-ROCM-Compile, test=develop --- cmake/generic.cmake | 8 +++----- paddle/fluid/inference/api/CMakeLists.txt | 2 +- paddle/fluid/inference/tests/api/CMakeLists.txt | 8 ++++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/generic.cmake b/cmake/generic.cmake index a5c74a46631..53dcde616b2 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -391,7 +391,7 @@ function(cc_binary TARGET_NAME) endfunction(cc_binary) function(cc_test_build TARGET_NAME) - if(WITH_TESTING) + if(WITH_TESTING AND NOT "$ENV{CI_SKIP_CPP_TEST}" STREQUAL "ON") set(oneValueArgs "") set(multiValueArgs SRCS DEPS) cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -409,14 +409,12 @@ function(cc_test_build TARGET_NAME) if(WITH_ROCM) target_link_libraries(${TARGET_NAME} ${ROCM_HIPRTC_LIB}) endif() + check_coverage_opt(${TARGET_NAME} ${cc_test_SRCS}) endif() - - check_coverage_opt(${TARGET_NAME} ${cc_test_SRCS}) - endfunction() function(cc_test_run TARGET_NAME) - if(WITH_TESTING) + if(WITH_TESTING AND NOT "$ENV{CI_SKIP_CPP_TEST}" STREQUAL "ON") set(oneValueArgs "") set(multiValueArgs COMMAND ARGS) cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) diff --git a/paddle/fluid/inference/api/CMakeLists.txt b/paddle/fluid/inference/api/CMakeLists.txt index 82c95ba2c95..c7d947c5803 100755 --- a/paddle/fluid/inference/api/CMakeLists.txt +++ b/paddle/fluid/inference/api/CMakeLists.txt @@ -71,7 +71,7 @@ elseif (WIN32) cc_test(test_analysis_predictor SRCS analysis_predictor_tester.cc DEPS analysis_predictor benchmark ${inference_deps} ARGS --dirname=${WORD2VEC_MODEL_DIR}) endif() -if(WITH_TESTING) +if(WITH_TESTING AND TEST test_api_impl) if(NOT APPLE) set_tests_properties(test_api_impl PROPERTIES TIMEOUT 120) endif() diff --git a/paddle/fluid/inference/tests/api/CMakeLists.txt b/paddle/fluid/inference/tests/api/CMakeLists.txt index f74cd671d6d..60479f806f3 100644 --- a/paddle/fluid/inference/tests/api/CMakeLists.txt +++ b/paddle/fluid/inference/tests/api/CMakeLists.txt @@ -242,10 +242,10 @@ download_result(${ERNIE_INSTALL_DIR} "Ernie_large_result.txt.tar.gz") inference_analysis_test(test_analyzer_ernie_large SRCS analyzer_ernie_tester.cc EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} ARGS --infer_model=${ERNIE_INSTALL_DIR}/model --infer_data=${ERNIE_INSTALL_DIR}/data.txt --refer_result=${ERNIE_INSTALL_DIR}/result.txt --ernie_large=true) -if(NOT WIN32 AND NOT APPLE) +if(NOT WIN32 AND NOT APPLE AND TEST test_analyzer_ernie_large) set_tests_properties(test_analyzer_ernie_large PROPERTIES TIMEOUT 150 LABELS "RUN_TYPE=NIGHTLY") endif() -if (WIN32) +if (WIN32 AND TEST test_analyzer_ernie_large) set_tests_properties(test_analyzer_ernie_large PROPERTIES TIMEOUT 200) endif() @@ -645,6 +645,10 @@ if(WITH_GPU) ARGS --infer_model=${RESNET50_MODEL_DIR}) endif() +if("$ENV{CI_SKIP_CPP_TEST}" STREQUAL "ON") + return() +endif() + if(WITH_GPU AND TENSORRT_FOUND) set_tests_properties(trt_resnext_test PROPERTIES TIMEOUT 300) set_tests_properties(trt_quant_int8_yolov3_r50_test PROPERTIES TIMEOUT 300) -- GitLab