Commit 2826f0dc authored by yiwu-arbug's avatar yiwu-arbug

Link pthread in sanitizer builds (#219)

In our CI environment we need to link pthread to enable sanitizer builds (ASAN, TSAN, UBSAN). Update cmake script for it.

It still needs #218 to get the CI pass.

Also disabling NoSpaceLeft test just like in Travis.
Signed-off-by: 's avatarYi Wu <yiwu@pingcap.com>
parent 77cc387b
...@@ -27,8 +27,7 @@ if (NOT DEFINED ROCKSDB_DIR) ...@@ -27,8 +27,7 @@ if (NOT DEFINED ROCKSDB_DIR)
message(FATAL_ERROR "ROCKSDB_DIR is not defined.") message(FATAL_ERROR "ROCKSDB_DIR is not defined.")
endif() endif()
set(CMAKE_MODULE_PATH "${ROCKSDB_DIR}/cmake/modules/") get_filename_component(CMAKE_MODULE_PATH "${ROCKSDB_DIR}/cmake/modules/" ABSOLUTE)
# list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DIR}/cmake/modules/")
include(cmake/rocksdb_flags.cmake) include(cmake/rocksdb_flags.cmake)
include_directories(${ROCKSDB_DIR}) include_directories(${ROCKSDB_DIR})
...@@ -78,6 +77,17 @@ if (CODE_COVERAGE) ...@@ -78,6 +77,17 @@ if (CODE_COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif() endif()
set(COMMON_LIBS
titan
rocksdb)
if(WITH_ASAN OR WITH_TSAN)
find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT)
link_libraries(pthread)
endif()
endif()
if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS) if (WITH_TITAN_TESTS OR WITH_TITAN_TOOLS)
add_subdirectory(${ROCKSDB_DIR} rocksdb EXCLUDE_FROM_ALL) add_subdirectory(${ROCKSDB_DIR} rocksdb EXCLUDE_FROM_ALL)
# -latomic is needed when building titandb_stress using clang. # -latomic is needed when building titandb_stress using clang.
...@@ -108,8 +118,7 @@ if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release")) ...@@ -108,8 +118,7 @@ if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release"))
compaction_filter_test compaction_filter_test
version_test) version_test)
set(TEST_LIBS set(TEST_LIBS
titan ${COMMON_LIBS}
rocksdb
testutillib testutillib
gtest) gtest)
...@@ -121,9 +130,7 @@ if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release")) ...@@ -121,9 +130,7 @@ if (WITH_TITAN_TESTS AND (NOT CMAKE_BUILD_TYPE STREQUAL "Release"))
endif() endif()
if (WITH_TITAN_TOOLS) if (WITH_TITAN_TOOLS)
set(TOOLS_LIBS set(TOOLS_LIBS ${COMMON_LIBS})
titan
rocksdb)
if (NOT TRAVIS) if (NOT TRAVIS)
find_package(gflags REQUIRED) find_package(gflags REQUIRED)
......
...@@ -1987,7 +1987,7 @@ TEST_F(TitanDBTest, Config) { ...@@ -1987,7 +1987,7 @@ TEST_F(TitanDBTest, Config) {
} }
#if defined(__linux) && !defined(TRAVIS) #if defined(__linux) && !defined(TRAVIS)
TEST_F(TitanDBTest, NoSpaceLeft) { TEST_F(TitanDBTest, DISABLED_NoSpaceLeft) {
options_.disable_background_gc = false; options_.disable_background_gc = false;
system(("mkdir -p " + dbname_).c_str()); system(("mkdir -p " + dbname_).c_str());
system(("sudo mount -t tmpfs -o size=1m tmpfs " + dbname_).c_str()); system(("sudo mount -t tmpfs -o size=1m tmpfs " + dbname_).c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment