Skip to content

ci: enable sanitizer #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/sanitizer_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
- name: Run Tests
working-directory: build
env:
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=0:detect_container_overflow=0
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=1:detect_container_overflow=0
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/lsan-suppressions.txt
UBSAN_OPTIONS: log_path=out.log:halt_on_error=0:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
UBSAN_OPTIONS: log_path=out.log:halt_on_error=1:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
run: |
ctest --output-on-failure
- name: Save the test output
Expand Down
6 changes: 0 additions & 6 deletions cmake_modules/IcebergBuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ function(add_iceberg_lib LIB_NAME)
"$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>"
PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS})

target_link_libraries(${LIB_NAME}_shared
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>")

install(TARGETS ${LIB_NAME}_shared
EXPORT iceberg_targets
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
Expand Down Expand Up @@ -205,9 +202,6 @@ function(add_iceberg_lib LIB_NAME)
PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>")
endif()

target_link_libraries(${LIB_NAME}_static
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>")

install(TARGETS ${LIB_NAME}_static
EXPORT iceberg_targets
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
Expand Down
10 changes: 2 additions & 8 deletions cmake_modules/IcebergSanitizer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@
# specific language governing permissions and limitations
# under the License.

add_library(iceberg_sanitizer_flags INTERFACE)

if(ICEBERG_ENABLE_ASAN)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(iceberg_sanitizer_flags INTERFACE -fsanitize=address
-fno-omit-frame-pointer)
target_link_options(iceberg_sanitizer_flags INTERFACE -fsanitize=address)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
message(STATUS "Address Sanitizer enabled")
else()
message(WARNING "Address Sanitizer is only supported for GCC and Clang compilers")
Expand All @@ -30,9 +26,7 @@ endif()

if(ICEBERG_ENABLE_UBSAN)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(iceberg_sanitizer_flags INTERFACE -fsanitize=undefined
-fno-omit-frame-pointer)
target_link_options(iceberg_sanitizer_flags INTERFACE -fsanitize=undefined)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
message(STATUS "Undefined Behavior Sanitizer enabled")
else()
message(WARNING "Undefined Behavior Sanitizer is only supported for GCC and Clang compilers"
Expand Down
Loading