mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
Simplify code coverage implementation
This commit is contained in:
parent
074238e9f4
commit
8758a2bd04
5 changed files with 30 additions and 196 deletions
|
|
@ -4,4 +4,19 @@ add_subdirectory(common)
|
|||
|
||||
add_custom_target(check
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/test/runner)
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/test/runner "${CMAKE_BINARY_DIR}")
|
||||
|
||||
if(enable-coverage)
|
||||
find_program(GCOV_PATH gcov)
|
||||
find_program(LCOV_PATH lcov)
|
||||
find_program(GENHTML_PATH genhtml)
|
||||
if(NOT GCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
|
||||
endif()
|
||||
if(NOT LCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
|
||||
endif()
|
||||
if(NOT GENHTML_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
13
test/runner
13
test/runner
|
|
@ -8,4 +8,17 @@ do
|
|||
ret+=$?
|
||||
done
|
||||
|
||||
if grep 'enable-coverage:BOOL=YES' "$1/CMakeCache.txt"
|
||||
then
|
||||
echo "Generating coverage reports"
|
||||
rm -rf "$1/coverage"
|
||||
mkdir "$1/coverage"
|
||||
lcov --directory "$1" \
|
||||
--capture \
|
||||
--output-file "$1/coverage/lcov.info"
|
||||
lcov --remove "$1/coverage/lcov.info" 'test/*' '/usr/*' \
|
||||
--output-file "$1/coverage/lcov.info.clean"
|
||||
genhtml -o "$1/coverage/" "$1/coverage/lcov.info.clean"
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue