Merge pull request #24073 from taosdata/enh/xsren/TD-27724/utest

enh: osSystemTest
This commit is contained in:
dapan1121 2023-12-18 09:12:03 +08:00 committed by GitHub
commit bf151eafdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -38,4 +38,25 @@ TEST(osSystemTest, osSystem1) {
#else
taosLogTraceToBuf(tmp, sizeof(tmp), 8);
#endif
double cpu_engine;
double cpu_system;
float cpu_cores;
int64_t mem_engine; // KB
int64_t mem_system; // KB
taosGetCpuUsage(&cpu_system, &cpu_engine);
taosGetCpuCores(&cpu_cores, false);
taosGetProcMemory(&mem_engine);
taosGetSysMemory(&mem_system);
printf("cpu_engine: %f cpu_system: %f\n", cpu_engine, cpu_system);
printf("cpu_cores: %f\n", cpu_cores);
ASSERT_GT(cpu_cores, 0);
ASSERT_GE(mem_engine, 0);
ASSERT_GE(mem_system, 0);
float numOfCores = 0;
int32_t res = taosGetCpuInfo(tmp, 4096, &numOfCores);
printf("cpu info: %s\n", tmp);
ASSERT_EQ(res, 0);
}

View File

@ -24,7 +24,7 @@ from util.common import *
from util.sqlset import TDSetSql
class TDTestCase:
updatecfgDict = {'tsdbdebugFlag': 143}
updatecfgDict = {'tsdbdebugFlag': 131}
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
@ -36,7 +36,7 @@ class TDTestCase:
self.setsql = TDSetSql()
self.stbname = 'stb'
self.ntbname = 'ntb'
self.rowNum = 10
self.rowNum = 3
self.tbnum = 3
self.ts = 1537146000000
self.binary_str = 'taosdata'