You need to sign in or sign up before continuing.
syncTest.cpp 1.4 KB
Newer Older
1
#include <gtest/gtest.h>
M
Minghao Li 已提交
2
#include <stdio.h>
M
Minghao Li 已提交
3 4
#include "syncIO.h"
#include "syncInt.h"
M
Minghao Li 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

/*
typedef enum {
  DEBUG_FATAL = 1,
  DEBUG_ERROR = 1,
  DEBUG_WARN = 2,
  DEBUG_INFO = 2,
  DEBUG_DEBUG = 4,
  DEBUG_TRACE = 8,
  DEBUG_DUMP = 16,
  DEBUG_SCREEN = 64,
  DEBUG_FILE = 128
} ELogLevel;
*/

void logTest(char* s) {
  sFatal("==%s== sync log test: fatal", s);
  sError("==%s== sync log test: error", s);

  sWarn("==%s== sync log test: warn", s);
  sInfo("==%s== sync log test: info", s);

  sDebug("==%s== sync log test: debug", s);

  sTrace("==%s== sync log test: trace", s);
}

void test1() {
  sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test2() {
  sDebugFlag = DEBUG_DEBUG + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test3() {
  sDebugFlag = DEBUG_INFO + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
}

void test4() {
  sDebugFlag = DEBUG_ERROR + DEBUG_SCREEN + DEBUG_FILE;
  logTest((char*)__FUNCTION__);
M
Minghao Li 已提交
50
}
M
Minghao Li 已提交
51

M
Minghao Li 已提交
52
int main(int argc, char** argv) {
M
Minghao Li 已提交
53
  // taosInitLog("tmp/syncTest.log", 100);
M
Minghao Li 已提交
54 55
  tsAsyncLog = 0;

M
Minghao Li 已提交
56 57 58 59 60
  test1();
  test2();
  test3();
  test4();

61 62 63 64 65 66 67 68
  if (argc == 2) {
    bool bTaosDirExist = taosDirExist(argv[1]);
    printf("%s bTaosDirExist:%d \n", argv[1], bTaosDirExist);

    bool bTaosCheckExistFile = taosCheckExistFile(argv[1]);
    printf("%s bTaosCheckExistFile:%d \n", argv[1], bTaosCheckExistFile);
  }

M
Minghao Li 已提交
69
  // taosCloseLog();
M
Minghao Li 已提交
70 71
  return 0;
}