提交 51ceed98 编写于 作者: M Minghao Li

sync io test

上级 1336e08a
...@@ -4,8 +4,8 @@ add_executable(syncPingTimerTest "") ...@@ -4,8 +4,8 @@ add_executable(syncPingTimerTest "")
add_executable(syncIOTickQTest "") add_executable(syncIOTickQTest "")
add_executable(syncIOTickPingTest "") add_executable(syncIOTickPingTest "")
add_executable(syncIOSendMsgTest "") add_executable(syncIOSendMsgTest "")
add_executable(syncIOSendMsgClientTest "") add_executable(syncIOClientTest "")
add_executable(syncIOSendMsgServerTest "") add_executable(syncIOServerTest "")
add_executable(syncRaftStoreTest "") add_executable(syncRaftStoreTest "")
add_executable(syncEnqTest "") add_executable(syncEnqTest "")
add_executable(syncIndexTest "") add_executable(syncIndexTest "")
...@@ -51,13 +51,13 @@ target_sources(syncIOSendMsgTest ...@@ -51,13 +51,13 @@ target_sources(syncIOSendMsgTest
PRIVATE PRIVATE
"syncIOSendMsgTest.cpp" "syncIOSendMsgTest.cpp"
) )
target_sources(syncIOSendMsgClientTest target_sources(syncIOClientTest
PRIVATE PRIVATE
"syncIOSendMsgClientTest.cpp" "syncIOClientTest.cpp"
) )
target_sources(syncIOSendMsgServerTest target_sources(syncIOServerTest
PRIVATE PRIVATE
"syncIOSendMsgServerTest.cpp" "syncIOServerTest.cpp"
) )
target_sources(syncRaftStoreTest target_sources(syncRaftStoreTest
PRIVATE PRIVATE
...@@ -167,12 +167,12 @@ target_include_directories(syncIOSendMsgTest ...@@ -167,12 +167,12 @@ target_include_directories(syncIOSendMsgTest
"${CMAKE_SOURCE_DIR}/include/libs/sync" "${CMAKE_SOURCE_DIR}/include/libs/sync"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories(syncIOSendMsgClientTest target_include_directories(syncIOClientTest
PUBLIC PUBLIC
"${CMAKE_SOURCE_DIR}/include/libs/sync" "${CMAKE_SOURCE_DIR}/include/libs/sync"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
) )
target_include_directories(syncIOSendMsgServerTest target_include_directories(syncIOServerTest
PUBLIC PUBLIC
"${CMAKE_SOURCE_DIR}/include/libs/sync" "${CMAKE_SOURCE_DIR}/include/libs/sync"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc" "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
...@@ -298,11 +298,11 @@ target_link_libraries(syncIOSendMsgTest ...@@ -298,11 +298,11 @@ target_link_libraries(syncIOSendMsgTest
sync sync
gtest_main gtest_main
) )
target_link_libraries(syncIOSendMsgClientTest target_link_libraries(syncIOClientTest
sync sync
gtest_main gtest_main
) )
target_link_libraries(syncIOSendMsgServerTest target_link_libraries(syncIOServerTest
sync sync
gtest_main gtest_main
) )
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
#include <stdio.h> #include <stdio.h>
#include "syncIO.h" #include "syncIO.h"
#include "syncInt.h" #include "syncInt.h"
#include "syncRaftStore.h" #include "syncMessage.h"
#include "syncUtil.h"
void logTest() { void logTest() {
sTrace("--- sync log test: trace"); sTrace("--- sync log test: trace");
...@@ -22,7 +23,7 @@ int main() { ...@@ -22,7 +23,7 @@ int main() {
int32_t ret; int32_t ret;
ret = syncIOStart((char *)"127.0.0.1", 7010); ret = syncIOStart((char*)"127.0.0.1", 7010);
assert(ret == 0); assert(ret == 0);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
...@@ -31,18 +32,17 @@ int main() { ...@@ -31,18 +32,17 @@ int main() {
epSet.numOfEps = 0; epSet.numOfEps = 0;
addEpIntoEpSet(&epSet, "127.0.0.1", 7030); addEpIntoEpSet(&epSet, "127.0.0.1", 7030);
SRpcMsg rpcMsg; SRaftId srcId, destId;
rpcMsg.contLen = 64; srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234);
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); srcId.vgId = 100;
snprintf((char *)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest"); destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
rpcMsg.handle = NULL; destId.vgId = 100;
rpcMsg.msgType = 77;
syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg); SyncPingReply* pSyncMsg = syncPingReplyBuild2(&srcId, &destId, "syncIOClientTest");
taosSsleep(1); SRpcMsg rpcMsg;
} syncPingReply2RpcMsg(pSyncMsg, &rpcMsg);
while (1) { syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
taosSsleep(1); taosSsleep(1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册