提交 c1fd5218 编写于 作者: S slzhou

Merge branch '3.0' of github.com:taosdata/TDengine into szhou/feature/push-project-condition

...@@ -51,6 +51,13 @@ IF(${TD_WINDOWS}) ...@@ -51,6 +51,13 @@ IF(${TD_WINDOWS})
"If build unit tests using googletest" "If build unit tests using googletest"
ON ON
) )
ELSEIF (TD_DARWIN_64)
add_definitions(-DCOMPILER_SUPPORTS_CXX13)
option(
BUILD_TEST
"If build unit tests using googletest"
ON
)
ELSE () ELSE ()
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13) CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13)
......
...@@ -43,6 +43,9 @@ if (taosInitLog("taosdlog", 1) != 0) { ...@@ -43,6 +43,9 @@ if (taosInitLog("taosdlog", 1) != 0) {
} }
void Testbase::Init(const char* path, int16_t port) { void Testbase::Init(const char* path, int16_t port) {
#ifdef _TD_DARWIN_64
osDefaultInit();
#endif
tsServerPort = port; tsServerPort = port;
strcpy(tsLocalFqdn, "localhost"); strcpy(tsLocalFqdn, "localhost");
snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort); snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
......
MESSAGE(STATUS "build parser unit test") MESSAGE(STATUS "build parser unit test")
# GoogleTest requires at least C++11 IF(NOT TD_DARWIN)
SET(CMAKE_CXX_STANDARD 11) # GoogleTest requires at least C++11
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) SET(CMAKE_CXX_STANDARD 11)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
ADD_EXECUTABLE(executorTest ${SOURCE_LIST}) ADD_EXECUTABLE(executorTest ${SOURCE_LIST})
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
executorTest executorTest
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode
) )
TARGET_INCLUDE_DIRECTORIES( TARGET_INCLUDE_DIRECTORIES(
executorTest executorTest
PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/" PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/"
PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc" PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc"
) )
ENDIF ()
\ No newline at end of file
...@@ -75,6 +75,10 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) { ...@@ -75,6 +75,10 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) {
#ifdef WINDOWS #ifdef WINDOWS
GetModuleFileName(NULL, path, PATH_MAX); GetModuleFileName(NULL, path, PATH_MAX);
taosDirName(path); taosDirName(path);
#elif defined(_TD_DARWIN_64)
uint32_t pathSize = sizeof(path);
_NSGetExecutablePath(path, &pathSize);
taosDirName(path);
#endif #endif
} else { } else {
strncpy(path, tsProcPath, strlen(tsProcPath)); strncpy(path, tsProcPath, strlen(tsProcPath));
......
add_executable(idxTest "") IF(NOT TD_DARWIN)
add_executable(idxFstTest "") add_executable(idxTest "")
add_executable(idxFstUT "") add_executable(idxFstTest "")
add_executable(idxUtilUT "") add_executable(idxFstUT "")
add_executable(idxJsonUT "") add_executable(idxUtilUT "")
add_executable(idxJsonUT "")
target_sources(idxTest target_sources(idxTest
PRIVATE PRIVATE
"indexTests.cc" "indexTests.cc"
) )
target_sources(idxFstTest target_sources(idxFstTest
PRIVATE PRIVATE
"fstTest.cc" "fstTest.cc"
) )
target_sources(idxFstUT target_sources(idxFstUT
PRIVATE PRIVATE
"fstUT.cc" "fstUT.cc"
) )
target_sources(idxUtilUT target_sources(idxUtilUT
PRIVATE PRIVATE
"utilUT.cc" "utilUT.cc"
) )
target_sources(idxJsonUT target_sources(idxJsonUT
PRIVATE PRIVATE
"jsonUT.cc" "jsonUT.cc"
) )
target_include_directories (idxTest target_include_directories (idxTest
PUBLIC PUBLIC
"${TD_SOURCE_DIR}/include/libs/index" "${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories (idxFstTest target_include_directories (idxFstTest
PUBLIC PUBLIC
"${TD_SOURCE_DIR}/include/libs/index" "${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories (idxFstUT target_include_directories (idxFstUT
PUBLIC PUBLIC
"${TD_SOURCE_DIR}/include/libs/index" "${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories (idxUtilUT target_include_directories (idxUtilUT
PUBLIC PUBLIC
"${TD_SOURCE_DIR}/include/libs/index" "${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories (idxJsonUT target_include_directories (idxJsonUT
PUBLIC PUBLIC
"${TD_SOURCE_DIR}/include/libs/index" "${TD_SOURCE_DIR}/include/libs/index"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_link_libraries (idxTest target_link_libraries (idxTest
os os
util util
common common
gtest_main gtest_main
index index
) )
target_link_libraries (idxFstTest target_link_libraries (idxFstTest
os os
util util
common common
gtest_main gtest_main
index index
) )
target_link_libraries (idxFstUT target_link_libraries (idxFstUT
os os
util util
common common
gtest_main gtest_main
index index
) )
target_link_libraries (idxUtilUT target_link_libraries (idxUtilUT
os os
util util
common common
gtest_main gtest_main
index index
) )
target_link_libraries (idxJsonUT target_link_libraries (idxJsonUT
os os
util util
common common
gtest_main gtest_main
index index
) )
add_test( add_test(
NAME idxtest NAME idxtest
COMMAND idxTest COMMAND idxTest
) )
add_test( add_test(
NAME idxJsonUT NAME idxJsonUT
COMMAND idxJsonUT COMMAND idxJsonUT
) )
add_test( add_test(
NAME idxUtilUT NAME idxUtilUT
COMMAND idxUtilUT COMMAND idxUtilUT
) )
add_test( add_test(
NAME idxFstUT NAME idxFstUT
COMMAND idxFstUT COMMAND idxFstUT
) )
ENDIF ()
\ No newline at end of file
MESSAGE(STATUS "build planner unit test") MESSAGE(STATUS "build planner unit test")
# GoogleTest requires at least C++11 IF(NOT TD_DARWIN)
SET(CMAKE_CXX_STANDARD 11) # GoogleTest requires at least C++11
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) SET(CMAKE_CXX_STANDARD 11)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
ADD_EXECUTABLE(plannerTest ADD_EXECUTABLE(plannerTest
${SOURCE_LIST} ${SOURCE_LIST}
"${SOURCE_LIST}/../../../parser/test/mockCatalog.cpp" "${SOURCE_LIST}/../../../parser/test/mockCatalog.cpp"
"${SOURCE_LIST}/../../../parser/test/mockCatalogService.cpp" "${SOURCE_LIST}/../../../parser/test/mockCatalogService.cpp"
) )
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
plannerTest plannerTest
PUBLIC os util common nodes planner parser catalog transport gtest function qcom PUBLIC os util common nodes planner parser catalog transport gtest function qcom
) )
TARGET_INCLUDE_DIRECTORIES( TARGET_INCLUDE_DIRECTORIES(
plannerTest plannerTest
PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/" PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/"
PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc" PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc"
PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test" PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test"
) )
if(${BUILD_WINGETOPT}) if(${BUILD_WINGETOPT})
target_include_directories( target_include_directories(
plannerTest plannerTest
PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src" PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src"
) )
target_link_libraries(plannerTest PUBLIC wingetopt) target_link_libraries(plannerTest PUBLIC wingetopt)
endif() endif()
add_test( add_test(
NAME plannerTest NAME plannerTest
COMMAND plannerTest COMMAND plannerTest
) )
ENDIF ()
\ No newline at end of file
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
class TfsTest : public ::testing::Test { class TfsTest : public ::testing::Test {
protected: protected:
#ifdef _TD_DARWIN_64
static void SetUpTestSuite() { root = "/private" TD_TMP_DIR_PATH "tfsTest"; }
#else
static void SetUpTestSuite() { root = TD_TMP_DIR_PATH "tfsTest"; } static void SetUpTestSuite() { root = TD_TMP_DIR_PATH "tfsTest"; }
#endif
static void TearDownTestSuite() {} static void TearDownTestSuite() {}
public: public:
...@@ -299,6 +303,17 @@ TEST_F(TfsTest, 04_File) { ...@@ -299,6 +303,17 @@ TEST_F(TfsTest, 04_File) {
TEST_F(TfsTest, 05_MultiDisk) { TEST_F(TfsTest, 05_MultiDisk) {
int32_t code = 0; int32_t code = 0;
#ifdef _TD_DARWIN_64
const char *root00 = "/private" TD_TMP_DIR_PATH "tfsTest00";
const char *root01 = "/private" TD_TMP_DIR_PATH "tfsTest01";
const char *root10 = "/private" TD_TMP_DIR_PATH "tfsTest10";
const char *root11 = "/private" TD_TMP_DIR_PATH "tfsTest11";
const char *root12 = "/private" TD_TMP_DIR_PATH "tfsTest12";
const char *root20 = "/private" TD_TMP_DIR_PATH "tfsTest20";
const char *root21 = "/private" TD_TMP_DIR_PATH "tfsTest21";
const char *root22 = "/private" TD_TMP_DIR_PATH "tfsTest22";
const char *root23 = "/private" TD_TMP_DIR_PATH "tfsTest23";
#else
const char *root00 = TD_TMP_DIR_PATH "tfsTest00"; const char *root00 = TD_TMP_DIR_PATH "tfsTest00";
const char *root01 = TD_TMP_DIR_PATH "tfsTest01"; const char *root01 = TD_TMP_DIR_PATH "tfsTest01";
const char *root10 = TD_TMP_DIR_PATH "tfsTest10"; const char *root10 = TD_TMP_DIR_PATH "tfsTest10";
...@@ -308,6 +323,7 @@ TEST_F(TfsTest, 05_MultiDisk) { ...@@ -308,6 +323,7 @@ TEST_F(TfsTest, 05_MultiDisk) {
const char *root21 = TD_TMP_DIR_PATH "tfsTest21"; const char *root21 = TD_TMP_DIR_PATH "tfsTest21";
const char *root22 = TD_TMP_DIR_PATH "tfsTest22"; const char *root22 = TD_TMP_DIR_PATH "tfsTest22";
const char *root23 = TD_TMP_DIR_PATH "tfsTest23"; const char *root23 = TD_TMP_DIR_PATH "tfsTest23";
#endif
SDiskCfg dCfg[9] = {0}; SDiskCfg dCfg[9] = {0};
tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN); tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册