diff --git a/source/dnode/mgmt/test/sut/inc/server.h b/source/dnode/mgmt/test/sut/inc/server.h index 69581e52e281d3b8627884153551b21dd2648330..7343276210499ff713cef24b29c36e98b1f00809 100644 --- a/source/dnode/mgmt/test/sut/inc/server.h +++ b/source/dnode/mgmt/test/sut/inc/server.h @@ -20,7 +20,8 @@ class TestServer { public: bool Start(); void Stop(); - +bool runnning; + private: TdThread threadId; }; diff --git a/source/dnode/mgmt/test/sut/src/server.cpp b/source/dnode/mgmt/test/sut/src/server.cpp index 98c59a1614303c4c8a342d1d63ab39e9116214fd..81e6dcf4959df1835f64203547e7d5580c82a6fb 100644 --- a/source/dnode/mgmt/test/sut/src/server.cpp +++ b/source/dnode/mgmt/test/sut/src/server.cpp @@ -16,8 +16,18 @@ #include "sut.h" void* serverLoop(void* param) { - dmInit(); - dmRun(); + TestServer* server = (TestServer*)param; + server->runnning = false; + + if (dmInit() != 0) { + return NULL; + } + + server->runnning = true; + if (dmRun() != 0) { + return NULL; + } + dmCleanup(); return NULL; } @@ -26,10 +36,10 @@ bool TestServer::Start() { TdThreadAttr thAttr; taosThreadAttrInit(&thAttr); taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); - taosThreadCreate(&threadId, &thAttr, serverLoop, NULL); + taosThreadCreate(&threadId, &thAttr, serverLoop, this); taosThreadAttrDestroy(&thAttr); taosMsleep(2100); - return true; + return runnning; } void TestServer::Stop() { diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index a4d2e4688179b7161c03837b5478b197a6576bca..b54590ce82702c6987b8039eee423d7194151549 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -53,7 +53,10 @@ void Testbase::Init(const char* path, int16_t port) { taosMkDir(path); InitLog(TD_TMP_DIR_PATH "td"); - server.Start(); + if (!server.Start()) { + printf("failed to start server, exit\n"); + exit(0); + }; client.Init("root", "taosdata"); showRsp = NULL; }