File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Licensed to the Apache Software Foundation (ASF) under one
2+ # or more contributor license agreements. See the NOTICE file
3+ # distributed with this work for additional information
4+ # regarding copyright ownership. The ASF licenses this file
5+ # to you under the Apache License, Version 2.0 (the
6+ # "License"); you may not use this file except in compliance
7+ # with the License. You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing,
12+ # software distributed under the License is distributed on an
13+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+ # KIND, either express or implied. See the License for the
15+ # specific language governing permissions and limitations
16+ # under the License.
17+ #
18+ # Add specific undefined behavior suppressions here if needed
19+ # Format:
20+ # symbol:SymbolName
21+ # src:source_file.cc
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ concurrency:
3030 cancel-in-progress : true
3131
3232jobs :
33- asan -test :
34- name : " ASAN with ${{ matrix.compiler }} on Ubuntu"
33+ sanitizer -test :
34+ name : " Sanitizer with ${{ matrix.compiler }} on Ubuntu"
3535 runs-on : ubuntu-latest
3636 strategy :
3737 fail-fast : false
@@ -58,12 +58,18 @@ jobs:
5858 run : |
5959 mkdir -p build && cd build
6060 cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_UBSAN=ON -DBUILD_ENABLE_AVX512=ON -DBUILD_CPP_ENABLE_METRICS=ON -DBUILD_JAVA=OFF
61- make
61+ cmake --build . --verbose
6262 - name : Run Tests
6363 working-directory : build
6464 env :
65- ASAN_OPTIONS : detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=0 :detect_container_overflow=0
65+ ASAN_OPTIONS : log_path=out.log: detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=1 :detect_container_overflow=0
6666 LSAN_OPTIONS : suppressions=${{ github.workspace }}/.github/lsan-suppressions.txt
67- UBSAN_OPTIONS : print_stacktrace=1
67+ UBSAN_OPTIONS : log_path=out.log:halt_on_error=1: print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
6868 run : |
69- ctest --output-on-failure
69+ ctest -V --output-on-failure
70+ - name : Save the test output
71+ if : always()
72+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
73+ with :
74+ name : test-output
75+ path : " **/out.log*"
Original file line number Diff line number Diff line change @@ -181,15 +181,23 @@ endif()
181181
182182# Configure Undefined Behavior Sanitizer if enabled
183183if (ENABLE_UBSAN)
184- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
185- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr,function -fno-sanitize-recover=all" )
186- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr,function -fno-sanitize-recover=all" )
184+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU| Clang" )
185+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr -fno-sanitize-recover=all" )
186+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize=alignment,vptr -fno-sanitize-recover=all" )
187187 message (STATUS "Undefined Behavior Sanitizer enabled" )
188188 else ()
189189 message (WARNING "Undefined Behavior Sanitizer is only supported for GCC and Clang compilers" )
190190 endif ()
191191endif ()
192192
193+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
194+ if (ENABLE_ASAN OR ENABLE_UBSAN)
195+ set (CMAKE_THREAD_LIBS_INIT "-lpthread" )
196+ set (THREADS_PREFER_PTHREAD_FLAG ON )
197+ message (STATUS "Forcing pthread linking for GCC with sanitizers" )
198+ endif ()
199+ endif ()
200+
193201enable_testing ()
194202
195203INCLUDE (GNUInstallDirs ) # Put it before ThirdpartyToolchain to make CMAKE_INSTALL_LIBDIR available.
You can’t perform that action at this time.
0 commit comments