From 6a97e8f75359291a9b80ab543eff10d831a9102e Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Thu, 8 Jun 2023 00:52:33 +0800 Subject: [PATCH 1/4] cmake --- CMakeLists.txt | 10 ++- cmake_modules/BaseFunctions.cmake | 104 +++++++++++++------------- src/CMakeLists.txt | 18 ++--- src/base/CMakeLists.txt | 4 - src/meta/test/CMakeLists.txt | 18 +---- src/test/kill_test/CMakeLists.txt | 6 +- src/test/pressure_test/CMakeLists.txt | 6 +- 7 files changed, 67 insertions(+), 99 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc451ae269..f0f89018ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,9 +15,14 @@ # specific language governing permissions and limitations # under the License. -project(pegasus) cmake_minimum_required(VERSION 3.11.0) +project(pegasus) + +if(NOT UNIX) + message(FATAL_ERROR "It's not supported yet to build Pegasus on non-UNIX or non-UNIX-like system!") +endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # require at least gcc 5.4.0 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4.0) @@ -39,9 +44,6 @@ set(THIRDPARTY_ROOT ${PROJECT_ROOT}/thirdparty) set(THIRDPARTY_INSTALL_DIR ${PROJECT_ROOT}/thirdparty/output) message(STATUS "THIRDPARTY_INSTALL_DIR = ${THIRDPARTY_INSTALL_DIR}") -set(BUILD_DIR ${PROJECT_ROOT}/src/builder) -message(STATUS "BUILD_DIR = ${BUILD_DIR}") - option(BUILD_TEST "build unit test" ON) message(STATUS "BUILD_TEST = ${BUILD_TEST}") diff --git a/cmake_modules/BaseFunctions.cmake b/cmake_modules/BaseFunctions.cmake index 79aba27cb7..c94c800691 100644 --- a/cmake_modules/BaseFunctions.cmake +++ b/cmake_modules/BaseFunctions.cmake @@ -53,7 +53,7 @@ function(dsn_install_library) install(TARGETS ${MY_PROJ_NAME} DESTINATION "lib") endfunction() -# Install this target into ${CMAKE_INSTALL_PREFIX}/bin/${PROJ_NAME} +# Install this target into ${CMAKE_INSTALL_PREFIX}/bin/${MY_PROJ_NAME} function(dsn_install_executable) set(MY_PROJ_TYPE "EXECUTABLE") set(INSTALL_DIR "bin/${MY_PROJ_NAME}") @@ -67,58 +67,43 @@ function(dsn_install_executable) endif() endfunction() -function(ms_add_project PROJ_TYPE PROJ_NAME PROJ_SRC PROJ_LIBS PROJ_BINPLACES) - if(NOT((PROJ_TYPE STREQUAL "STATIC") OR (PROJ_TYPE STREQUAL "SHARED") OR - (PROJ_TYPE STREQUAL "EXECUTABLE") OR (PROJ_TYPE STREQUAL "OBJECT"))) - message(FATAL_ERROR "Invalid project type.") - endif() - - if(PROJ_SRC STREQUAL "") - message(FATAL_ERROR "No source files.") - endif() - - if((PROJ_TYPE STREQUAL "STATIC") OR (PROJ_TYPE STREQUAL "OBJECT")) - add_library(${PROJ_NAME} ${PROJ_TYPE} ${PROJ_SRC}) - elseif(PROJ_TYPE STREQUAL "SHARED") - add_library(${PROJ_NAME} ${PROJ_TYPE} ${PROJ_SRC}) - elseif(PROJ_TYPE STREQUAL "EXECUTABLE") - add_executable(${PROJ_NAME} ${PROJ_SRC}) - endif() - - if((PROJ_TYPE STREQUAL "SHARED") OR (PROJ_TYPE STREQUAL "EXECUTABLE")) - if(PROJ_TYPE STREQUAL "SHARED") - set(LINK_MODE PRIVATE) - else() - set(LINK_MODE PUBLIC) - endif() - target_link_libraries(${PROJ_NAME} "${LINK_MODE}" ${PROJ_LIBS}) - endif() -endfunction(ms_add_project) - - # Parameters: -# - MY_PROJ_TYPE -# - MY_PROJ_NAME -# - MY_SRC_SEARCH_MODE +# - MY_PROJ_TYPE: required: STATIC, SHARED, EXECUTABLE or OBJECT +# - MY_PROJ_NAME: required: +# - MY_SRC_SEARCH_MODE: optional: GLOB_RECURSE or GLOB, default is GLOB # Search mode for source files under current project directory -# "GLOB_RECURSE" for recursive search -# "GLOB" for non-recursive search -# - MY_PROJ_SRC -# - MY_PROJ_LIBS -# - MY_BINPLACES +# GLOB_RECURSE: for recursive search +# GLOB: for non-recursive search +# - MY_PROJ_SRC: optional: default is "" +# : includes all source files from the project directory +# : appends the specified files to all the source files from the project directory +# - MY_PROJ_LIBS: optional: default is "" +# The libraries to link +# - MY_BOOST_LIBS: optional: default is "" +# The boost libraries to link +# - MY_BINPLACES: optional: default is "" # Extra files that will be installed -# - MY_BOOST_LIBS function(dsn_add_project) + # 1. validate MY_PROJ_TYPE if((NOT DEFINED MY_PROJ_TYPE) OR (MY_PROJ_TYPE STREQUAL "")) message(FATAL_ERROR "MY_PROJ_TYPE is empty.") endif() + if(NOT((MY_PROJ_TYPE STREQUAL "STATIC") OR (MY_PROJ_TYPE STREQUAL "SHARED") OR + (MY_PROJ_TYPE STREQUAL "EXECUTABLE") OR (MY_PROJ_TYPE STREQUAL "OBJECT"))) + message(FATAL_ERROR "Invalid project type.") + endif() + + # 2. validate MY_PROJ_NAME if((NOT DEFINED MY_PROJ_NAME) OR (MY_PROJ_NAME STREQUAL "")) message(FATAL_ERROR "MY_PROJ_NAME is empty.") endif() + + # 3. update MY_SRC_SEARCH_MODE if(NOT DEFINED MY_SRC_SEARCH_MODE) set(MY_SRC_SEARCH_MODE "GLOB") endif() + # 4. update and validate MY_PROJ_SRC # find source files from current directory if(NOT DEFINED MY_PROJ_SRC) set(MY_PROJ_SRC "") @@ -127,25 +112,47 @@ function(dsn_add_project) # We restrict the file suffix to keep our codes consistent. file(${MY_SRC_SEARCH_MODE} TEMP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/*.c" ) set(MY_PROJ_SRC ${TEMP_SRC} ${MY_PROJ_SRC}) + if(MY_PROJ_SRC STREQUAL "") + message(FATAL_ERROR "No source files.") + endif() + # 5. update MY_BOOST_LIBS and MY_PROJ_LIBS + if(NOT DEFINED MY_BOOST_LIBS) + set(MY_BOOST_LIBS "") + endif() if(NOT DEFINED MY_PROJ_LIBS) set(MY_PROJ_LIBS "") endif() + # TODO(yingchun): Link the libs explicitly in each projects. + if((MY_PROJ_TYPE STREQUAL "SHARED") OR (MY_PROJ_TYPE STREQUAL "EXECUTABLE")) + set(MY_PROJ_LIBS ${MY_PROJ_LIBS} ${DEFAULT_THIRDPARTY_LIBS} ${MY_BOOST_LIBS} ${DSN_SYSTEM_LIBS}) + endif() + + # 6. update MY_BINPLACES if(NOT DEFINED MY_BINPLACES) set(MY_BINPLACES "") endif() - if(NOT DEFINED MY_BOOST_LIBS) - set(MY_BOOST_LIBS "") + # 7. add executable or library + if(MY_PROJ_TYPE STREQUAL "EXECUTABLE") + add_executable(${MY_PROJ_NAME} ${MY_PROJ_SRC}) + else() + add_library(${MY_PROJ_NAME} ${MY_PROJ_TYPE} ${MY_PROJ_SRC}) endif() + # 8. link the libraries if((MY_PROJ_TYPE STREQUAL "SHARED") OR (MY_PROJ_TYPE STREQUAL "EXECUTABLE")) - set(MY_PROJ_LIBS ${MY_PROJ_LIBS} ${DEFAULT_THIRDPARTY_LIBS} ${MY_BOOST_LIBS} ${DSN_SYSTEM_LIBS}) + if(MY_PROJ_TYPE STREQUAL "SHARED") + set(LINK_MODE PRIVATE) + else() + set(LINK_MODE PUBLIC) + endif() + target_link_libraries(${MY_PROJ_NAME} "${LINK_MODE}" ${MY_PROJ_LIBS}) endif() - ms_add_project("${MY_PROJ_TYPE}" "${MY_PROJ_NAME}" "${MY_PROJ_SRC}" "${MY_PROJ_LIBS}" "${MY_BINPLACES}") + + # 9. add -DFILE_BASENAME="filename" define_file_basename_for_sources(${MY_PROJ_NAME}) endfunction(dsn_add_project) @@ -174,7 +181,6 @@ endfunction(dsn_add_object) function(dsn_add_test) if(${BUILD_TEST}) add_definitions(-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=0) - set(MY_EXECUTABLE_IS_TEST TRUE) dsn_add_executable() file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/bin") @@ -363,10 +369,6 @@ function(dsn_setup_thirdparty_libs) endfunction(dsn_setup_thirdparty_libs) function(dsn_common_setup) - if(NOT (UNIX)) - message(FATAL_ERROR "Only Unix are supported.") - endif() - if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "In-source builds are not allowed.") endif() @@ -382,10 +384,6 @@ function(dsn_common_setup) set(ENV{CCACHE_MAXSIZE} "1024M") endif(CCACHE) - if(NOT DEFINED DSN_BUILD_RUNTIME) - set(DSN_BUILD_RUNTIME FALSE) - endif() - set(BUILD_SHARED_LIBS OFF) include(CheckCXXCompilerFlag) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4cd73096a8..3891b90bce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,22 +15,14 @@ # specific language governing permissions and limitations # under the License. -project(pegasus C CXX) - -set(PEGASUS_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - -set(DSN_BUILD_RUNTIME TRUE) +add_compile_options(-fPIC) dsn_common_setup() -if(UNIX) - add_compile_options(-fPIC) -endif() - -include_directories(${PEGASUS_PROJECT_DIR}) -include_directories(${PEGASUS_PROJECT_DIR}/common/serialization_helper) -include_directories(${PEGASUS_PROJECT_DIR}/include) -include_directories(${PEGASUS_PROJECT_DIR}/builder/output/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common/serialization_helper) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/builder/output/include) add_subdirectory(aio) add_subdirectory(base) diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 7c117ef4f1..60bc63e553 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -17,10 +17,6 @@ set(MY_PROJ_NAME "pegasus_base") -if(UNIX) - add_compile_options(-fPIC) -endif() - # Search mode for source files under CURRENT project directory? # "GLOB_RECURSE" for recursive search # "GLOB" for non-recursive search diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index 16c4ff4836..2f17dc3abd 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -23,20 +23,7 @@ # THE SOFTWARE. set(MY_PROJ_NAME dsn.meta.test) - -# Source files under CURRENT project directory will be automatically included. -# You can manually set MY_PROJ_SRC to include source files under other directories. -file(GLOB MY_PROJ_SRC - ${PROJECT_SOURCE_DIR}/src/meta/*.cpp - ${PROJECT_SOURCE_DIR}/src/meta/duplication/*.cpp - ) -set(MY_PROJ_SRC ${MY_PROJ_SRC} misc/misc.cpp) - -# Search mode for source files under CURRENT project directory? -# "GLOB_RECURSE" for recursive search -# "GLOB" for non-recursive search -set(MY_SRC_SEARCH_MODE "GLOB") - +set(MY_PROJ_SRC misc/misc.cpp) set(MY_PROJ_LIBS dsn.replication.zookeeper_provider dsn_replication_common @@ -61,10 +48,7 @@ set(MY_PROJ_LIBS gtest ssl hdfs) - set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) - -# Extra files that will be installed set(MY_BINPLACES clear.sh run.sh config-test.ini suite1 suite2) dsn_add_test() diff --git a/src/test/kill_test/CMakeLists.txt b/src/test/kill_test/CMakeLists.txt index 6e2ab5d6c2..28ffe3f7eb 100644 --- a/src/test/kill_test/CMakeLists.txt +++ b/src/test/kill_test/CMakeLists.txt @@ -43,10 +43,8 @@ set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini") set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) -if (UNIX) - SET(CMAKE_INSTALL_RPATH ".") - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -endif() +SET(CMAKE_INSTALL_RPATH ".") +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) dsn_add_executable() dsn_install_executable() diff --git a/src/test/pressure_test/CMakeLists.txt b/src/test/pressure_test/CMakeLists.txt index b26cc10b58..7287f5546c 100644 --- a/src/test/pressure_test/CMakeLists.txt +++ b/src/test/pressure_test/CMakeLists.txt @@ -39,10 +39,8 @@ set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config-pressure.ini") set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) -if (UNIX) - SET(CMAKE_INSTALL_RPATH ".") - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -endif() +SET(CMAKE_INSTALL_RPATH ".") +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) dsn_add_executable() dsn_install_executable() From ded0171216e893c3378db6f463b97ab5702efdda Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Sun, 11 Jun 2023 23:18:13 +0800 Subject: [PATCH 2/4] try1 --- src/meta/CMakeLists.txt | 1 + src/meta/meta_test_utils/CMakeLists.txt | 34 ++++++++++++++++ .../meta_test_base.cpp | 2 +- .../meta_test_base.h | 0 .../{test/misc => meta_test_utils}/misc.cpp | 0 .../{test/misc => meta_test_utils}/misc.h | 0 src/meta/test/CMakeLists.txt | 3 +- src/meta/test/backup_test/CMakeLists.txt | 39 +++++++++++++++++++ .../test/{ => backup_test}/backup_test.cpp | 4 +- .../test/balancer_simulator/CMakeLists.txt | 21 ++-------- src/meta/test/meta_app_envs_test.cpp | 2 +- src/meta/test/meta_app_operation_test.cpp | 4 +- src/meta/test/meta_backup_test.cpp | 2 +- .../test/meta_bulk_load_ingestion_test.cpp | 2 +- src/meta/test/meta_bulk_load_service_test.cpp | 2 +- src/meta/test/meta_data.cpp | 2 +- .../test/meta_duplication_service_test.cpp | 2 +- src/meta/test/meta_http_service_test.cpp | 2 +- src/meta/test/meta_mauanl_compaction_test.cpp | 2 +- .../test/meta_partition_guardian_test.cpp | 2 +- src/meta/test/meta_service_test.cpp | 2 +- src/meta/test/meta_split_service_test.cpp | 2 +- src/meta/test/meta_state/CMakeLists.txt | 20 +--------- src/meta/test/server_state_restore_test.cpp | 2 +- 24 files changed, 99 insertions(+), 53 deletions(-) create mode 100644 src/meta/meta_test_utils/CMakeLists.txt rename src/meta/{test => meta_test_utils}/meta_test_base.cpp (99%) rename src/meta/{test => meta_test_utils}/meta_test_base.h (100%) rename src/meta/{test/misc => meta_test_utils}/misc.cpp (100%) rename src/meta/{test/misc => meta_test_utils}/misc.h (100%) create mode 100644 src/meta/test/backup_test/CMakeLists.txt rename src/meta/test/{ => backup_test}/backup_test.cpp (99%) diff --git a/src/meta/CMakeLists.txt b/src/meta/CMakeLists.txt index b38ced7228..2edfed29a1 100644 --- a/src/meta/CMakeLists.txt +++ b/src/meta/CMakeLists.txt @@ -65,4 +65,5 @@ add_definitions(-DDSN_MOCK_TEST) dsn_add_shared_library() +add_subdirectory(meta_test_utils) add_subdirectory(test) diff --git a/src/meta/meta_test_utils/CMakeLists.txt b/src/meta/meta_test_utils/CMakeLists.txt new file mode 100644 index 0000000000..d4dbc5824c --- /dev/null +++ b/src/meta/meta_test_utils/CMakeLists.txt @@ -0,0 +1,34 @@ +# The MIT License (MIT) +# +# Copyright (c) 2015 Microsoft Corporation +# +# -=- Robust Distributed System Nucleus (rDSN) -=- +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +set(MY_PROJ_NAME meta_test_utils) +set(MY_PROJ_SRC "") +set(MY_PROJ_LIBS + dsn_meta_server + dsn_replication_common + dsn_runtime + hashtable + gtest) +set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) +dsn_add_static_library() diff --git a/src/meta/test/meta_test_base.cpp b/src/meta/meta_test_utils/meta_test_base.cpp similarity index 99% rename from src/meta/test/meta_test_base.cpp rename to src/meta/meta_test_utils/meta_test_base.cpp index 65da209291..a88ed5c191 100644 --- a/src/meta/test/meta_test_base.cpp +++ b/src/meta/meta_test_utils/meta_test_base.cpp @@ -41,7 +41,7 @@ #include "meta/server_load_balancer.h" #include "meta/server_state.h" #include "meta/test/misc/misc.h" -#include "meta_service_test_app.h" +#include "../test/meta_service_test_app.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task_tracker.h" diff --git a/src/meta/test/meta_test_base.h b/src/meta/meta_test_utils/meta_test_base.h similarity index 100% rename from src/meta/test/meta_test_base.h rename to src/meta/meta_test_utils/meta_test_base.h diff --git a/src/meta/test/misc/misc.cpp b/src/meta/meta_test_utils/misc.cpp similarity index 100% rename from src/meta/test/misc/misc.cpp rename to src/meta/meta_test_utils/misc.cpp diff --git a/src/meta/test/misc/misc.h b/src/meta/meta_test_utils/misc.h similarity index 100% rename from src/meta/test/misc/misc.h rename to src/meta/meta_test_utils/misc.h diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index 2f17dc3abd..aad8124eb1 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -23,7 +23,7 @@ # THE SOFTWARE. set(MY_PROJ_NAME dsn.meta.test) -set(MY_PROJ_SRC misc/misc.cpp) +set(MY_PROJ_SRC "") set(MY_PROJ_LIBS dsn.replication.zookeeper_provider dsn_replication_common @@ -53,5 +53,6 @@ set(MY_BINPLACES clear.sh run.sh config-test.ini suite1 suite2) dsn_add_test() +add_subdirectory(backup_test) add_subdirectory(balancer_simulator) add_subdirectory(meta_state) diff --git a/src/meta/test/backup_test/CMakeLists.txt b/src/meta/test/backup_test/CMakeLists.txt new file mode 100644 index 0000000000..54c9c2dae8 --- /dev/null +++ b/src/meta/test/backup_test/CMakeLists.txt @@ -0,0 +1,39 @@ +# The MIT License (MIT) +# +# Copyright (c) 2015 Microsoft Corporation +# +# -=- Robust Distributed System Nucleus (rDSN) -=- +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +set(MY_PROJ_NAME backup_test) +set(MY_PROJ_LIBS + dsn_meta_server + dsn_replica_server + dsn_replication_common + dsn_runtime + hashtable + gtest + meta_test_utils) +set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) +set(MY_BINPLACES + "../run.sh" + "../clear.sh" + "../config-test.ini") +dsn_add_test() diff --git a/src/meta/test/backup_test.cpp b/src/meta/test/backup_test/backup_test.cpp similarity index 99% rename from src/meta/test/backup_test.cpp rename to src/meta/test/backup_test/backup_test.cpp index 70062ba693..83c3e472ff 100644 --- a/src/meta/test/backup_test.cpp +++ b/src/meta/test/backup_test/backup_test.cpp @@ -42,8 +42,8 @@ #include "meta/meta_state_service.h" #include "meta/server_state.h" #include "meta/test/misc/misc.h" -#include "meta_service_test_app.h" -#include "meta_test_base.h" +#include "../meta_service_test_app.h" +#include "../meta_test_utils/meta_test_base.h" #include "runtime/api_layer1.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_holder.h" diff --git a/src/meta/test/balancer_simulator/CMakeLists.txt b/src/meta/test/balancer_simulator/CMakeLists.txt index fcf8a1edbe..0c1e0c29be 100644 --- a/src/meta/test/balancer_simulator/CMakeLists.txt +++ b/src/meta/test/balancer_simulator/CMakeLists.txt @@ -23,26 +23,13 @@ # THE SOFTWARE. set(MY_PROJ_NAME sim_lb) - -# Source files under CURRENT project directory will be automatically included. -# You can manually set MY_PROJ_SRC to include source files under other directories. -set(MY_PROJ_SRC ../misc/misc.cpp) - -# Search mode for source files under CURRENT project directory? -# "GLOB_RECURSE" for recursive search -# "GLOB" for non-recursive search -set(MY_SRC_SEARCH_MODE "GLOB") - set(MY_PROJ_LIBS dsn_meta_server dsn_replication_common dsn_runtime + gtest hashtable - gtest) - + meta_test_utils) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) - -# Extra files that will be installed -set(MY_BINPLACES "") - -dsn_add_test() +# TODO(yingchun): sim_lb need a 'config.ini', fix it later. +dsn_add_executable() diff --git a/src/meta/test/meta_app_envs_test.cpp b/src/meta/test/meta_app_envs_test.cpp index 255930320d..9c0ae0834e 100644 --- a/src/meta/test/meta_app_envs_test.cpp +++ b/src/meta/test/meta_app_envs_test.cpp @@ -34,7 +34,7 @@ #include "common/replica_envs.h" #include "meta/meta_data.h" #include "meta_admin_types.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "utils/error_code.h" namespace dsn { diff --git a/src/meta/test/meta_app_operation_test.cpp b/src/meta/test/meta_app_operation_test.cpp index c3ddafa72c..7aff21ab34 100644 --- a/src/meta/test/meta_app_operation_test.cpp +++ b/src/meta/test/meta_app_operation_test.cpp @@ -40,8 +40,8 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_base.h" -#include "misc/misc.h" +#include "meta_test_utils/meta_test_base.h" +#include "meta_test_utils/misc.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task_tracker.h" diff --git a/src/meta/test/meta_backup_test.cpp b/src/meta/test/meta_backup_test.cpp index 212da5aea0..0e2cccad11 100644 --- a/src/meta/test/meta_backup_test.cpp +++ b/src/meta/test/meta_backup_test.cpp @@ -35,7 +35,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta/server_state.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/api_layer1.h" #include "runtime/rpc/rpc_address.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_bulk_load_ingestion_test.cpp b/src/meta/test/meta_bulk_load_ingestion_test.cpp index 758fa3d3e4..dd4b238844 100644 --- a/src/meta/test/meta_bulk_load_ingestion_test.cpp +++ b/src/meta/test/meta_bulk_load_ingestion_test.cpp @@ -29,7 +29,7 @@ #include "dsn.layer2_types.h" #include "meta/meta_bulk_load_ingestion_context.h" #include "meta/meta_data.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_address.h" #include "utils/fail_point.h" diff --git a/src/meta/test/meta_bulk_load_service_test.cpp b/src/meta/test/meta_bulk_load_service_test.cpp index 1dcd5e1e63..5b02b29918 100644 --- a/src/meta/test/meta_bulk_load_service_test.cpp +++ b/src/meta/test/meta_bulk_load_service_test.cpp @@ -50,7 +50,7 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "runtime/rpc/rpc_address.h" #include "utils/blob.h" diff --git a/src/meta/test/meta_data.cpp b/src/meta/test/meta_data.cpp index 2aef6ddd5a..b61bce6067 100644 --- a/src/meta/test/meta_data.cpp +++ b/src/meta/test/meta_data.cpp @@ -37,7 +37,7 @@ #include "dsn.layer2_types.h" #include "meta/meta_data.h" #include "metadata_types.h" -#include "misc/misc.h" +#include "meta_test_utils/misc.h" #include "runtime/rpc/rpc_address.h" using namespace dsn::replication; diff --git a/src/meta/test/meta_duplication_service_test.cpp b/src/meta/test/meta_duplication_service_test.cpp index d40f2fc789..6d98a85ec0 100644 --- a/src/meta/test/meta_duplication_service_test.cpp +++ b/src/meta/test/meta_duplication_service_test.cpp @@ -57,7 +57,7 @@ #include "meta/meta_state_service_utils.h" #include "meta/server_state.h" #include "meta/test/misc/misc.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_address.h" #include "utils/blob.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_http_service_test.cpp b/src/meta/test/meta_http_service_test.cpp index 7ae0473b63..7ec573cc2a 100644 --- a/src/meta/test/meta_http_service_test.cpp +++ b/src/meta/test/meta_http_service_test.cpp @@ -40,7 +40,7 @@ #include "meta/meta_service.h" #include "meta/meta_state_service.h" #include "meta_service_test_app.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_holder.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task.h" diff --git a/src/meta/test/meta_mauanl_compaction_test.cpp b/src/meta/test/meta_mauanl_compaction_test.cpp index 7b7407283f..fe39ff73c6 100644 --- a/src/meta/test/meta_mauanl_compaction_test.cpp +++ b/src/meta/test/meta_mauanl_compaction_test.cpp @@ -33,7 +33,7 @@ #include "meta/meta_data.h" #include "meta/server_state.h" #include "meta_admin_types.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_partition_guardian_test.cpp b/src/meta/test/meta_partition_guardian_test.cpp index 00c444b355..b81e53af13 100644 --- a/src/meta/test/meta_partition_guardian_test.cpp +++ b/src/meta/test/meta_partition_guardian_test.cpp @@ -55,7 +55,7 @@ #include "meta/test/misc/misc.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" diff --git a/src/meta/test/meta_service_test.cpp b/src/meta/test/meta_service_test.cpp index bf993c0dde..b8ea5afb13 100644 --- a/src/meta/test/meta_service_test.cpp +++ b/src/meta/test/meta_service_test.cpp @@ -27,7 +27,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta_admin_types.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/rpc/network.h" #include "runtime/rpc/network.sim.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/meta_split_service_test.cpp b/src/meta/test/meta_split_service_test.cpp index ea611c6330..59523bda0c 100644 --- a/src/meta/test/meta_split_service_test.cpp +++ b/src/meta/test/meta_split_service_test.cpp @@ -57,7 +57,7 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "partition_split_types.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/meta_state/CMakeLists.txt b/src/meta/test/meta_state/CMakeLists.txt index 71c60be222..9c0303121a 100644 --- a/src/meta/test/meta_state/CMakeLists.txt +++ b/src/meta/test/meta_state/CMakeLists.txt @@ -23,33 +23,17 @@ # THE SOFTWARE. set(MY_PROJ_NAME dsn_meta_state_tests) - -# Source files under CURRENT project directory will be automatically included. -# You can manually set MY_PROJ_SRC to include source files under other directories. -set(MY_PROJ_SRC "") - -# Search mode for source files under CURRENT project directory? -# "GLOB_RECURSE" for recursive search -# "GLOB" for non-recursive search -set(MY_SRC_SEARCH_MODE "GLOB") - set(MY_PROJ_LIBS dsn_meta_server dsn_replica_server dsn_replication_common dsn_runtime hashtable - gtest - ) - + gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) - -# Extra files that will be installed set(MY_BINPLACES "run.sh" "clear.sh" "config-test.ini" - "gtest.filter" -) - + "gtest.filter") dsn_add_test() diff --git a/src/meta/test/server_state_restore_test.cpp b/src/meta/test/server_state_restore_test.cpp index 96e8de65e5..9e1da9b50c 100644 --- a/src/meta/test/server_state_restore_test.cpp +++ b/src/meta/test/server_state_restore_test.cpp @@ -34,7 +34,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta/server_state.h" -#include "meta_test_base.h" +#include "meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_message.h" #include "runtime/rpc/serialization.h" #include "utils/blob.h" From c72d13d9245c8f2307480478e9e88fb772bb0b12 Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Mon, 12 Jun 2023 00:12:22 +0800 Subject: [PATCH 3/4] build test --- src/meta/meta_test_utils/CMakeLists.txt | 3 +++ src/meta/meta_test_utils/meta_test_base.cpp | 4 ++-- src/meta/test/CMakeLists.txt | 4 +++- src/meta/test/backup_test/CMakeLists.txt | 3 ++- src/meta/test/backup_test/backup_test.cpp | 4 ++-- .../test/balancer_simulator/CMakeLists.txt | 1 + .../balancer_simulator/balancer_simulator.cpp | 2 +- src/meta/test/balancer_validator.cpp | 2 +- src/meta/test/meta_app_envs_test.cpp | 2 +- src/meta/test/meta_app_operation_test.cpp | 4 ++-- src/meta/test/meta_backup_test.cpp | 2 +- .../test/meta_bulk_load_ingestion_test.cpp | 2 +- src/meta/test/meta_bulk_load_service_test.cpp | 2 +- src/meta/test/meta_data.cpp | 2 +- .../test/meta_duplication_service_test.cpp | 4 ++-- src/meta/test/meta_http_service_test.cpp | 2 +- src/meta/test/meta_mauanl_compaction_test.cpp | 2 +- .../test/meta_partition_guardian_test.cpp | 4 ++-- src/meta/test/meta_service_test.cpp | 2 +- src/meta/test/meta_split_service_test.cpp | 2 +- src/meta/test/server_state_restore_test.cpp | 2 +- src/meta/test/state_sync_test.cpp | 2 +- src/meta/test/update_configuration_test.cpp | 2 +- src/test_util/test_main.cpp | 24 +++++++++++++++++++ 24 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 src/test_util/test_main.cpp diff --git a/src/meta/meta_test_utils/CMakeLists.txt b/src/meta/meta_test_utils/CMakeLists.txt index d4dbc5824c..4495799b6c 100644 --- a/src/meta/meta_test_utils/CMakeLists.txt +++ b/src/meta/meta_test_utils/CMakeLists.txt @@ -24,11 +24,14 @@ set(MY_PROJ_NAME meta_test_utils) set(MY_PROJ_SRC "") +set(MY_SRC_SEARCH_MODE "GLOB") set(MY_PROJ_LIBS dsn_meta_server + dsn_replica_server dsn_replication_common dsn_runtime hashtable gtest) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) +set(MY_BINPLACES "") dsn_add_static_library() diff --git a/src/meta/meta_test_utils/meta_test_base.cpp b/src/meta/meta_test_utils/meta_test_base.cpp index a88ed5c191..b94182938b 100644 --- a/src/meta/meta_test_utils/meta_test_base.cpp +++ b/src/meta/meta_test_utils/meta_test_base.cpp @@ -37,11 +37,11 @@ #include "meta/meta_service.h" #include "meta/meta_split_service.h" #include "meta/meta_state_service_utils.h" +#include "meta/meta_test_utils/misc.h" #include "meta/partition_guardian.h" #include "meta/server_load_balancer.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" -#include "../test/meta_service_test_app.h" +#include "meta/test/meta_service_test_app.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task_tracker.h" diff --git a/src/meta/test/CMakeLists.txt b/src/meta/test/CMakeLists.txt index aad8124eb1..3fa23e6e11 100644 --- a/src/meta/test/CMakeLists.txt +++ b/src/meta/test/CMakeLists.txt @@ -26,6 +26,7 @@ set(MY_PROJ_NAME dsn.meta.test) set(MY_PROJ_SRC "") set(MY_PROJ_LIBS dsn.replication.zookeeper_provider + dsn_replica_server dsn_replication_common dsn.block_service dsn.block_service.local @@ -47,7 +48,8 @@ set(MY_PROJ_LIBS crypto gtest ssl - hdfs) + hdfs + meta_test_utils) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) set(MY_BINPLACES clear.sh run.sh config-test.ini suite1 suite2) diff --git a/src/meta/test/backup_test/CMakeLists.txt b/src/meta/test/backup_test/CMakeLists.txt index 54c9c2dae8..100bd189c8 100644 --- a/src/meta/test/backup_test/CMakeLists.txt +++ b/src/meta/test/backup_test/CMakeLists.txt @@ -30,7 +30,8 @@ set(MY_PROJ_LIBS dsn_runtime hashtable gtest - meta_test_utils) + meta_test_utils + test_utils) set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex) set(MY_BINPLACES "../run.sh" diff --git a/src/meta/test/backup_test/backup_test.cpp b/src/meta/test/backup_test/backup_test.cpp index 83c3e472ff..f5114ffcb7 100644 --- a/src/meta/test/backup_test/backup_test.cpp +++ b/src/meta/test/backup_test/backup_test.cpp @@ -41,9 +41,9 @@ #include "meta/meta_service.h" #include "meta/meta_state_service.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "../meta_service_test_app.h" -#include "../meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/api_layer1.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_holder.h" diff --git a/src/meta/test/balancer_simulator/CMakeLists.txt b/src/meta/test/balancer_simulator/CMakeLists.txt index 0c1e0c29be..61997ae515 100644 --- a/src/meta/test/balancer_simulator/CMakeLists.txt +++ b/src/meta/test/balancer_simulator/CMakeLists.txt @@ -25,6 +25,7 @@ set(MY_PROJ_NAME sim_lb) set(MY_PROJ_LIBS dsn_meta_server + dsn_replica_server dsn_replication_common dsn_runtime gtest diff --git a/src/meta/test/balancer_simulator/balancer_simulator.cpp b/src/meta/test/balancer_simulator/balancer_simulator.cpp index 6c3e25feba..0efb6ad1fb 100644 --- a/src/meta/test/balancer_simulator/balancer_simulator.cpp +++ b/src/meta/test/balancer_simulator/balancer_simulator.cpp @@ -39,7 +39,7 @@ #include "meta/greedy_load_balancer.h" #include "meta/meta_data.h" #include "meta/server_load_balancer.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "meta_admin_types.h" #include "runtime/app_model.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/balancer_validator.cpp b/src/meta/test/balancer_validator.cpp index 8e1d456543..ada0d2db6b 100644 --- a/src/meta/test/balancer_validator.cpp +++ b/src/meta/test/balancer_validator.cpp @@ -43,7 +43,7 @@ #include "meta/meta_service.h" #include "meta/partition_guardian.h" #include "meta/server_load_balancer.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" #include "metadata_types.h" diff --git a/src/meta/test/meta_app_envs_test.cpp b/src/meta/test/meta_app_envs_test.cpp index 9c0ae0834e..1a97c60478 100644 --- a/src/meta/test/meta_app_envs_test.cpp +++ b/src/meta/test/meta_app_envs_test.cpp @@ -34,7 +34,7 @@ #include "common/replica_envs.h" #include "meta/meta_data.h" #include "meta_admin_types.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "utils/error_code.h" namespace dsn { diff --git a/src/meta/test/meta_app_operation_test.cpp b/src/meta/test/meta_app_operation_test.cpp index 7aff21ab34..92f38c7d58 100644 --- a/src/meta/test/meta_app_operation_test.cpp +++ b/src/meta/test/meta_app_operation_test.cpp @@ -40,8 +40,8 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_utils/meta_test_base.h" -#include "meta_test_utils/misc.h" +#include "meta/meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/misc.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task_tracker.h" diff --git a/src/meta/test/meta_backup_test.cpp b/src/meta/test/meta_backup_test.cpp index 0e2cccad11..c00d855471 100644 --- a/src/meta/test/meta_backup_test.cpp +++ b/src/meta/test/meta_backup_test.cpp @@ -35,7 +35,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta/server_state.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/api_layer1.h" #include "runtime/rpc/rpc_address.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_bulk_load_ingestion_test.cpp b/src/meta/test/meta_bulk_load_ingestion_test.cpp index dd4b238844..34d1dd2705 100644 --- a/src/meta/test/meta_bulk_load_ingestion_test.cpp +++ b/src/meta/test/meta_bulk_load_ingestion_test.cpp @@ -29,7 +29,7 @@ #include "dsn.layer2_types.h" #include "meta/meta_bulk_load_ingestion_context.h" #include "meta/meta_data.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_address.h" #include "utils/fail_point.h" diff --git a/src/meta/test/meta_bulk_load_service_test.cpp b/src/meta/test/meta_bulk_load_service_test.cpp index 5b02b29918..1fb03967ff 100644 --- a/src/meta/test/meta_bulk_load_service_test.cpp +++ b/src/meta/test/meta_bulk_load_service_test.cpp @@ -50,7 +50,7 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "runtime/rpc/rpc_address.h" #include "utils/blob.h" diff --git a/src/meta/test/meta_data.cpp b/src/meta/test/meta_data.cpp index b61bce6067..941f8094d8 100644 --- a/src/meta/test/meta_data.cpp +++ b/src/meta/test/meta_data.cpp @@ -37,7 +37,7 @@ #include "dsn.layer2_types.h" #include "meta/meta_data.h" #include "metadata_types.h" -#include "meta_test_utils/misc.h" +#include "meta/meta_test_utils/misc.h" #include "runtime/rpc/rpc_address.h" using namespace dsn::replication; diff --git a/src/meta/test/meta_duplication_service_test.cpp b/src/meta/test/meta_duplication_service_test.cpp index 6d98a85ec0..9726e5dc56 100644 --- a/src/meta/test/meta_duplication_service_test.cpp +++ b/src/meta/test/meta_duplication_service_test.cpp @@ -56,8 +56,8 @@ #include "meta/meta_service.h" #include "meta/meta_state_service_utils.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/misc.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_address.h" #include "utils/blob.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_http_service_test.cpp b/src/meta/test/meta_http_service_test.cpp index 7ec573cc2a..77c97cb957 100644 --- a/src/meta/test/meta_http_service_test.cpp +++ b/src/meta/test/meta_http_service_test.cpp @@ -40,7 +40,7 @@ #include "meta/meta_service.h" #include "meta/meta_state_service.h" #include "meta_service_test_app.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_holder.h" #include "runtime/rpc/rpc_message.h" #include "runtime/task/task.h" diff --git a/src/meta/test/meta_mauanl_compaction_test.cpp b/src/meta/test/meta_mauanl_compaction_test.cpp index fe39ff73c6..d18df3f748 100644 --- a/src/meta/test/meta_mauanl_compaction_test.cpp +++ b/src/meta/test/meta_mauanl_compaction_test.cpp @@ -33,7 +33,7 @@ #include "meta/meta_data.h" #include "meta/server_state.h" #include "meta_admin_types.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "utils/error_code.h" diff --git a/src/meta/test/meta_partition_guardian_test.cpp b/src/meta/test/meta_partition_guardian_test.cpp index b81e53af13..54cee9c512 100644 --- a/src/meta/test/meta_partition_guardian_test.cpp +++ b/src/meta/test/meta_partition_guardian_test.cpp @@ -52,10 +52,10 @@ #include "meta/meta_service.h" #include "meta/partition_guardian.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "runtime/rpc/rpc_address.h" #include "runtime/rpc/rpc_message.h" diff --git a/src/meta/test/meta_service_test.cpp b/src/meta/test/meta_service_test.cpp index b8ea5afb13..6aa539de10 100644 --- a/src/meta/test/meta_service_test.cpp +++ b/src/meta/test/meta_service_test.cpp @@ -27,7 +27,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta_admin_types.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/rpc/network.h" #include "runtime/rpc/network.sim.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/meta_split_service_test.cpp b/src/meta/test/meta_split_service_test.cpp index 59523bda0c..d9bc3a9ca3 100644 --- a/src/meta/test/meta_split_service_test.cpp +++ b/src/meta/test/meta_split_service_test.cpp @@ -57,7 +57,7 @@ #include "meta/server_state.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "metadata_types.h" #include "partition_split_types.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/server_state_restore_test.cpp b/src/meta/test/server_state_restore_test.cpp index 9e1da9b50c..b5b78a7dc9 100644 --- a/src/meta/test/server_state_restore_test.cpp +++ b/src/meta/test/server_state_restore_test.cpp @@ -34,7 +34,7 @@ #include "meta/meta_rpc_types.h" #include "meta/meta_service.h" #include "meta/server_state.h" -#include "meta_test_utils/meta_test_base.h" +#include "meta/meta_test_utils/meta_test_base.h" #include "runtime/rpc/rpc_message.h" #include "runtime/rpc/serialization.h" #include "utils/blob.h" diff --git a/src/meta/test/state_sync_test.cpp b/src/meta/test/state_sync_test.cpp index 2e1afacf8f..9c0c7ff49f 100644 --- a/src/meta/test/state_sync_test.cpp +++ b/src/meta/test/state_sync_test.cpp @@ -45,7 +45,7 @@ #include "meta/meta_service.h" #include "meta/meta_state_service.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" #include "runtime/rpc/rpc_address.h" diff --git a/src/meta/test/update_configuration_test.cpp b/src/meta/test/update_configuration_test.cpp index 4feba0923c..9811b9cefc 100644 --- a/src/meta/test/update_configuration_test.cpp +++ b/src/meta/test/update_configuration_test.cpp @@ -52,7 +52,7 @@ #include "meta/meta_service.h" #include "meta/partition_guardian.h" #include "meta/server_state.h" -#include "meta/test/misc/misc.h" +#include "meta/meta_test_utils/misc.h" #include "meta_admin_types.h" #include "meta_service_test_app.h" #include "metadata_types.h" diff --git a/src/test_util/test_main.cpp b/src/test_util/test_main.cpp new file mode 100644 index 0000000000..b911fedcf9 --- /dev/null +++ b/src/test_util/test_main.cpp @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} From 734b4eb444e49986c4b53d4c0438157b6e862b98 Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Mon, 12 Jun 2023 11:46:06 +0800 Subject: [PATCH 4/4] fmt --- src/test_util/test_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test_util/test_main.cpp b/src/test_util/test_main.cpp index b911fedcf9..39c0938825 100644 --- a/src/test_util/test_main.cpp +++ b/src/test_util/test_main.cpp @@ -17,7 +17,8 @@ #include -int main(int argc, char **argv) { +int main(int argc, char **argv) +{ ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS();