未验证 提交 dbbfbccd 编写于 作者: W wanghuancoder 提交者: GitHub

[cherry pick]if pybind.cc changed, generate total report (#30557)

* if pybind.cc changed, generate total report
上级 40b3e752
...@@ -62,7 +62,15 @@ function(code_coverage _COVERAGE_SRCS _COVERALLS_UPLOAD _CMAKE_SCRIPT_PATH) ...@@ -62,7 +62,15 @@ function(code_coverage _COVERAGE_SRCS _COVERALLS_UPLOAD _CMAKE_SCRIPT_PATH)
endfunction() endfunction()
if(WITH_COVERAGE) if(WITH_COVERAGE)
if (NOT ("$ENV{PADDLE_GIT_DIFF_H_FILE}" STREQUAL "")) if (WITH_INCREMENTAL_COVERAGE)
# 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()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") 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") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
endif() endif()
......
...@@ -267,8 +267,9 @@ function(merge_static_libs TARGET_NAME) ...@@ -267,8 +267,9 @@ function(merge_static_libs TARGET_NAME)
endfunction(merge_static_libs) endfunction(merge_static_libs)
function(check_coverage_opt TARGET_NAME SRCS) function(check_coverage_opt TARGET_NAME SRCS)
if(WITH_COVERAGE) 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 "")) if (NOT ("$ENV{PADDLE_GIT_DIFF_CC_FILE}" STREQUAL ""))
string(REPLACE "," ";" CC_FILE_LIST $ENV{PADDLE_GIT_DIFF_CC_FILE}) string(REPLACE "," ";" CC_FILE_LIST $ENV{PADDLE_GIT_DIFF_CC_FILE})
set(use_coverage_opt FALSE) set(use_coverage_opt FALSE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册