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

45 lines
806 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");
}
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-12 04:29:44 +00:00
for (int i = 0; i < 5; ++i) {
ret = syncEnvStartTimer();
assert(ret == 0);
taosMsleep(5000);
2022-02-26 18:24:50 +00:00
2022-03-12 04:29:44 +00:00
ret = syncEnvStopTimer();
assert(ret == 0);
taosMsleep(5000);
2022-02-26 18:24:50 +00:00
}
2022-03-12 04:29:44 +00:00
ret = syncEnvStop();
assert(ret == 0);
2022-02-26 18:24:50 +00:00
return 0;
}