From 23bedb47e55e6efc00f222ab9ec865531a975d8b Mon Sep 17 00:00:00 2001 From: guru4elephant Date: Fri, 21 Feb 2020 08:58:28 +0800 Subject: [PATCH] move kvdb test files into tests --- CMakeLists.txt | 2 +- cmake/external/gtest.cmake | 3 +- core/cube/cube-server/CMakeLists.txt | 6 +-- core/kvdb/CMakeLists.txt | 39 ++------------------ core/{kvdb/src => tests}/gtest_db_func.cpp | 0 core/{kvdb/src => tests}/gtest_db_thread.cpp | 0 core/{kvdb/src => tests}/gtest_kvdb.cpp | 0 core/{kvdb/src => tests}/test_rocksdb.cpp | 0 8 files changed, 8 insertions(+), 42 deletions(-) rename core/{kvdb/src => tests}/gtest_db_func.cpp (100%) rename core/{kvdb/src => tests}/gtest_db_thread.cpp (100%) rename core/{kvdb/src => tests}/gtest_kvdb.cpp (100%) rename core/{kvdb/src => tests}/test_rocksdb.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5486b6f9..3b21d334 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,8 +65,8 @@ endif() if (NOT CLIENT_ONLY) include(external/jsoncpp) include(external/rocksdb) -include(external/gtest) endif() +#include(external/gtest) include(external/snappy) include(external/leveldb) diff --git a/cmake/external/gtest.cmake b/cmake/external/gtest.cmake index 82af5745..19616ce9 100644 --- a/cmake/external/gtest.cmake +++ b/cmake/external/gtest.cmake @@ -28,7 +28,7 @@ ExternalProject_Add( GIT_TAG master UPDATE_COMMAND "" CONFIGURE_COMMAND "" - BUILD_COMMAND CXXFLAGS=-fPIC && mkdir build && cd build && cmake .. && make -j ${NUM_OF_PROCESSOR} gtest + BUILD_COMMAND CXXFLAGS=-fPIC && mkdir -p build && cd build && /home/users/dongdaxiang/software/cmake-3.15.2/bin/cmake .. && make -j ${NUM_OF_PROCESSOR} gtest INSTALL_COMMAND mkdir -p ${GTEST_INSTALL_DIR}/lib/ && cp ${GTEST_SOURCES_DIR}/src/extern_gtest/build/lib/libgtest.a ${GTEST_LIBRARIES} && cp -r ${GTEST_SOURCES_DIR}/src/extern_gtest/googletest/include ${GTEST_INSTALL_DIR}/ @@ -41,4 +41,3 @@ ADD_LIBRARY(gtest STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET gtest PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARIES}) LIST(APPEND external_project_dependencies gtest) - diff --git a/core/cube/cube-server/CMakeLists.txt b/core/cube/cube-server/CMakeLists.txt index d9b40124..e33b0b00 100644 --- a/core/cube/cube-server/CMakeLists.txt +++ b/core/cube/cube-server/CMakeLists.txt @@ -67,10 +67,10 @@ endif() target_link_libraries(cube brpc ${DYNAMIC_LIB} -lpthread -ldl -lz) -add_executable(cube_test ${SRC_LIST} test/cube_test.cpp - ${PROTO_SRC} ${PROTO_HEADER}) +#add_executable(cube_test ${SRC_LIST} test/cube_test.cpp +# ${PROTO_SRC} ${PROTO_HEADER}) -target_link_libraries(cube_test brpc ${DYNAMIC_LIB} gtest -lpthread -ldl -lz) +#target_link_libraries(cube_test brpc ${DYNAMIC_LIB} gtest -lpthread -ldl -lz) # install install(TARGETS cube diff --git a/core/kvdb/CMakeLists.txt b/core/kvdb/CMakeLists.txt index 8eb2ee42..e81d32da 100644 --- a/core/kvdb/CMakeLists.txt +++ b/core/kvdb/CMakeLists.txt @@ -1,54 +1,21 @@ include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/include) -set(SRC_LIST ${CMAKE_CURRENT_LIST_DIR}/src/test_rocksdb.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/rockskvdb_impl.cpp +set(SRC_LIST ${CMAKE_CURRENT_LIST_DIR}/src/rockskvdb_impl.cpp ${CMAKE_CURRENT_LIST_DIR}/src/param_dict_mgr_impl.cpp ${CMAKE_CURRENT_LIST_DIR}/src/mock_param_dict_impl.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/paddle_rocksdb.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/gtest_kvdb.cpp) + ${CMAKE_CURRENT_LIST_DIR}/src/paddle_rocksdb.cpp) add_library(kvdb ${SRC_LIST}) add_dependencies(kvdb rocksdb) install(TARGETS kvdb ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib/) -add_executable(kvdb_test ${SRC_LIST}) -add_dependencies(kvdb_test rocksdb) -target_link_libraries(kvdb_test rocksdb bz2 snappy zlib gtest) -#target_include_directories(kvdb_test PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/kvdb) -set(SRC_LIST2 ${CMAKE_CURRENT_LIST_DIR}/src/gtest_db_thread.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/rockskvdb_impl.cpp +set(SRC_LIST2 ${CMAKE_CURRENT_LIST_DIR}/src/rockskvdb_impl.cpp ${CMAKE_CURRENT_LIST_DIR}/src/param_dict_mgr_impl.cpp ${CMAKE_CURRENT_LIST_DIR}/src/mock_param_dict_impl.cpp ${CMAKE_CURRENT_LIST_DIR}/src/paddle_rocksdb.cpp) - -add_executable(db_thread ${SRC_LIST2}) -add_dependencies(db_thread rocksdb) -target_link_libraries(db_thread rocksdb bz2 snappy zlib gtest) -#target_include_directories(db_thread PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/kvdb) - - -set(SRC_LIST3 ${CMAKE_CURRENT_LIST_DIR}/src/gtest_db_func.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/rockskvdb_impl.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/param_dict_mgr_impl.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/mock_param_dict_impl.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/paddle_rocksdb.cpp) - -add_executable(db_func ${SRC_LIST3}) -add_dependencies(db_func rocksdb) -target_link_libraries(db_func rocksdb bz2 snappy zlib gtest) -#target_include_directories(db_func PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/kvdb) - -install(TARGETS kvdb_test - RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/kvdb_test) -install(TARGETS db_thread - RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/db_thread) -install(TARGETS db_func - RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/db_func) - - file(GLOB kvdb_headers "${CMAKE_CURRENT_LIST_DIR}/include/kvdb/*.h") install(FILES ${kvdb_headers} DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/kvdb/) diff --git a/core/kvdb/src/gtest_db_func.cpp b/core/tests/gtest_db_func.cpp similarity index 100% rename from core/kvdb/src/gtest_db_func.cpp rename to core/tests/gtest_db_func.cpp diff --git a/core/kvdb/src/gtest_db_thread.cpp b/core/tests/gtest_db_thread.cpp similarity index 100% rename from core/kvdb/src/gtest_db_thread.cpp rename to core/tests/gtest_db_thread.cpp diff --git a/core/kvdb/src/gtest_kvdb.cpp b/core/tests/gtest_kvdb.cpp similarity index 100% rename from core/kvdb/src/gtest_kvdb.cpp rename to core/tests/gtest_kvdb.cpp diff --git a/core/kvdb/src/test_rocksdb.cpp b/core/tests/test_rocksdb.cpp similarity index 100% rename from core/kvdb/src/test_rocksdb.cpp rename to core/tests/test_rocksdb.cpp -- GitLab