wgtmac commented on code in PR #107: URL: https://github.com/apache/iceberg-cpp/pull/107#discussion_r2110912596
########## .github/workflows/sanitizer_test.yml: ########## @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: ASAN and UBSAN Tests + +on: + push: + branches: + - '**' + - '!dependabot/**' + tags: + - '**' + pull_request: + +concurrency: + group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + asan-test: Review Comment: ```suggestion sanitizer-test: ``` ########## cmake_modules/IcebergSanitizer.cmake: ########## @@ -0,0 +1,46 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Sanitize check for address and undefined. Review Comment: ```suggestion ``` I think this is redundant ########## cmake_modules/IcebergSanitizer.cmake: ########## @@ -0,0 +1,46 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Sanitize check for address and undefined. + +if(ICEBERG_ENABLE_ASAN OR ICEBERG_ENABLE_UBSAN) + add_library(iceberg_sanitizer_flags INTERFACE) + set(SANITIZER_FLAGS iceberg_sanitizer_flags) +endif() Review Comment: ```suggestion add_library(iceberg_sanitizer_flags INTERFACE) ``` It is much simpler to make it available at all times even without any flag. ########## cmake_modules/IcebergBuildUtils.cmake: ########## @@ -147,6 +147,11 @@ function(add_iceberg_lib LIB_NAME) "$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>" PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) + if(TARGET ${SANITIZER_FLAGS}) + target_link_libraries(${LIB_NAME}_shared + PRIVATE "$<BUILD_INTERFACE:${SANITIZER_FLAGS}>") + endif() Review Comment: ```suggestion target_link_libraries(${LIB_NAME}_shared PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>") ``` ########## cmake_modules/IcebergBuildUtils.cmake: ########## @@ -202,6 +207,11 @@ function(add_iceberg_lib LIB_NAME) PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>") endif() + if(TARGET ${SANITIZER_FLAGS}) + target_link_libraries(${LIB_NAME}_static + PRIVATE "$<BUILD_INTERFACE:${SANITIZER_FLAGS}>") + endif() Review Comment: ```suggestion target_link_libraries(${LIB_NAME}_static PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>") ``` ########## cmake_modules/IcebergBuildUtils.cmake: ########## @@ -147,6 +147,11 @@ function(add_iceberg_lib LIB_NAME) "$<INSTALL_INTERFACE:${ARG_SHARED_INSTALL_INTERFACE_LIBS}>" PRIVATE ${ARG_SHARED_PRIVATE_LINK_LIBS}) + if(TARGET ${SANITIZER_FLAGS}) + target_link_libraries(${LIB_NAME}_shared + PRIVATE "$<BUILD_INTERFACE:${SANITIZER_FLAGS}>") + endif() Review Comment: It should be visible to downstream targets (e.g. unit tests) as well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org