Skip to content

Commit

Permalink
see if gcov and clang versions match (#150)
Browse files Browse the repository at this point in the history
* see if gcov and clang versions match

* maybe we should be using lcov... since we apt-get it

* whitespace

* what version is llvm-cov?

* use llvm-cov

* llvm-cov gcov

* remove cov version checks
  • Loading branch information
gonsie authored and caitlinross committed May 11, 2019
1 parent 2f10a73 commit d8be7e4
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions core/cmake/CoverallsGenerateGcov.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#
# Example for running as standalone CMake script from the command line:
# (Note it is important the -P is at the end...)
# $ cmake -DCOV_PATH=$(pwd)
# -DCOVERAGE_SRCS="catcierge_rfid.c;catcierge_timer.c"
# $ cmake -DCOV_PATH=$(pwd)
# -DCOVERAGE_SRCS="catcierge_rfid.c;catcierge_timer.c"
# -P ../cmake/CoverallsGcovUpload.cmake
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
Expand Down Expand Up @@ -65,7 +65,8 @@ endif()
# CMake list format.
string(REGEX REPLACE "\\*" ";" COVERAGE_SRCS ${COVERAGE_SRCS})

find_program(GCOV_EXECUTABLE gcov)
find_program(GCOV_EXECUTABLE llvm-cov)
message("Found ${GCOV_EXECUTABLE}")

if (NOT GCOV_EXECUTABLE)
message(FATAL_ERROR "gcov not found! Aborting...")
Expand Down Expand Up @@ -121,9 +122,9 @@ endif()
#
macro(get_source_path_from_gcov_filename _SRC_FILENAME _GCOV_FILENAME)

# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# #path#to#project#root#subdir#the_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# #path#to#project#root#subdir#the_file.c.gcov
get_filename_component(_GCOV_FILENAME_WEXT ${_GCOV_FILENAME} NAME)

# #path#to#project#root#subdir#the_file.c.gcov -> /path/to/project/root/subdir/the_file.c
Expand Down Expand Up @@ -161,7 +162,7 @@ foreach(GCDA ${GCDA_FILES})
# If -p is not specified then the file is named only "the_file.c.gcov"
#
execute_process(
COMMAND ${GCOV_EXECUTABLE} -p -o ${GCDA_DIR} ${GCDA}
COMMAND ${GCOV_EXECUTABLE} gcov -p -o ${GCDA_DIR} ${GCDA}
WORKING_DIRECTORY ${COV_PATH}
)
endforeach()
Expand Down Expand Up @@ -191,9 +192,9 @@ file(GLOB ALL_GCOV_FILES ${COV_PATH}/*.gcov)
# ALL_GCOV_FILES =
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# /path/to/project/root/build/#path#to#project#root#subdir#other_file.c.gcov
#
#
# Result should be:
# GCOV_FILES =
# GCOV_FILES =
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
#
set(GCOV_FILES "")
Expand All @@ -206,9 +207,9 @@ set(COVERAGE_SRCS_REMAINING ${COVERAGE_SRCS})
foreach (GCOV_FILE ${ALL_GCOV_FILES})

#
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# /path/to/project/root/subdir/the_file.c
# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
# ->
# /path/to/project/root/subdir/the_file.c
get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE})

# Is this in the list of source files?
Expand Down Expand Up @@ -306,8 +307,8 @@ foreach (GCOV_FILE ${GCOV_FILES})
# Example of what we're parsing:
# Hitcount |Line | Source
# " 8: 26: if (!allowed || (strlen(allowed) == 0))"
string(REGEX REPLACE
"^([^:]*):([^:]*):(.*)$"
string(REGEX REPLACE
"^([^:]*):([^:]*):(.*)$"
"\\1;\\2;\\3"
RES
"${GCOV_LINE}")
Expand Down Expand Up @@ -344,7 +345,7 @@ foreach (GCOV_FILE ${GCOV_FILES})

# Lines with 0 line numbers are metadata and can be ignored.
if (NOT ${LINE} EQUAL 0)

if (DO_SKIP)
set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}null, ")
else()
Expand Down Expand Up @@ -424,7 +425,6 @@ string(CONFIGURE ${JSON_TEMPLATE} JSON)

file(WRITE "${COVERALLS_OUTPUT_FILE}" "${JSON}")
message("###########################################################################")
message("Generated coveralls JSON containing coverage data:")
message("Generated coveralls JSON containing coverage data:")
message("${COVERALLS_OUTPUT_FILE}")
message("###########################################################################")

0 comments on commit d8be7e4

Please sign in to comment.