Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 27b1e853 authored by hhakim's avatar hhakim
Browse files

Add C++ ctest coverage with gcovr in ctest ci job.

parent 98725a4a
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,11 @@ stages:
ctest:
variables: {SLOW_TESTS: "OFF", BUILD_MULTITHREAD: "ON"} # the CDashConfScript is able to retrieve OpenMP_gomp_LIBRARY and OpenMP_INC_DIR from environment (it's necessary on macOS, so the runner's env. must be configured)
coverage: '/Coverage: \d+\.\d+\%/'
script:
- ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml
- mkdir ctest_coverage && gcovr -r ./src/ ./build_* --html-details ctest_coverage/ctest_coverage.html
- 'echo Coverage: $(grep -A 3 Lines: ctest_coverage/index.html | tail -1 | sed -e "s/[^[:digit:]]\+//;s/[^%]\+$//")'
- misc/continuous_integration/jobs/junit_html_report.sh cpp_test_report
- if grep -B 1 'Outcome:.*Failed' $(ls build*/cpp_test_report.html | tail -1) | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else echo "all tests passed"; exit 0; fi
except:
......
......@@ -491,6 +491,12 @@ else()
message(STATUS "Failed to determine the compiler ${CMAKE_CXX_COMPILER} C++11 flag.")
endif()
if(BUILD_TESTING)
# coverage flags (for gcov and gcovr)
# we don't disable optimization because many tests would be too slow
# unfortunately the coverage measure should be less precise
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" CACHE STRING "compile flags" FORCE)
endif()
if(BUILD_MULTITHREAD)
......
......@@ -18,9 +18,6 @@ int main(int argc, char* argv[])
/* initilisation of the factors of the Faust */
// factor 1
MatDense<FPP,Cpu>* M;
MatDense<FPP,Cpu> M_copy;
M = MatDense<FPP,Cpu>::randMat(dim1,dim2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment