Skip to content

Commit

Permalink
Test coverage (Exiv2#1073)
Browse files Browse the repository at this point in the history
* Compiles and runs

* Created gcovr reports in separate directory

* Improved style and degree of coverage

* Added error check for existence of gcovr

* CI test fixes
  • Loading branch information
emye authored and 1div0 committed Jun 7, 2020
1 parent 98621d6 commit 6ed6374
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ project(exiv2
include(cmake/mainSetup.cmake REQUIRED)
include(CTest)

include(cmake/gcovr.cmake REQUIRED)

# options and their default values
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
Expand Down
15 changes: 15 additions & 0 deletions cmake/gcovr.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if(BUILD_WITH_COVERAGE)

find_program (GCOVR gcovr)

if(GCOVR)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/coverage_output )
add_custom_command(OUTPUT _run_gcovr_parser
POST_BUILD
COMMAND ${GCOVR} --root ${CMAKE_SOURCE_DIR} --object-dir=${CMAKE_BINARY_DIR} --html --html-details -o coverage_output/coverage.html
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_custom_target (coverage DEPENDS _run_gcovr_parser)
endif()

endif(BUILD_WITH_COVERAGE)

0 comments on commit 6ed6374

Please sign in to comment.