From bd971922744a5f42c1eafad68b9c393d98fc4207 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Mon, 18 Jan 2021 15:12:32 +0800 Subject: [PATCH] if pybind.cc changed, generate total report, test=develop (#30514) --- cmake/coveralls.cmake | 5 ++++- cmake/generic.cmake | 3 ++- paddle/fluid/pybind/pybind.cc | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/coveralls.cmake b/cmake/coveralls.cmake index f7da3560f7..598754bc9e 100644 --- a/cmake/coveralls.cmake +++ b/cmake/coveralls.cmake @@ -63,7 +63,10 @@ endfunction() if(WITH_COVERAGE) if (WITH_INCREMENTAL_COVERAGE) - if (NOT ("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "")) + # if *.h changed, generate coverage report totaly. + # if pybind.cc changed, generate coverage report totaly. + # Because if pybind.cc add '-g -O0 -fprofile-arcs -ftest-coverage' only, some testcase will fail. + if ( (NOT ("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "")) OR ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" MATCHES "pybind.cc") ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") endif() diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 391f60ab56..363803bb6b 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -268,7 +268,8 @@ endfunction(merge_static_libs) function(check_coverage_opt TARGET_NAME SRCS) if(WITH_COVERAGE AND WITH_INCREMENTAL_COVERAGE) - if ("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "") + # if pybind.cc add '-g -O0 -fprofile-arcs -ftest-coverage' only, some testcase will fail. + if ("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "" AND (NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" MATCHES "pybind.cc"))) if (NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" STREQUAL "")) string(REPLACE "," ";" CC_FILE_LIST $ENV{PADDLE_GIT_DIFF_CC_FILE}) set(use_coverage_opt FALSE) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index b66dd17bbc..9dcd2f4e5c 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -117,6 +117,7 @@ DECLARE_bool(use_mkldnn); // disable auto conversion to list in Python PYBIND11_MAKE_OPAQUE(paddle::framework::LoDTensorArray); + PYBIND11_MAKE_OPAQUE(paddle::framework::FetchUnmergedList); PYBIND11_MAKE_OPAQUE(paddle::framework::FetchList); PYBIND11_MAKE_OPAQUE(paddle::framework::FetchType); -- GitLab