未验证 提交 b9abfd67 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17742 from taosdata/fix/TD-19845

fix: failed to start unitest in mac
......@@ -20,7 +20,8 @@ class TestServer {
public:
bool Start();
void Stop();
bool runnning;
private:
TdThread threadId;
};
......
......@@ -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() {
......
......@@ -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;
}
......
......@@ -158,7 +158,7 @@ int32_t taosMulMkDir(const char *dirname) {
#ifdef WINDOWS
code = _mkdir(temp, 0755);
#elif defined(DARWIN)
code = mkdir(dirname, 0777);
code = mkdir(temp, 0777);
#else
code = mkdir(temp, 0755);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册