syncEnvTest.cpp 806 字节
Newer Older
M
Minghao Li 已提交
1 2 3 4 5
#include "syncEnv.h"
#include <stdio.h>
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.h"
M
Minghao Li 已提交
6
#include "ttime.h"
M
Minghao Li 已提交
7 8 9 10 11 12 13 14 15 16 17

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() {
M
Minghao Li 已提交
18
  // taosInitLog((char*)"syncEnvTest.log", 100000, 10);
M
Minghao Li 已提交
19 20
  tsAsyncLog = 0;
  sDebugFlag = 143 + 64;
M
Minghao Li 已提交
21
  int32_t ret;
M
Minghao Li 已提交
22 23 24 25 26 27

  logTest();

  ret = syncEnvStart();
  assert(ret == 0);

M
Minghao Li 已提交
28 29 30 31 32
  for (int i = 0; i < 5; ++i) {
    ret = syncEnvStartTimer();
    assert(ret == 0);

    taosMsleep(5000);
M
Minghao Li 已提交
33

M
Minghao Li 已提交
34 35 36 37
    ret = syncEnvStopTimer();
    assert(ret == 0);

    taosMsleep(5000);
M
Minghao Li 已提交
38 39
  }

M
Minghao Li 已提交
40 41 42
  ret = syncEnvStop();
  assert(ret == 0);

M
Minghao Li 已提交
43 44
  return 0;
}