Skip to content

Commit

Permalink
CI: configure sonarclound coverage paths
Browse files Browse the repository at this point in the history
Define coverage paths s.t. tests and benchmarks are not counted towards
general coverage and line counts, but still analyzed in the test scope.
see: https://docs.sonarcloud.io/advanced-setup/analysis-scope/

Because sonar-projects config does not allow to specify inclusions and
exclusions at the same time, ignore only add benchmarks starting with
bm_ to be able to ignore files starting with bm-nosonar.
  • Loading branch information
wirew0rm authored and RalphSteinhagen committed Oct 14, 2023
1 parent 30c2f75 commit a6603e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ if (ENABLE_TESTING AND UNIX AND NOT APPLE)
EXECUTABLE ctest
EXECUTABLE_ARGS "--output-on-failure"
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_Settings qa_Tags qa_Scheduler qa_thread_pool qa_thread_affinity
EXCLUDE "$CMAKE_BUILD_DIR/*" "concepts/.*" ".*/test/.*")
EXCLUDE "$CMAKE_BUILD_DIR/*")
setup_target_for_coverage_gcovr_html(
NAME coverage_html
EXECUTABLE ctest
EXECUTABLE_ARGS "--output-on-failure"
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_Settings qa_Tags qa_Scheduler qa_thread_pool qa_thread_affinity
EXCLUDE "$CMAKE_BUILD_DIR/*" "concepts/.*" ".*/test/.*")
EXCLUDE "$CMAKE_BUILD_DIR/*")
endif ()
message("Building Tests and benchmarks.")
endif ()
Expand Down
10 changes: 5 additions & 5 deletions core/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ add_gr_benchmark(bm_Buffer)
add_gr_benchmark(bm_HistoryBuffer)
add_gr_benchmark(bm_Profiler)
add_gr_benchmark(bm_Scheduler)
add_gr_benchmark(bm_node_api)
add_gr_benchmark(bm-nosonar_node_api)
add_gr_benchmark(bm_fft)
target_link_libraries(bm_fft PRIVATE gr-fourier)

add_executable(bm_node_api_nosimd bm_node_api.cpp)
append_compiler_flags(bm_node_api_nosimd)
target_compile_options(bm_node_api_nosimd PRIVATE -DDISABLE_SIMD=1)
target_link_libraries(bm_node_api_nosimd PRIVATE gnuradio-options gnuradio-core refl-cpp fmt ut ut-benchmark gr-basic gr-testing)
add_executable(bm-nosonar_node_api_nosimd bm-nosonar_node_api.cpp)
append_compiler_flags(bm-nosonar_node_api_nosimd)
target_compile_options(bm-nosonar_node_api_nosimd PRIVATE -DDISABLE_SIMD=1)
target_link_libraries(bm-nosonar_node_api_nosimd PRIVATE gnuradio-options gnuradio-core refl-cpp fmt ut ut-benchmark gr-basic gr-testing)
File renamed without changes.
8 changes: 5 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ sonar.organization=fair-acc
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

# exclude benchmark which crashes the Analysis
sonar.exclusions=core/benchmarks/bm_node_api.cpp
sonar.coverageReportPaths=/home/runner/work/graph-prototype/build/coverage.xml
sonar.coverageReportPaths=/home/runner/work/graph-prototype/build/coverage.xml
sonar.test=.
# note: only add benchmarks starting with bm_ to be able to exclude bm-nosonar_ files
sonar.exclusions=**/test/**/*,**/benchmarks/*
sonar.test.inclusions=**/test/**/*,**/benchmarks/bm_*

0 comments on commit a6603e7

Please sign in to comment.