Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 130ca61

Browse files
tcm-marcelapavlo
authored andcommitted
Modify coveralls cmake target to skip wrongly created gcov files
* problem occured when including libpg_query into cmake build system * due to property inheritance, gcov files are created for the library target, but their naming doesn't follow the convention which the coveralls target expects
1 parent c83e49f commit 130ca61

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

cmake/Modules/CoverallsGenerateGcov.cmake

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,27 @@ foreach (GCOV_FILE ${ALL_GCOV_FILES})
252252
# ->
253253
# /path/to/project/root/subdir/the_file.c
254254
get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE})
255-
file(RELATIVE_PATH GCOV_SRC_REL_PATH "${PROJECT_ROOT}" "${GCOV_SRC_PATH}")
256255

257-
# Is this in the list of source files?
258-
# TODO: We want to match against relative path filenames from the source file root...
259-
list(FIND COVERAGE_SRCS ${GCOV_SRC_PATH} WAS_FOUND)
256+
# skip if full path is not present
257+
# can happen if files are generated for external libraries
258+
if(IS_ABSOLUTE ${GCOV_SRC_PATH})
259+
file(RELATIVE_PATH GCOV_SRC_REL_PATH "${PROJECT_ROOT}" "${GCOV_SRC_PATH}")
260+
261+
# Is this in the list of source files?
262+
# TODO: We want to match against relative path filenames from the source file root...
263+
list(FIND COVERAGE_SRCS ${GCOV_SRC_PATH} WAS_FOUND)
260264

261-
if (NOT WAS_FOUND EQUAL -1)
262-
message("YES: ${GCOV_FILE}")
263-
list(APPEND GCOV_FILES ${GCOV_FILE})
265+
if (NOT WAS_FOUND EQUAL -1)
266+
message("YES: ${GCOV_FILE}")
267+
list(APPEND GCOV_FILES ${GCOV_FILE})
264268

265-
# We remove it from the list, so we don't bother searching for it again.
266-
# Also files left in COVERAGE_SRCS_REMAINING after this loop ends should
267-
# have coverage data generated from them (no lines are covered).
268-
list(REMOVE_ITEM COVERAGE_SRCS_REMAINING ${GCOV_SRC_PATH})
269-
else()
270-
message("NO: ${GCOV_FILE}")
269+
# We remove it from the list, so we don't bother searching for it again.
270+
# Also files left in COVERAGE_SRCS_REMAINING after this loop ends should
271+
# have coverage data generated from them (no lines are covered).
272+
list(REMOVE_ITEM COVERAGE_SRCS_REMAINING ${GCOV_SRC_PATH})
273+
else()
274+
message("NO: ${GCOV_FILE}")
275+
endif()
271276
endif()
272277
endforeach()
273278

0 commit comments

Comments
 (0)