This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new dae7efccf ORC-1964: [CI] Fix CI ubsan-test with GNU
dae7efccf is described below
commit dae7efccf093e6f051cf1d3a136c8b6935462b97
Author: luffy-zh <[email protected]>
AuthorDate: Thu Aug 21 13:42:30 2025 +0800
ORC-1964: [CI] Fix CI ubsan-test with GNU
### What changes were proposed in this pull request?
Forcing pthread linking for GCC with sanitizers.
### Why are the changes needed?
Fix the CI usbsan-test failure as reported in
https://github.com/apache/orc/actions/runs/16258126145/job/45898042155.
### How was this patch tested?
Test it locally.
### Was this patch authored or co-authored using generative AI tooling?
NO.
Closes #2342 from luffy-zh/ORC-1964.
Lead-authored-by: luffy-zh <[email protected]>
Co-authored-by: Hao Zou <[email protected]>
Co-authored-by: Gang Wu <[email protected]>
Signed-off-by: Gang Wu <[email protected]>
---
.github/ubsan-suppressions.txt | 21 +++++++++++++++++++++
.../workflows/{asan_test.yml => sanitizer_test.yml} | 18 ++++++++++++------
CMakeLists.txt | 14 +++++++++++---
3 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/.github/ubsan-suppressions.txt b/.github/ubsan-suppressions.txt
new file mode 100644
index 000000000..8987a4314
--- /dev/null
+++ b/.github/ubsan-suppressions.txt
@@ -0,0 +1,21 @@
+# 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.
+#
+# Add specific undefined behavior suppressions here if needed
+# Format:
+# symbol:SymbolName
+# src:source_file.cc
\ No newline at end of file
diff --git a/.github/workflows/asan_test.yml
b/.github/workflows/sanitizer_test.yml
similarity index 76%
rename from .github/workflows/asan_test.yml
rename to .github/workflows/sanitizer_test.yml
index a02522f9e..6eee91a55 100644
--- a/.github/workflows/asan_test.yml
+++ b/.github/workflows/sanitizer_test.yml
@@ -30,8 +30,8 @@ concurrency:
cancel-in-progress: true
jobs:
- asan-test:
- name: "ASAN with ${{ matrix.compiler }} on Ubuntu"
+ sanitizer-test:
+ name: "Sanitizer with ${{ matrix.compiler }} on Ubuntu"
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -58,12 +58,18 @@ jobs:
run: |
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_UBSAN=ON
-DBUILD_ENABLE_AVX512=ON -DBUILD_CPP_ENABLE_METRICS=ON -DBUILD_JAVA=OFF
- make
+ cmake --build . --verbose
- name: Run Tests
working-directory: build
env:
- ASAN_OPTIONS:
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: print_stacktrace=1
+ 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
+ ctest -V --output-on-failure
+ - name: Save the test output
+ if: always()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #
v4.6.2
+ with:
+ name: test-output
+ path: "**/out.log*"
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 421f92748..6c5575d22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -181,15 +181,23 @@ endif()
# Configure Undefined Behavior Sanitizer if enabled
if (ENABLE_UBSAN)
- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined
-fno-sanitize=alignment,vptr,function -fno-sanitize-recover=all")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined
-fno-sanitize=alignment,vptr,function -fno-sanitize-recover=all")
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined
-fno-sanitize=alignment,vptr -fno-sanitize-recover=all")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined
-fno-sanitize=alignment,vptr -fno-sanitize-recover=all")
message(STATUS "Undefined Behavior Sanitizer enabled")
else()
message(WARNING "Undefined Behavior Sanitizer is only supported for GCC
and Clang compilers")
endif()
endif()
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if (ENABLE_ASAN OR ENABLE_UBSAN)
+ set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ message(STATUS "Forcing pthread linking for GCC with sanitizers")
+ endif()
+endif()
+
enable_testing()
INCLUDE(GNUInstallDirs) # Put it before ThirdpartyToolchain to make
CMAKE_INSTALL_LIBDIR available.