Add a make coverage target to merge all other coverages, and upload to codecov

This commit is contained in:
louiz’
2016-12-10 20:11:30 +01:00
parent 3961df3d54
commit 4860201d8c
3 changed files with 20 additions and 13 deletions
+5 -7
View File
@@ -89,21 +89,19 @@ build:rpm:
script: script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL} - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc || echo 1) - make biboumi -j$(nproc || echo 1)
- make check - make coverage_check -j$(nproc || echo 1)
- make coverage_e2e -j$(nproc || echo 1)
- make coverage - make coverage
- mkdir tests_outputs && pushd tests_outputs && make coverage_e2e -j$(nproc || echo 1) -C .. && popd - bash <(curl -s https://codecov.io/bash)
- if [ ! -z $COVERALLS_TOKEN -a ! -z $UPLOAD_TO_COVERALLS ]; then coveralls-lcov --repo-token $COVERALLS_TOKEN coverage_e2e.info.cleaned; fi
artifacts: artifacts:
paths: paths:
- build/coverage/ - build/coverage_test_suite/
- build/coverage_e2e/ - build/coverage_e2e/
- build/tests_outputs/ - build/coverage_total/
when: always when: always
name: $CI_PROJECT_NAME-test-$CI_BUILD_ID name: $CI_PROJECT_NAME-test-$CI_BUILD_ID
test:debian: test:debian:
variables:
UPLOAD_TO_COVERALLS: "true"
image: biboumi-test-debian:latest image: biboumi-test-debian:latest
<<: *basic_test <<: *basic_test
+13 -4
View File
@@ -241,14 +241,23 @@ add_custom_target(e2e_valgrind COMMAND "E2E_BIBOUMI_SUPP_DIR=${CMAKE_CURRENT_SOU
# #
if(CMAKE_BUILD_TYPE MATCHES Debug) if(CMAKE_BUILD_TYPE MATCHES Debug)
include(CodeCoverage) include(CodeCoverage)
SETUP_TARGET_FOR_COVERAGE(coverage SETUP_TARGET_FOR_COVERAGE(coverage_check
test_suite make
coverage coverage_test_suite
) check)
SETUP_TARGET_FOR_COVERAGE(coverage_e2e SETUP_TARGET_FOR_COVERAGE(coverage_e2e
make make
coverage_e2e coverage_e2e
e2e) e2e)
ADD_CUSTOM_TARGET(coverage
COMMAND ${LCOV_PATH} -a coverage_e2e.info -a coverage_test_suite.info -o coverage_total.info
COMMAND ${GENHTML_PATH} -o coverage_total coverage_total.info
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif() endif()
# #
+2 -2
View File
@@ -157,10 +157,10 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
# Remove information about source files that are not part of # Remove information about source files that are not part of
# the test (system file, external libraries, etc) # the test (system file, external libraries, etc)
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info.cleaned -q COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info -q
# Generate the report # Generate the report
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."