TDengine/source/libs/sync/test/syncEnvTest.cpp

47 lines
996 B
C++
Raw Normal View History

2022-02-26 18:24:50 +00:00
#include "syncEnv.h"
#include <stdio.h>
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.h"
2022-03-09 10:33:41 +00:00
#include "ttime.h"
2022-02-26 18:24:50 +00:00
void logTest() {
sTrace("--- sync log test: trace");
sDebug("--- sync log test: debug");
sInfo("--- sync log test: info");
sWarn("--- sync log test: warn");
sError("--- sync log test: error");
sFatal("--- sync log test: fatal");
}
2022-03-09 10:33:41 +00:00
void *pTimer = NULL;
void *pTimerMgr = NULL;
int g = 300;
2022-02-26 18:24:50 +00:00
2022-03-09 10:33:41 +00:00
static void timerFp(void *param, void *tmrId) {
printf("param:%p, tmrId:%p, pTimer:%p, pTimerMgr:%p \n", param, tmrId, pTimer, pTimerMgr);
taosTmrReset(timerFp, 1000, param, pTimerMgr, &pTimer);
2022-02-26 18:24:50 +00:00
}
int main() {
2022-02-28 06:10:34 +00:00
// taosInitLog((char*)"syncEnvTest.log", 100000, 10);
2022-02-26 18:24:50 +00:00
tsAsyncLog = 0;
sDebugFlag = 143 + 64;
2022-02-28 06:10:34 +00:00
int32_t ret;
2022-02-26 18:24:50 +00:00
logTest();
ret = syncEnvStart();
assert(ret == 0);
2022-03-09 10:33:41 +00:00
// timer
pTimerMgr = taosTmrInit(1000, 50, 10000, "SYNC-ENV-TEST");
taosTmrStart(timerFp, 1000, &g, pTimerMgr);
2022-02-26 18:24:50 +00:00
while (1) {
taosMsleep(1000);
}
return 0;
}