From 74db0aea15feb13bc7c3448777a1eefbff047839 Mon Sep 17 00:00:00 2001 From: JackyWoo Date: Tue, 21 May 2024 11:48:56 +0800 Subject: [PATCH] Fix sanitize tests errors --- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 6 ++---- src/Service/tests/gtest_raft_log.cpp | 4 ++-- src/Service/tests/gtest_raft_performance.cpp | 4 ++-- src/Service/tests/gtest_raft_snapshot.cpp | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92659c9d44..4cc2a4cc7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,7 @@ elseif (ENABLE_THINLTO) endif () # Always prefer llvm tools when using clang. For instance, we cannot use GNU ar when llvm LTO is enabled -find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-11" "llvm-ar-12" "llvm-ar-13" "llvm-ar-14" "llvm-ar-15" "llvm-ar-16") +find_program (LLVM_AR_PATH NAMES "llvm-ar" "llvm-ar-13" "llvm-ar-14" "llvm-ar-15" "llvm-ar-16" "llvm-ar-17") if (LLVM_AR_PATH) message(STATUS "Using llvm-ar: ${LLVM_AR_PATH}.") @@ -220,7 +220,7 @@ else () message(WARNING "Cannot find llvm-ar. System ar will be used instead. It does not work with ThinLTO.") endif () -find_program (LLVM_RANLIB_PATH NAMES "llvm-ranlib" "llvm-ranlib-11" "llvm-ranlib-12" "llvm-ranlib-13" "llvm-ranlib-14" "llvm-ranlib-15" "llvm-ranlib-16") +find_program (LLVM_RANLIB_PATH NAMES "llvm-ranlib" "llvm-ranlib-13" "llvm-ranlib-14" "llvm-ranlib-15" "llvm-ranlib-16" "llvm-ranlib-17") if (LLVM_RANLIB_PATH) message(STATUS "Using llvm-ranlib: ${LLVM_RANLIB_PATH}.") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cb3334d0b..187f2086db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,10 +30,8 @@ target_link_libraries(rk_common_io PUBLIC ${NURAFT_LIBRARY}) add_library (rk_malloc OBJECT Common/malloc.cpp) set_source_files_properties(Common/malloc.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin") -if (((SANITIZE STREQUAL "thread") OR (SANITIZE STREQUAL "address"))) - add_library (rk_new_delete STATIC Common/new_delete.cpp) - target_link_libraries (rk_new_delete PRIVATE rk_common_io jemalloc) -endif() +add_library (rk_new_delete STATIC Common/new_delete.cpp) +target_link_libraries (rk_new_delete PRIVATE rk_common_io jemalloc) add_subdirectory(ZooKeeper) add_subdirectory(Common/Config) diff --git a/src/Service/tests/gtest_raft_log.cpp b/src/Service/tests/gtest_raft_log.cpp index d1d89f6e7a..273aca06a1 100644 --- a/src/Service/tests/gtest_raft_log.cpp +++ b/src/Service/tests/gtest_raft_log.cpp @@ -260,7 +260,7 @@ TEST(RaftLog, writeAt) { String log_dir(LOG_DIR + "/9"); cleanDirectory(log_dir); - ptr file_store = cs_new(log_dir, true); + ptr file_store = cs_new(log_dir, true, FsyncMode::FSYNC); UInt64 term = 1; String key("/ck"); @@ -330,7 +330,7 @@ TEST(RaftLog, compact) String log_dir(LOG_DIR + "/10"); cleanDirectory(log_dir); ptr file_store - = cs_new(log_dir, true, FsyncMode::FSYNC_PARALLEL, 1000, static_cast(200), static_cast(3)); + = cs_new(log_dir, true, FsyncMode::FSYNC, 1000, static_cast(200), static_cast(3)); UInt64 term = 1; String key("/ck/table/table1"); diff --git a/src/Service/tests/gtest_raft_performance.cpp b/src/Service/tests/gtest_raft_performance.cpp index 8f263f2d5b..3343d4886b 100644 --- a/src/Service/tests/gtest_raft_performance.cpp +++ b/src/Service/tests/gtest_raft_performance.cpp @@ -22,7 +22,7 @@ TEST(RaftPerformance, appendLogPerformance) String log_dir(LOG_DIR + "/50"); cleanDirectory(log_dir); - ptr file_store = cs_new(log_dir, true); + ptr file_store = cs_new(log_dir, true, FsyncMode::FSYNC); int key_bytes = 256; int value_bytes = 1024; @@ -81,7 +81,7 @@ TEST(RaftPerformance, appendLogThread) String log_dir(LOG_DIR + "/51"); cleanDirectory(log_dir); //auto log_store = LogSegmentStore::getInstance(log_dir, true); - ptr file_store = cs_new(log_dir, true); + ptr file_store = cs_new(log_dir, true, FsyncMode::FSYNC); //ASSERT_EQ(log_store->init(), 0); int key_bytes = 256; int value_bytes = 1024; diff --git a/src/Service/tests/gtest_raft_snapshot.cpp b/src/Service/tests/gtest_raft_snapshot.cpp index 0875b050e4..2c08209e1d 100644 --- a/src/Service/tests/gtest_raft_snapshot.cpp +++ b/src/Service/tests/gtest_raft_snapshot.cpp @@ -673,7 +673,7 @@ void createSnapshotWithFuzzyLog(bool async_snapshot) KeeperResponsesQueue queue; RaftSettingsPtr setting_ptr = RaftSettings::getDefault(); setting_ptr->async_snapshot = async_snapshot; - ptr store = cs_new(log_dir); + ptr store = cs_new(log_dir, false, FsyncMode::FSYNC); std::mutex new_session_id_callback_mutex; std::unordered_map> new_session_id_callback; @@ -764,7 +764,7 @@ void createSnapshotWithFuzzyLog(bool async_snapshot) std::this_thread::sleep_for(std::chrono::milliseconds(200)); KeeperResponsesQueue ano_queue; - ptr ano_store = cs_new(log_dir); + ptr ano_store = cs_new(log_dir, false, FsyncMode::FSYNC); NuRaftStateMachine ano_machine( ano_queue, setting_ptr, snap_dir, log_dir, 10, 3, new_session_id_callback_mutex, new_session_id_callback, ano_store);