Skip to content

Commit a1a3ff3

Browse files
authored
chore: add test workflows for gcc and sanitizer check (#7)
* chore: add test workflows for gcc * chore: add sanitizer test
1 parent 3f03070 commit a1a3ff3

File tree

7 files changed

+129
-22
lines changed

7 files changed

+129
-22
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Test
15+
name: Clang Test
1616

1717
on:
1818
push:
@@ -49,4 +49,4 @@ jobs:
4949
env:
5050
CC: clang
5151
CXX: clang++
52-
run: ci/scripts/build_paimon.sh $(pwd) ON
52+
run: ci/scripts/build_paimon.sh $(pwd)

.github/workflows/gcc_test.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2024-present Alibaba Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Gcc Test
16+
17+
on:
18+
push:
19+
branches:
20+
- '**'
21+
tags:
22+
- '**'
23+
pull_request:
24+
25+
concurrency:
26+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
27+
cancel-in-progress: true
28+
29+
permissions:
30+
contents: read
31+
32+
env:
33+
PAIMON_HOME: /tmp/paimon
34+
35+
jobs:
36+
ubuntu:
37+
name: AMD64 Ubuntu 24.04
38+
runs-on: ubuntu-24.04
39+
timeout-minutes: 120
40+
strategy:
41+
fail-fast: false
42+
steps:
43+
- name: Checkout paimon-cpp
44+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
45+
with:
46+
lfs: true
47+
- name: Build Paimon
48+
shell: bash
49+
env:
50+
CC: gcc-14
51+
CXX: g++-14
52+
run: ci/scripts/build_paimon.sh $(pwd)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2024-present Alibaba Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Test with sanitizer
16+
17+
on:
18+
push:
19+
branches:
20+
- '**'
21+
tags:
22+
- '**'
23+
pull_request:
24+
25+
concurrency:
26+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
27+
cancel-in-progress: true
28+
29+
permissions:
30+
contents: read
31+
32+
env:
33+
PAIMON_HOME: /tmp/paimon
34+
35+
jobs:
36+
ubuntu:
37+
name: AMD64 Ubuntu 24.04
38+
runs-on: ubuntu-24.04
39+
timeout-minutes: 120
40+
strategy:
41+
fail-fast: false
42+
steps:
43+
- name: Checkout paimon-cpp
44+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
45+
with:
46+
lfs: true
47+
- name: Build Paimon
48+
shell: bash
49+
env:
50+
CC: clang
51+
CXX: clang++
52+
run: ci/scripts/build_paimon.sh $(pwd) true

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ option(PAIMON_BUILD_STATIC "Build static library" ON)
4646
option(PAIMON_BUILD_SHARED "Build shared library" ON)
4747
option(PAIMON_BUILD_TESTS "Build tests" OFF)
4848
option(PAIMON_USE_ASAN "Use Address Sanitizer" OFF)
49-
option(PAIMON_USE_TSAN "Use Thread Sanitizer" OFF)
5049
option(PAIMON_USE_UBSAN "Use Undefined Behavior Sanitizer" OFF)
5150
option(PAIMON_ENABLE_AVRO "Whether to enable avro file format" ON)
5251
option(PAIMON_ENABLE_ORC "Whether to enable orc file format" ON)
@@ -331,23 +330,35 @@ if(PAIMON_BUILD_TESTS)
331330
paimon_global_index_static
332331
paimon_local_file_system_static
333332
paimon_mock_file_format_static
333+
-Wl,--no-as-needed
334334
paimon_parquet_file_format_shared
335-
paimon_blob_file_format_shared)
335+
paimon_blob_file_format_shared
336+
-Wl,--as-needed)
336337

337338
if(PAIMON_ENABLE_LANCE)
339+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--no-as-needed)
338340
list(APPEND TEST_STATIC_LINK_LIBS paimon_lance_file_format_shared)
341+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--as-needed)
339342
endif()
340343
if(PAIMON_ENABLE_ORC)
344+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--no-as-needed)
341345
list(APPEND TEST_STATIC_LINK_LIBS paimon_orc_file_format_shared)
346+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--as-needed)
342347
endif()
343348
if(PAIMON_ENABLE_AVRO)
349+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--no-as-needed)
344350
list(APPEND TEST_STATIC_LINK_LIBS paimon_avro_file_format_shared)
351+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--as-needed)
345352
endif()
346353
if(PAIMON_ENABLE_JINDO)
354+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--no-as-needed)
347355
list(APPEND TEST_STATIC_LINK_LIBS paimon_jindo_file_system_shared)
356+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--as-needed)
348357
endif()
349358
if(PAIMON_ENABLE_LUMINA)
359+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--no-as-needed)
350360
list(APPEND TEST_STATIC_LINK_LIBS paimon_lumina_index_shared)
361+
list(APPEND TEST_STATIC_LINK_LIBS -Wl,--as-needed)
351362
endif()
352363

