Revert "Use ASAN for testing on CI."

This reverts commit 6ccc2161da.
This commit is contained in:
Tao He 2022-07-18 14:24:17 +08:00
parent 6ccc2161da
commit 6a489f52b3
4 changed files with 13 additions and 27 deletions

View File

@ -136,7 +136,6 @@ jobs:
cmake .. -DCMAKE_CXX_STANDARD=17 \ cmake .. -DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=TRUE \ -DCMAKE_CXX_STANDARD_REQUIRED=TRUE \
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DETCD_USE_ASAN=ON \
-DBUILD_ETCD_TESTS=ON \ -DBUILD_ETCD_TESTS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
@ -176,10 +175,13 @@ jobs:
echo "Run the etcd election test ........................." echo "Run the etcd election test ........................."
./build/bin/ElectionTest ./build/bin/ElectionTest
killall -TERM etcd || true
sleep 5
- name: Lock Test - name: Lock Test
if: false if: false
run: | run: |
killall -TERM etcd killall -TERM etcd || true
sleep 5 sleep 5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/x86_64-linux-gnu
@ -195,6 +197,9 @@ jobs:
echo "Run the etcd lock test ........................." echo "Run the etcd lock test ........................."
./build/bin/LockTest ./build/bin/LockTest
killall -TERM etcd || true
sleep 5
- name: Lock Tests with Debug - name: Lock Tests with Debug
if: true if: true
uses: sighingnow/action-tmate@master uses: sighingnow/action-tmate@master
@ -219,6 +224,9 @@ jobs:
echo "Run the etcd lock test ........................." echo "Run the etcd lock test ........................."
./build/bin/LockTest ./build/bin/LockTest
killall -TERM etcd || true
sleep 5
- name: Authentication Test - name: Authentication Test
run: | run: |
killall -TERM etcd || true killall -TERM etcd || true
@ -260,6 +268,9 @@ jobs:
/usr/local/bin/etcdctl auth disable --user="root" --password="root" || true /usr/local/bin/etcdctl auth disable --user="root" --password="root" || true
fi fi
killall -TERM etcd || true
sleep 5
- name: Transport Security and Authentication Test - name: Transport Security and Authentication Test
run: | run: |
killall -TERM etcd || true killall -TERM etcd || true

View File

@ -30,27 +30,6 @@ option(BUILD_SHARED_LIBS "Build etcd-cpp-apiv3 shared libraries" ON)
option(BUILD_ETCD_TESTS "Build etcd-cpp-apiv3 test cases" OFF) option(BUILD_ETCD_TESTS "Build etcd-cpp-apiv3 test cases" OFF)
option(CMAKE_POSITION_INDEPENDENT_CODE "Build etcd-cpp-apiv3 with -fPIC" ON) option(CMAKE_POSITION_INDEPENDENT_CODE "Build etcd-cpp-apiv3 with -fPIC" ON)
option(ETCD_W_STRICT "Build etcd-cpp-apiv3 with -Werror" ON) option(ETCD_W_STRICT "Build etcd-cpp-apiv3 with -Werror" ON)
option(ETCD_USE_ASAN "Using address sanitizer to check memory accessing" OFF)
macro(target_add_link_options target scope)
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
cmake_parse_arguments(target_add_link_options "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(${CMAKE_VERSION} VERSION_LESS "3.13")
target_link_libraries(${target} INTERFACE ${target_add_link_options_OPTIONS})
else()
target_link_options(${target} ${scope} ${target_add_link_options_OPTIONS})
endif()
endmacro()
macro(target_enable_sanitizer target visibility)
if(ETCD_USE_ASAN)
message(STATUS "${target} will be bulit with -fsanitize=address")
target_compile_options(${target} ${visibility} -fno-omit-frame-pointer -fsanitize=address)
target_add_link_options(${target} ${visibility} OPTIONS -fsanitize=address)
endif()
endmacro()
# reference: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#always-full-rpath # reference: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#always-full-rpath
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

View File

@ -19,7 +19,6 @@ file(GLOB_RECURSE CPP_CLIENT_CORE_SRC
add_library(etcd-cpp-api-core-objects OBJECT ${CPP_CLIENT_CORE_SRC} ${PROTOBUF_GENERATES}) add_library(etcd-cpp-api-core-objects OBJECT ${CPP_CLIENT_CORE_SRC} ${PROTOBUF_GENERATES})
add_dependencies(etcd-cpp-api-core-objects protobuf_generates) add_dependencies(etcd-cpp-api-core-objects protobuf_generates)
target_enable_sanitizer(etcd-cpp-api-core-objects PUBLIC)
include_generated_protobuf_files(etcd-cpp-api-core-objects) include_generated_protobuf_files(etcd-cpp-api-core-objects)
# add the core library, includes the sycnhronous client only # add the core library, includes the sycnhronous client only
@ -30,7 +29,6 @@ target_link_libraries(etcd-cpp-api-core PUBLIC
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${GRPC_LIBRARIES} ${GRPC_LIBRARIES}
) )
target_enable_sanitizer(etcd-cpp-api-core PUBLIC)
include_generated_protobuf_files(etcd-cpp-api-core) include_generated_protobuf_files(etcd-cpp-api-core)
# add the client with asynchronus client # add the client with asynchronus client
@ -43,7 +41,6 @@ target_link_libraries(etcd-cpp-api PUBLIC
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${GRPC_LIBRARIES} ${GRPC_LIBRARIES}
) )
target_enable_sanitizer(etcd-cpp-api PUBLIC)
include_generated_protobuf_files(etcd-cpp-api) include_generated_protobuf_files(etcd-cpp-api)
if("${CMAKE_VERSION}" VERSION_LESS "3.14") if("${CMAKE_VERSION}" VERSION_LESS "3.14")

View File

@ -18,7 +18,6 @@ foreach(testfile ${TEST_FILES})
else() else()
add_executable(${test_name} EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/${testfile}) add_executable(${test_name} EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/${testfile})
endif() endif()
target_enable_sanitizer(${test_name} PUBLIC)
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
target_include_directories(${test_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen) target_include_directories(${test_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen)