mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 00:20:47 +00:00
Fix multiple deviations from configure.py's coverage mode: - Remove -fprofile-list from CMAKE_CXX_FLAGS_COVERAGE. That flag belongs in COVERAGE_INST_FLAGS applied to other modes, not to coverage mode itself. - Replace incorrect defines (DEBUG, SANITIZE, DEBUG_LSA_SANITIZER, SCYLLA_ENABLE_ERROR_INJECTION) with the correct Seastar debug defines (SEASTAR_DEBUG, SEASTAR_DEFAULT_ALLOCATOR, etc.) that configure.py's pkg-config query produces for coverage mode. - Add sanitizer and stack-clash-protection compile flags for Coverage config, matching the flags that Seastar's pkg-config --cflags output includes for debug builds. - Change CMAKE_STATIC_LINKER_FLAGS_COVERAGE to CMAKE_EXE_LINKER_FLAGS_COVERAGE. Coverage flags need to reach the executable linker, not the static archiver.
41 lines
1.3 KiB
CMake
41 lines
1.3 KiB
CMake
set(CMAKE_CXX_FLAGS_COVERAGE
|
|
"-fprofile-instr-generate -fcoverage-mapping"
|
|
CACHE
|
|
INTERNAL
|
|
"")
|
|
update_build_flags(Coverage
|
|
WITH_DEBUG_INFO
|
|
OPTIMIZATION_LEVEL "g")
|
|
|
|
set(scylla_build_mode_Coverage "coverage")
|
|
|
|
# Coverage mode sets cmake_build_type='Debug' for Seastar
|
|
# (configure.py:515), so Seastar's pkg-config --cflags output
|
|
# (configure.py:2252-2267, queried at configure.py:3039) includes debug
|
|
# defines, sanitizer compile flags, and -fstack-clash-protection.
|
|
# Seastar's CMake generator expressions only activate these for
|
|
# Debug/Sanitize configs, so we add them explicitly for Coverage.
|
|
set(Seastar_DEFINITIONS_COVERAGE
|
|
SCYLLA_BUILD_MODE=${scylla_build_mode_Coverage}
|
|
SEASTAR_DEBUG
|
|
SEASTAR_DEFAULT_ALLOCATOR
|
|
SEASTAR_SHUFFLE_TASK_QUEUE
|
|
SEASTAR_DEBUG_SHARED_PTR
|
|
SEASTAR_DEBUG_PROMISE
|
|
SEASTAR_TYPE_ERASE_MORE)
|
|
foreach(definition ${Seastar_DEFINITIONS_COVERAGE})
|
|
add_compile_definitions(
|
|
$<$<CONFIG:Coverage>:${definition}>)
|
|
endforeach()
|
|
|
|
add_compile_options(
|
|
$<$<CONFIG:Coverage>:-fsanitize=address>
|
|
$<$<CONFIG:Coverage>:-fsanitize=undefined>
|
|
$<$<CONFIG:Coverage>:-fsanitize=vptr>
|
|
$<$<CONFIG:Coverage>:-fstack-clash-protection>)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
|
"-fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
maybe_limit_stack_usage_in_KB(40 Coverage)
|