353364
endif()

ci/scripts/build_paimon.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
set -eux
1818

1919
source_dir=${1}
20+
enable_sanitizer=${2:-false}
2021
build_dir=${1}/build
2122

2223
mkdir ${build_dir}
@@ -30,6 +31,13 @@ CMAKE_ARGS=(
3031
"-DPAIMON_ENABLE_JINDO=ON"
3132
)
3233

34+
if [[ "${enable_sanitizer}" == "true" ]]; then
35+
CMAKE_ARGS+=(
36+
"-DPAIMON_USE_ASAN=ON"
37+
"-DPAIMON_USE_UBSAN=ON"
38+
)
39+
fi
40+
3341
cmake "${CMAKE_ARGS[@]}" ${source_dir}
3442
cmake --build . -- -j$(nproc)
3543
ctest --output-on-failure -j $(nproc)

cmake_modules/san-config.cmake

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License. See accompanying LICENSE file.
1212

13-
# Clang does not support using ASAN and TSAN simultaneously.
14-
if("${PAIMON_USE_ASAN}" AND "${PAIMON_USE_TSAN}")
15-
message(SEND_ERROR "Can only enable one of ASAN or TSAN at a time")
16-
endif()
17-
1813
add_library(paimon_sanitizer_flags INTERFACE)
1914

2015
if(PAIMON_USE_ASAN)
@@ -28,17 +23,6 @@ if(PAIMON_USE_ASAN)
2823
endif()
2924
endif()
3025

31-
if(PAIMON_USE_TSAN)
32-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
33-
target_compile_options(paimon_sanitizer_flags INTERFACE -fsanitize=thread
34-
-fno-omit-frame-pointer)
35-
target_link_options(paimon_sanitizer_flags INTERFACE -fsanitize=thread)
36-
message(STATUS "Thread Sanitizer enabled")
37-
else()
38-
message(WARNING "Thread Sanitizer is only supported for GCC and Clang compilers")
39-
endif()
40-
endif()
41-
4226
if(PAIMON_USE_UBSAN)
4327
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
4428
target_compile_options(paimon_sanitizer_flags INTERFACE -fsanitize=undefined

src/paimon/format/orc/orc_input_output_stream_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ TEST(OrcInputOutputStreamTest, TestSimple) {
9797
std::unique_ptr<::orc::ColumnVectorBatch> batch = writer->createRowBatch(batch_size);
9898
auto* struct_batch = dynamic_cast<::orc::StructVectorBatch*>(batch.get());
9999
ASSERT_TRUE(struct_batch);
100-
auto* int_batch = static_cast<::orc::IntVectorBatch*>(struct_batch->fields[0]);
100+
auto* int_batch = dynamic_cast<::orc::LongVectorBatch*>(struct_batch->fields[0]);
101101
ASSERT_TRUE(int_batch);
102102
auto* double_batch = dynamic_cast<::orc::DoubleVectorBatch*>(struct_batch->fields[1]);
103103
ASSERT_TRUE(double_batch);
@@ -159,7 +159,7 @@ TEST(OrcInputOutputStreamTest, TestSimple) {
159159

160160
struct_batch = dynamic_cast<::orc::StructVectorBatch*>(batch.get());
161161
ASSERT_TRUE(struct_batch);
162-
int_batch = static_cast<::orc::IntVectorBatch*>(struct_batch->fields[0]);
162+
int_batch = static_cast<::orc::LongVectorBatch*>(struct_batch->fields[0]);
163163
ASSERT_TRUE(int_batch);
164164
double_batch = dynamic_cast<::orc::DoubleVectorBatch*>(struct_batch->fields[1]);
165165
ASSERT_TRUE(double_batch);

0 commit comments

Comments
 (0)