From dc15a3f497899cea4fd9d86152aadbbf462940d8 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 29 Jan 2019 10:41:20 +0100 Subject: [PATCH] [CMake,Jenkins] Fixed coverage and added to Docker-Debug job. --- Jenkinsfile | 10 +++++----- Tests/CMakeLists.txt | 2 +- scripts/cmake/Coverage.cmake | 34 +++++++++++++++------------------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d8e50df44d0..64509b9bbd9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -191,18 +191,18 @@ pipeline { sh 'git submodule sync' configure { cmakeOptions = - '-DOGS_CPU_ARCHITECTURE=generic ' + '-DOGS_CPU_ARCHITECTURE=generic ' + + '-DOGS_COVERAGE=ON ' config = 'Debug' } build { } - build { target = 'tests' } + build { target = 'testrunner_coverage_cobertura' } } } post { always { - xunit([ - GoogleTest(pattern: 'build/Tests/testrunner.xml') - ]) + xunit([GoogleTest(pattern: 'build/Tests/testrunner.xml')]) + cobertura coberturaReportFile: 'build/*_cobertura.xml' } } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 765ecf36d84..bd6f4f0e773 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -84,7 +84,7 @@ if(OGS_USE_PCH) endif() # Add make-target tests which runs the testrunner -if(IS_CI) +if(IS_CI AND NOT OGS_COVERAGE) set(TESTRUNNER_ADDITIONAL_ARGUMENTS ${TESTRUNNER_ADDITIONAL_ARGUMENTS} --gtest_shuffle --gtest_repeat=3) endif() diff --git a/scripts/cmake/Coverage.cmake b/scripts/cmake/Coverage.cmake index 70e15b298ae..338782428bc 100644 --- a/scripts/cmake/Coverage.cmake +++ b/scripts/cmake/Coverage.cmake @@ -1,39 +1,35 @@ include(CodeCoverage) -APPEND_COVERAGE_COMPILER_FLAGS() +append_coverage_compiler_flags() -set(COVERAGE_EXCLUDES - '/gpfs0/*' - '/usr/*' - '${PROJECT_BINARY_DIR}/*' - '${PROJECT_SOURCE_DIR}/Tests/*' - '${PROJECT_SOURCE_DIR}/ThirdParty/*' +set(COVERAGE_GCOVR_EXCLUDES + ${PROJECT_BINARY_DIR}/.* + Applications/CLI/.* + ProcessLib/.* + .*Tests/.* + ThirdParty/.* ) if(LCOV_PATH AND GENHTML_PATH) - SETUP_TARGET_FOR_COVERAGE( + setup_target_for_coverage_lcov( NAME testrunner_coverage - EXECUTABLE testrunner -j ${PROCESSOR_COUNT} - DEPENDENCIES testrunner + EXECUTABLE ${CMAKE_COMMAND} --build . --target tests ) - SETUP_TARGET_FOR_COVERAGE( + setup_target_for_coverage_lcov( NAME ctest_coverage - EXECUTABLE ctest -E LARGE -j ${PROCESSOR_COUNT} - DEPENDENCIES ogs + EXECUTABLE ${CMAKE_COMMAND} --build . --target ctest-serial ) else() message(STATUS "No lcov coverage report generated because lcov or genhtml was not found.") endif() if(PYTHON_EXECUTABLE) - SETUP_TARGET_FOR_COVERAGE_COBERTURA( + setup_target_for_coverage_gcovr_xml( NAME testrunner_coverage_cobertura - EXECUTABLE testrunner -j ${PROCESSOR_COUNT} - DEPENDENCIES testrunner + EXECUTABLE ${CMAKE_COMMAND} --build . --target tests ) - SETUP_TARGET_FOR_COVERAGE_COBERTURA( + setup_target_for_coverage_gcovr_xml( NAME ctest_coverage_cobertura - EXECUTABLE ctest -E LARGE -j ${PROCESSOR_COUNT} - DEPENDENCIES ogs + EXECUTABLE ${CMAKE_COMMAND} --build . --target ctest-serial ) else() message(STATUS "No cobertura coverage report generated because Python executable was not found.") -- GitLab