mirror of
https://github.com/apache/doris.git
synced 2026-11-04 07:31:17 +00:00
[env](test) add ubsan content to the compilation options in asan (#36195)
This commit is contained in:
1 parent
649f9bc683
commit
b73a5f17a9
4 files changed
+51
-41
No files matched your search
+6
-2
@@ -382,8 +382,10 @@ endif()
|
||||
# -O3: Enable all compiler optimizations
|
||||
# -DNDEBUG: Turn off dchecks/asserts/debug only code.
|
||||
set(CXX_FLAGS_RELEASE "${CXX_GCC_FLAGS} -O3 -DNDEBUG")
|
||||
set(CXX_FLAGS_ASAN "${CXX_GCC_FLAGS} -O0 -fsanitize=address -DADDRESS_SANITIZER")
|
||||
set(CXX_FLAGS_ASAN "${CXX_GCC_FLAGS} -O0 -fsanitize=address -fsanitize=undefined -fno-strict-aliasing -fno-sanitize=alignment,signed-integer-overflow,float-cast-overflow -DUNDEFINED_BEHAVIOR_SANITIZER -DADDRESS_SANITIZER")
|
||||
set(CXX_FLAGS_LSAN "${CXX_GCC_FLAGS} -O0 -fsanitize=leak -DLEAK_SANITIZER")
|
||||
## Use for BE-UT
|
||||
set(CXX_FLAGS_ASAN_UT "${CXX_GCC_FLAGS} -O0 -fsanitize=address -DADDRESS_SANITIZER")
|
||||
|
||||
# Set the flags to the undefined behavior sanitizer, also known as "ubsan"
|
||||
# Turn on sanitizer and debug symbols to get stack traces:
|
||||
@@ -408,6 +410,8 @@ elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "UBSAN")
|
||||
set(CMAKE_CXX_FLAGS "${CXX_FLAGS_UBSAN}")
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "TSAN")
|
||||
set(CMAKE_CXX_FLAGS "${CXX_FLAGS_TSAN}")
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN_UT")
|
||||
set(CMAKE_CXX_FLAGS "${CXX_FLAGS_ASAN_UT}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
@@ -629,7 +633,7 @@ endif ()
|
||||
# Add sanitize static link flags
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||
set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} ${MALLOCLIB})
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN")
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "ASAN" OR "${CMAKE_BUILD_TYPE}" STREQUAL "ASAN_UT")
|
||||
set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} ${ASAN_LIBS})
|
||||
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "LSAN")
|
||||
set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} ${LSAN_LIBS})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[null]
|
||||
|
||||
-- !int_2 --
|
||||
[13, 12]
|
||||
[12, 13]
|
||||
|
||||
-- !int_3 --
|
||||
[]
|
||||
@@ -12,13 +12,13 @@
|
||||
[null]
|
||||
|
||||
-- !int_5 --
|
||||
[7, 6]
|
||||
[6, 7]
|
||||
|
||||
-- !int_6 --
|
||||
[null]
|
||||
|
||||
-- !int_7 --
|
||||
[null, 13, 12]
|
||||
[null, 12, 13]
|
||||
|
||||
-- !int_8 --
|
||||
[]
|
||||
@@ -61,17 +61,17 @@
|
||||
|
||||
-- !groupby_1 --
|
||||
0 [0]
|
||||
1 [4, 1, 5, 2, 3]
|
||||
1 [1, 2, 3, 4, 5]
|
||||
|
||||
-- !groupby_2 --
|
||||
18 ["c", "e", "b", "d", "a", "f"]
|
||||
19 ["c", "ff", "cc", "bb", "f", "aa", "dd", "b", "d", "a"]
|
||||
18 ["a", "b", "c", "d", "e", "f"]
|
||||
19 ["a", "aa", "b", "bb", "c", "cc", "d", "dd", "f", "ff"]
|
||||
20 [null, "a"]
|
||||
21 [null]
|
||||
22 ["x", "y"]
|
||||
|
||||
-- !groupby_3 --
|
||||
18 ["c", "e", "b", "d", "a", "f"]
|
||||
18 ["a", "b", "c", "d", "e", "f"]
|
||||
|
||||
-- !notnull_1 --
|
||||
[]
|
||||
@@ -80,10 +80,10 @@
|
||||
[] []
|
||||
|
||||
-- !notnull_3 --
|
||||
[7.7, 6.6]
|
||||
[6.6, 7.7]
|
||||
|
||||
-- !notnull_4 --
|
||||
["c", "b", "d", "a", "f"]
|
||||
["a", "b", "c", "d", "f"]
|
||||
|
||||
-- !notnull_5 --
|
||||
[] [] []
|
||||
|
||||
@@ -48,29 +48,29 @@ suite("group_array_intersect") {
|
||||
sql """INSERT INTO `group_array_intersect_test`(id, c_array_bigint) VALUES (23, [1234567890123456]), (24, [1234567890123456, 2333333333333333]);"""
|
||||
sql """INSERT INTO `group_array_intersect_test`(id, c_array_decimal) VALUES (25, [1.34,2.00188888888888888]), (26, [1.34,2.00123344444455555]);"""
|
||||
|
||||
qt_int_1 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (6, 12);"""
|
||||
qt_int_2 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (14, 12);"""
|
||||
qt_int_3 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (0, 6);"""
|
||||
qt_int_4 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (13);"""
|
||||
qt_int_5 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (2, 5);"""
|
||||
qt_int_6 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (6, 13);"""
|
||||
qt_int_7 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (12);"""
|
||||
qt_int_8 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (6, 7);"""
|
||||
qt_int_9 """select group_array_intersect(c_array_int) from group_array_intersect_test where id in (9, 12);"""
|
||||
qt_float_1 """select group_array_intersect(c_array_float) from group_array_intersect_test where id = 7;"""
|
||||
qt_float_2 """select group_array_intersect(c_array_float) from group_array_intersect_test where id between 7 and 8;"""
|
||||
qt_float_3 """select group_array_intersect(c_array_float) from group_array_intersect_test where id in (7, 9);"""
|
||||
qt_datetimev2_1 """select group_array_intersect(c_array_datetimev2) from group_array_intersect_test;"""
|
||||
qt_datetimev2_2 """select group_array_intersect(c_array_datetimev2) from group_array_intersect_test where id in (10, 11);"""
|
||||
qt_datev2_1 """select group_array_intersect(c_array_datev2) from group_array_intersect_test where id in (15, 16);"""
|
||||
qt_datev2_2 """select group_array_intersect(c_array_datev2) from group_array_intersect_test where id in (15, 17);"""
|
||||
qt_string_1 """select group_array_intersect(c_array_string) from group_array_intersect_test where id in (17, 20);"""
|
||||
qt_string_2 """select group_array_intersect(c_array_string) from group_array_intersect_test where id in (18, 20);"""
|
||||
qt_bigint """select group_array_intersect(c_array_bigint) from group_array_intersect_test where id in (23, 24);"""
|
||||
qt_decimal """select group_array_intersect(c_array_decimal) from group_array_intersect_test where id in (25, 26);"""
|
||||
qt_groupby_1 """select id, group_array_intersect(c_array_int) from group_array_intersect_test where id <= 1 group by id order by id;"""
|
||||
qt_groupby_2 """select id, group_array_intersect(c_array_string) from group_array_intersect_test where c_array_string is not null group by id order by id;"""
|
||||
qt_groupby_3 """select id, group_array_intersect(c_array_string) from group_array_intersect_test where id = 18 group by id order by id;"""
|
||||
qt_int_1 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (6, 12);"""
|
||||
qt_int_2 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (14, 12);"""
|
||||
qt_int_3 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (0, 6);"""
|
||||
qt_int_4 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (13);"""
|
||||
qt_int_5 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (2, 5);"""
|
||||
qt_int_6 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (6, 13);"""
|
||||
qt_int_7 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (12);"""
|
||||
qt_int_8 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (6, 7);"""
|
||||
qt_int_9 """select array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id in (9, 12);"""
|
||||
qt_float_1 """select array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test where id = 7;"""
|
||||
qt_float_2 """select array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test where id between 7 and 8;"""
|
||||
qt_float_3 """select array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test where id in (7, 9);"""
|
||||
qt_datetimev2_1 """select array_sort(group_array_intersect(c_array_datetimev2)) from group_array_intersect_test;"""
|
||||
qt_datetimev2_2 """select array_sort(group_array_intersect(c_array_datetimev2)) from group_array_intersect_test where id in (10, 11);"""
|
||||
qt_datev2_1 """select array_sort(group_array_intersect(c_array_datev2)) from group_array_intersect_test where id in (15, 16);"""
|
||||
qt_datev2_2 """select array_sort(group_array_intersect(c_array_datev2)) from group_array_intersect_test where id in (15, 17);"""
|
||||
qt_string_1 """select array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test where id in (17, 20);"""
|
||||
qt_string_2 """select array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test where id in (18, 20);"""
|
||||
qt_bigint """select array_sort(group_array_intersect(c_array_bigint)) from group_array_intersect_test where id in (23, 24);"""
|
||||
qt_decimal """select array_sort(group_array_intersect(c_array_decimal)) from group_array_intersect_test where id in (25, 26);"""
|
||||
qt_groupby_1 """select id, array_sort(group_array_intersect(c_array_int)) from group_array_intersect_test where id <= 1 group by id order by id;"""
|
||||
qt_groupby_2 """select id, array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test where c_array_string is not null group by id order by id;"""
|
||||
qt_groupby_3 """select id, array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test where id = 18 group by id order by id;"""
|
||||
|
||||
|
||||
sql "DROP TABLE IF EXISTS `group_array_intersect_test_not_null`;"
|
||||
@@ -97,10 +97,10 @@ suite("group_array_intersect") {
|
||||
sql """INSERT INTO `group_array_intersect_test_not_null`(id, c_array_int, c_array_float, c_array_string) VALUES (4, [6, 7], [6.6, 7.7], ['a']);"""
|
||||
sql """INSERT INTO `group_array_intersect_test_not_null`(id, c_array_int, c_array_float, c_array_string) VALUES (5, [null], [null], ['x', 'y']);"""
|
||||
|
||||
qt_notnull_1 """select group_array_intersect(c_array_float) from group_array_intersect_test_not_null where array_size(c_array_float) between 1 and 2;"""
|
||||
qt_notnull_2 """select group_array_intersect(c_array_int), group_array_intersect(c_array_float) from group_array_intersect_test_not_null where id between 2 and 3;"""
|
||||
qt_notnull_3 """select group_array_intersect(c_array_float) from group_array_intersect_test_not_null where array_size(c_array_float) between 2 and 3;"""
|
||||
qt_notnull_4 """select group_array_intersect(c_array_string) from group_array_intersect_test_not_null where id between 1 and 2;"""
|
||||
qt_notnull_5 """select group_array_intersect(c_array_int), group_array_intersect(c_array_float), group_array_intersect(c_array_string) from group_array_intersect_test_not_null where id between 3 and 4;"""
|
||||
qt_notnull_6 """select group_array_intersect(c_array_string) from group_array_intersect_test_not_null where id between 1 and 5;"""
|
||||
qt_notnull_1 """select array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test_not_null where array_size(c_array_float) between 1 and 2;"""
|
||||
qt_notnull_2 """select array_sort(group_array_intersect(c_array_int)), array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test_not_null where id between 2 and 3;"""
|
||||
qt_notnull_3 """select array_sort(group_array_intersect(c_array_float)) from group_array_intersect_test_not_null where array_size(c_array_float) between 2 and 3;"""
|
||||
qt_notnull_4 """select array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test_not_null where id between 1 and 2;"""
|
||||
qt_notnull_5 """select array_sort(group_array_intersect(c_array_int)), array_sort(group_array_intersect(c_array_float)), array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test_not_null where id between 3 and 4;"""
|
||||
qt_notnull_6 """select array_sort(group_array_intersect(c_array_string)) from group_array_intersect_test_not_null where id between 1 and 5;"""
|
||||
}
|
||||
+7
-1
@@ -220,10 +220,16 @@ echo "-- Make program: ${MAKE_PROGRAM}"
|
||||
echo "-- Use ccache: ${CMAKE_USE_CCACHE}"
|
||||
echo "-- Extra cxx flags: ${EXTRA_CXX_FLAGS:-}"
|
||||
|
||||
if [[ "${CMAKE_BUILD_TYPE}" = "ASAN" ]]; then
|
||||
BUILD_TYPE="ASAN_UT"
|
||||
else
|
||||
BUILD_TYPE="${CMAKE_BUILD_TYPE}"
|
||||
fi
|
||||
|
||||
cd "${CMAKE_BUILD_DIR}"
|
||||
"${CMAKE_CMD}" -G "${GENERATOR}" \
|
||||
-DCMAKE_MAKE_PROGRAM="${MAKE_PROGRAM}" \
|
||||
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
|
||||
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
||||
-DMAKE_TEST=ON \
|
||||
-DGLIBC_COMPATIBILITY="${GLIBC_COMPATIBILITY}" \
|
||||
-DUSE_LIBCPP="${USE_LIBCPP}" \
|
||||
|
||||
Reference in new issue
Block a user