diff --git a/cmake/cmake.options b/cmake/cmake.options index 86096c18fe5cc5955e96827d6c6d1d286ba7f574..09236a5b87cc862097403036c2a9609c99ca52bd 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -51,6 +51,13 @@ IF(${TD_WINDOWS}) "If build unit tests using googletest" ON ) +ELSEIF (TD_DARWIN_64) + add_definitions(-DCOMPILER_SUPPORTS_CXX13) + option( + BUILD_TEST + "If build unit tests using googletest" + ON + ) ELSE () include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13) diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index a5e612880080c1a027678040487f997f63b4ff2a..572c57284a9516a8f469f4de1b79d92946a63314 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -43,6 +43,9 @@ if (taosInitLog("taosdlog", 1) != 0) { } void Testbase::Init(const char* path, int16_t port) { +#ifdef _TD_DARWIN_64 + osDefaultInit(); +#endif tsServerPort = port; strcpy(tsLocalFqdn, "localhost"); snprintf(tsLocalEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort); diff --git a/source/libs/executor/test/CMakeLists.txt b/source/libs/executor/test/CMakeLists.txt index 129509d6c692099711f5aa7c699dee673c47467d..acab27ec0876b881dc72aca67927ea3359ef9d57 100644 --- a/source/libs/executor/test/CMakeLists.txt +++ b/source/libs/executor/test/CMakeLists.txt @@ -1,18 +1,20 @@ MESSAGE(STATUS "build parser unit test") -# GoogleTest requires at least C++11 -SET(CMAKE_CXX_STANDARD 11) -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) +IF(NOT TD_DARWIN) + # GoogleTest requires at least C++11 + SET(CMAKE_CXX_STANDARD 11) + AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) -ADD_EXECUTABLE(executorTest ${SOURCE_LIST}) -TARGET_LINK_LIBRARIES( - executorTest - PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode -) + ADD_EXECUTABLE(executorTest ${SOURCE_LIST}) + TARGET_LINK_LIBRARIES( + executorTest + PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode + ) -TARGET_INCLUDE_DIRECTORIES( - executorTest - PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/" - PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc" -) + TARGET_INCLUDE_DIRECTORIES( + executorTest + PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/" + PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc" + ) +ENDIF () \ No newline at end of file diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 1bc759e833272b674455a846297cea56ea2eda49..dcf6676f9fe5505059e31c80279449bd01c83cd7 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -75,6 +75,10 @@ static int32_t udfSpawnUdfd(SUdfdData* pData) { #ifdef WINDOWS GetModuleFileName(NULL, path, PATH_MAX); taosDirName(path); + #elif defined(_TD_DARWIN_64) + uint32_t pathSize = sizeof(path); + _NSGetExecutablePath(path, &pathSize); + taosDirName(path); #endif } else { strncpy(path, tsProcPath, strlen(tsProcPath)); diff --git a/source/libs/index/test/CMakeLists.txt b/source/libs/index/test/CMakeLists.txt index 040460ae5c9662404182b93780075cc88cb93c57..9a4b7bbad8d34fd99e5160e3414dc7c77421633f 100644 --- a/source/libs/index/test/CMakeLists.txt +++ b/source/libs/index/test/CMakeLists.txt @@ -1,110 +1,112 @@ -add_executable(idxTest "") -add_executable(idxFstTest "") -add_executable(idxFstUT "") -add_executable(idxUtilUT "") -add_executable(idxJsonUT "") +IF(NOT TD_DARWIN) + add_executable(idxTest "") + add_executable(idxFstTest "") + add_executable(idxFstUT "") + add_executable(idxUtilUT "") + add_executable(idxJsonUT "") -target_sources(idxTest - PRIVATE - "indexTests.cc" -) -target_sources(idxFstTest - PRIVATE - "fstTest.cc" -) + target_sources(idxTest + PRIVATE + "indexTests.cc" + ) + target_sources(idxFstTest + PRIVATE + "fstTest.cc" + ) -target_sources(idxFstUT - PRIVATE - "fstUT.cc" -) -target_sources(idxUtilUT - PRIVATE - "utilUT.cc" -) + target_sources(idxFstUT + PRIVATE + "fstUT.cc" + ) + target_sources(idxUtilUT + PRIVATE + "utilUT.cc" + ) -target_sources(idxJsonUT - PRIVATE - "jsonUT.cc" -) -target_include_directories (idxTest - PUBLIC - "${TD_SOURCE_DIR}/include/libs/index" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) -target_include_directories (idxFstTest - PUBLIC - "${TD_SOURCE_DIR}/include/libs/index" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) + target_sources(idxJsonUT + PRIVATE + "jsonUT.cc" + ) + target_include_directories (idxTest + PUBLIC + "${TD_SOURCE_DIR}/include/libs/index" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) + target_include_directories (idxFstTest + PUBLIC + "${TD_SOURCE_DIR}/include/libs/index" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) -target_include_directories (idxFstUT - PUBLIC - "${TD_SOURCE_DIR}/include/libs/index" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) + target_include_directories (idxFstUT + PUBLIC + "${TD_SOURCE_DIR}/include/libs/index" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) -target_include_directories (idxUtilUT - PUBLIC - "${TD_SOURCE_DIR}/include/libs/index" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) + target_include_directories (idxUtilUT + PUBLIC + "${TD_SOURCE_DIR}/include/libs/index" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) -target_include_directories (idxJsonUT - PUBLIC - "${TD_SOURCE_DIR}/include/libs/index" - "${CMAKE_CURRENT_SOURCE_DIR}/../inc" -) -target_link_libraries (idxTest - os - util - common - gtest_main - index -) -target_link_libraries (idxFstTest - os - util - common - gtest_main - index -) -target_link_libraries (idxFstUT - os - util - common - gtest_main - index -) + target_include_directories (idxJsonUT + PUBLIC + "${TD_SOURCE_DIR}/include/libs/index" + "${CMAKE_CURRENT_SOURCE_DIR}/../inc" + ) + target_link_libraries (idxTest + os + util + common + gtest_main + index + ) + target_link_libraries (idxFstTest + os + util + common + gtest_main + index + ) + target_link_libraries (idxFstUT + os + util + common + gtest_main + index + ) -target_link_libraries (idxUtilUT - os - util - common - gtest_main - index -) + target_link_libraries (idxUtilUT + os + util + common + gtest_main + index + ) -target_link_libraries (idxJsonUT - os - util - common - gtest_main - index -) + target_link_libraries (idxJsonUT + os + util + common + gtest_main + index + ) -add_test( - NAME idxtest - COMMAND idxTest -) -add_test( - NAME idxJsonUT - COMMAND idxJsonUT -) -add_test( - NAME idxUtilUT - COMMAND idxUtilUT -) -add_test( - NAME idxFstUT - COMMAND idxFstUT -) + add_test( + NAME idxtest + COMMAND idxTest + ) + add_test( + NAME idxJsonUT + COMMAND idxJsonUT + ) + add_test( + NAME idxUtilUT + COMMAND idxUtilUT + ) + add_test( + NAME idxFstUT + COMMAND idxFstUT + ) +ENDIF () \ No newline at end of file diff --git a/source/libs/planner/test/CMakeLists.txt b/source/libs/planner/test/CMakeLists.txt index a21b36fef6b3eecc51bdbe4abbb7fff3dc065098..b9d5c85717c71cdcb73cf660ac796541896c85e0 100644 --- a/source/libs/planner/test/CMakeLists.txt +++ b/source/libs/planner/test/CMakeLists.txt @@ -1,38 +1,40 @@ MESSAGE(STATUS "build planner unit test") -# GoogleTest requires at least C++11 -SET(CMAKE_CXX_STANDARD 11) -AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) +IF(NOT TD_DARWIN) + # GoogleTest requires at least C++11 + SET(CMAKE_CXX_STANDARD 11) + AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) -ADD_EXECUTABLE(plannerTest + ADD_EXECUTABLE(plannerTest ${SOURCE_LIST} "${SOURCE_LIST}/../../../parser/test/mockCatalog.cpp" "${SOURCE_LIST}/../../../parser/test/mockCatalogService.cpp" -) + ) -TARGET_LINK_LIBRARIES( - plannerTest - PUBLIC os util common nodes planner parser catalog transport gtest function qcom -) + TARGET_LINK_LIBRARIES( + plannerTest + PUBLIC os util common nodes planner parser catalog transport gtest function qcom + ) -TARGET_INCLUDE_DIRECTORIES( - plannerTest - PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/" - PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc" - PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test" -) + TARGET_INCLUDE_DIRECTORIES( + plannerTest + PUBLIC "${TD_SOURCE_DIR}/include/libs/planner/" + PRIVATE "${TD_SOURCE_DIR}/source/libs/planner/inc" + PRIVATE "${TD_SOURCE_DIR}/source/libs/parser/test" + ) -if(${BUILD_WINGETOPT}) - target_include_directories( - plannerTest - PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src" - ) - target_link_libraries(plannerTest PUBLIC wingetopt) -endif() + if(${BUILD_WINGETOPT}) + target_include_directories( + plannerTest + PUBLIC "${TD_SOURCE_DIR}/contrib/wingetopt/src" + ) + target_link_libraries(plannerTest PUBLIC wingetopt) + endif() -add_test( - NAME plannerTest - COMMAND plannerTest -) + add_test( + NAME plannerTest + COMMAND plannerTest + ) +ENDIF () \ No newline at end of file diff --git a/source/libs/tfs/test/tfsTest.cpp b/source/libs/tfs/test/tfsTest.cpp index d53c4a49ba068dd96fc8629efbbab3f0cedc36d9..b7858a22ebce50046e48ab05a32874639ab43aba 100644 --- a/source/libs/tfs/test/tfsTest.cpp +++ b/source/libs/tfs/test/tfsTest.cpp @@ -16,7 +16,11 @@ class TfsTest : public ::testing::Test { 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"; } +#endif static void TearDownTestSuite() {} public: @@ -299,6 +303,17 @@ TEST_F(TfsTest, 04_File) { TEST_F(TfsTest, 05_MultiDisk) { 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 *root01 = TD_TMP_DIR_PATH "tfsTest01"; const char *root10 = TD_TMP_DIR_PATH "tfsTest10"; @@ -308,6 +323,7 @@ TEST_F(TfsTest, 05_MultiDisk) { const char *root21 = TD_TMP_DIR_PATH "tfsTest21"; const char *root22 = TD_TMP_DIR_PATH "tfsTest22"; const char *root23 = TD_TMP_DIR_PATH "tfsTest23"; +#endif SDiskCfg dCfg[9] = {0}; tstrncpy(dCfg[0].dir, root01, TSDB_FILENAME_LEN);