diff options
author | louiz’ <louiz@louiz.org> | 2016-10-15 01:55:39 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-10-15 01:55:39 +0200 |
commit | ef36a769a51bdb244570b8452a83dd4658a29079 (patch) | |
tree | 7cda5b38cd2962d4fe4f73d636a2a1da9f13e330 /cmake | |
parent | 501a6f26614116e70cdbb1c9633aeefd0a7d5399 (diff) | |
download | biboumi-ef36a769a51bdb244570b8452a83dd4658a29079.tar.gz biboumi-ef36a769a51bdb244570b8452a83dd4658a29079.tar.bz2 biboumi-ef36a769a51bdb244570b8452a83dd4658a29079.tar.xz biboumi-ef36a769a51bdb244570b8452a83dd4658a29079.zip |
Fix the indent in the coverage.cmake file
[skip-ci]
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/CodeCoverage.cmake | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/cmake/Modules/CodeCoverage.cmake b/cmake/Modules/CodeCoverage.cmake index 4ff5851..c07a3df 100644 --- a/cmake/Modules/CodeCoverage.cmake +++ b/cmake/Modules/CodeCoverage.cmake @@ -47,23 +47,23 @@ # # 3. Set compiler flags to turn off optimization and enable coverage: # SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") -# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") +# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") # # 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target # which runs your test executable and produces a lcov code coverage report: # Example: -# SETUP_TARGET_FOR_COVERAGE( -# my_coverage_target # Name for custom target. -# test_driver # Name of the test driver executable that runs the tests. -# # NOTE! This should always have a ZERO as exit code -# # otherwise the coverage generation will not complete. -# coverage # Name of output directory. -# ) +# SETUP_TARGET_FOR_COVERAGE( +# my_coverage_target # Name for custom target. +# test_driver # Name of the test driver executable that runs the tests. +# # NOTE! This should always have a ZERO as exit code +# # otherwise the coverage generation will not complete. +# coverage # Name of output directory. +# ) # # 4. Build a Debug build: -# cmake -DCMAKE_BUILD_TYPE=Debug .. -# make -# make my_coverage_target +# cmake -DCMAKE_BUILD_TYPE=Debug .. +# make +# make my_coverage_target # # @@ -76,9 +76,9 @@ FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) # Display an error when the target is called. If no error is found, this # function will be overridden by the real one later in this file FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) - ADD_CUSTOM_TARGET(${_targetname} + ADD_CUSTOM_TARGET(${_targetname} COMMAND echo "Coverage is not available: ${ERROR_MSG}" - ) + ) ENDFUNCTION() IF(NOT GCOV_PATH) @@ -130,50 +130,50 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests. -# MUST return ZERO always, even on errors. -# If not, no coverage report will be created! +# MUST return ZERO always, even on errors. +# If not, no coverage report will be created! # Param _outputname lcov output is generated as _outputname.info # HTML report is generated in _outputname/index.html # Optional fifth parameter is passed as arguments to _testrunner # Pass them in list form, e.g.: "-j;2" for -j 2 FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) - # Setup target - ADD_CUSTOM_TARGET(${_targetname} + # Setup target + ADD_CUSTOM_TARGET(${_targetname} - # Cleanup lcov - COMMAND ${LCOV_PATH} --directory . --zerocounters + # Cleanup lcov + COMMAND ${LCOV_PATH} --directory . --zerocounters - # Create baseline coverage data file - COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q + # Create baseline coverage data file + COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q - # Run tests - COMMAND ${_testrunner} ${ARGV3} + # Run tests + COMMAND ${_testrunner} ${ARGV3} - # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q - # Combine the baseline and the test data - COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q + # Capturing lcov counters and generating report + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q + # Combine the baseline and the test data + COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q - # Remove information about source files that are not part of - # the test (system file, external libraries, etc) - COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info.cleaned -q + # Remove information about source files that are not part of + # the test (system file, external libraries, etc) + COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info.cleaned -q - # Generate the report - COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned + # Generate the report + COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned - # Clean the temporary files we created - COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned + # Clean the temporary files we created + COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." - ) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." + ) - # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; - COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." - ) + # Show info where to find the report + ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + COMMAND ; + COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." + ) ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE @@ -184,30 +184,30 @@ ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE # Pass them in list form, e.g.: "-j;2" for -j 2 FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) - IF(NOT PYTHON_EXECUTABLE) - MESSAGE(FATAL_ERROR "Python not found! Aborting...") - ENDIF() # NOT PYTHON_EXECUTABLE + IF(NOT PYTHON_EXECUTABLE) + MESSAGE(FATAL_ERROR "Python not found! Aborting...") + ENDIF() # NOT PYTHON_EXECUTABLE - IF(NOT GCOVR_PATH) - MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") - ENDIF() # NOT GCOVR_PATH + IF(NOT GCOVR_PATH) + MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") + ENDIF() # NOT GCOVR_PATH MARK_AS_ADVANCED(GCOVR_PATH) - ADD_CUSTOM_TARGET(${_targetname} + ADD_CUSTOM_TARGET(${_targetname} - # Run tests - ${_testrunner} ${ARGV3} + # Run tests + ${_testrunner} ${ARGV3} - # Running gcovr - COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Running gcovr to produce Cobertura code coverage report." - ) + # Running gcovr + COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Running gcovr to produce Cobertura code coverage report." + ) - # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; - COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." - ) + # Show info where to find the report + ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + COMMAND ; + COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." + ) ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA |