Skip to content

Commit 3d31be8

Browse files
committed
ci: enable sanitizer
1 parent 3cf5963 commit 3d31be8

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

.github/workflows/sanitizer_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
- name: Run Tests
5151
working-directory: build
5252
env:
53-
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=0:detect_container_overflow=0
53+
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=1:detect_container_overflow=0
5454
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/lsan-suppressions.txt
55-
UBSAN_OPTIONS: log_path=out.log:halt_on_error=0:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
55+
UBSAN_OPTIONS: log_path=out.log:halt_on_error=1:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
5656
run: |
5757
ctest --output-on-failure
5858
- name: Save the test output

cmake_modules/IcebergBuildUtils.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ function(add_iceberg_lib LIB_NAME)
147147
"$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>"
148148
PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS})
149149

150-
target_link_libraries(${LIB_NAME}_shared
151-
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>")
152-
153150
install(TARGETS ${LIB_NAME}_shared
154151
EXPORT iceberg_targets
155152
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
@@ -205,9 +202,6 @@ function(add_iceberg_lib LIB_NAME)
205202
PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>")
206203
endif()
207204

208-
target_link_libraries(${LIB_NAME}_static
209-
PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>")
210-
211205
install(TARGETS ${LIB_NAME}_static
212206
EXPORT iceberg_targets
213207
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}

cmake_modules/IcebergSanitizer.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
add_library(iceberg_sanitizer_flags INTERFACE)
19-
2018
if(ICEBERG_ENABLE_ASAN)
2119
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
22-
target_compile_options(iceberg_sanitizer_flags INTERFACE -fsanitize=address
23-
-fno-omit-frame-pointer)
24-
target_link_options(iceberg_sanitizer_flags INTERFACE -fsanitize=address)
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
2521
message(STATUS "Address Sanitizer enabled")
2622
else()
2723
message(WARNING "Address Sanitizer is only supported for GCC and Clang compilers")
@@ -30,9 +26,7 @@ endif()
3026

3127
if(ICEBERG_ENABLE_UBSAN)
3228
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
33-
target_compile_options(iceberg_sanitizer_flags INTERFACE -fsanitize=undefined
34-
-fno-omit-frame-pointer)
35-
target_link_options(iceberg_sanitizer_flags INTERFACE -fsanitize=undefined)
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
3630
message(STATUS "Undefined Behavior Sanitizer enabled")
3731
else()
3832
message(WARNING "Undefined Behavior Sanitizer is only supported for GCC and Clang compilers"

0 commit comments

Comments
 (0)