fix: -R -h can coredump and memory leak
This commit is contained in:
parent
338975b9b3
commit
c7e4680e3a
|
@ -78,33 +78,12 @@ class TDTestCase(TBase):
|
||||||
# last line
|
# last line
|
||||||
self.checkSame(rlist[idx][:len(result)], result)
|
self.checkSame(rlist[idx][:len(result)], result)
|
||||||
|
|
||||||
def checkDumpInOutMode(self, source, arg):
|
# -B have some problem need todo
|
||||||
mode = arg[0]
|
self.taos(f'{mode} -B -s "select * from {db}.{stb} where ts < 1"')
|
||||||
self.taos(f'{mode} -s "source {source}" ')
|
|
||||||
|
|
||||||
def checkDumpInOut(self):
|
# get empty result
|
||||||
args = [
|
rlist = self.taos(f'{mode} -s "select * from {db}.{stb} where ts < 1"')
|
||||||
["", 18, 346, -2, 310],
|
self.checkListString(rlist, "Query OK, 0 row(s) in set")
|
||||||
["-R -r", 22, 350, -3, 313],
|
|
||||||
["-T 40 -E http://localhost:6041", 21, 349, -3, 312]
|
|
||||||
]
|
|
||||||
|
|
||||||
source = "cmdline/data/source.sql"
|
|
||||||
|
|
||||||
for arg in args:
|
|
||||||
self.checkDumpInOutMode(source, arg)
|
|
||||||
|
|
||||||
db = "db"
|
|
||||||
insertRows = 5
|
|
||||||
self.taos(f'-s "select * from {db}.d0 >>d0.csv" ')
|
|
||||||
self.taos(f'-s "delete from {db}.d0" ')
|
|
||||||
self.taos(f'-s "insert into {db}.d0 file d0.csv" ')
|
|
||||||
sql = f"select count(*) from {db}.d0"
|
|
||||||
tdSql.checkAgg(sql, insertRows)
|
|
||||||
sql = f"select first(voltage) from {db}.d0"
|
|
||||||
tdSql.checkFirstValue(sql, 1)
|
|
||||||
sql = f"select last(voltage) from {db}.d0"
|
|
||||||
tdSql.checkFirstValue(sql, 5)
|
|
||||||
|
|
||||||
def checkBasic(self):
|
def checkBasic(self):
|
||||||
tdLog.info(f"check describe show full.")
|
tdLog.info(f"check describe show full.")
|
||||||
|
@ -123,6 +102,45 @@ class TDTestCase(TBase):
|
||||||
self.checkResultWithMode(db, stb, arg)
|
self.checkResultWithMode(db, stb, arg)
|
||||||
|
|
||||||
|
|
||||||
|
def checkDumpInOutMode(self, source, arg, db, insertRows):
|
||||||
|
mode = arg[0]
|
||||||
|
self.taos(f'{mode} -s "source {source}" ')
|
||||||
|
self.taos(f'{mode} -s "select * from {db}.d0; >>d0.csv" ')
|
||||||
|
|
||||||
|
# use db
|
||||||
|
rlist = self.taos(f'{mode} -s "use {db};" ')
|
||||||
|
self.checkListString(rlist, "Database changed")
|
||||||
|
# update sql
|
||||||
|
rlist = self.taos(f'{mode} -s "alter local \'resetlog\';" ')
|
||||||
|
self.checkListString(rlist, "Query O")
|
||||||
|
|
||||||
|
# only native support csv import
|
||||||
|
if mode == "":
|
||||||
|
self.taos(f'{mode} -s "delete from {db}.d0" ')
|
||||||
|
self.taos(f'{mode} -s "insert into {db}.d0 file d0.csv" ')
|
||||||
|
|
||||||
|
sql = f"select count(*) from {db}.d0"
|
||||||
|
self.taos(f'{mode} -B -s "{sql}" ')
|
||||||
|
tdSql.checkAgg(sql, insertRows)
|
||||||
|
sql = f"select first(voltage) from {db}.d0"
|
||||||
|
tdSql.checkFirstValue(sql, 1)
|
||||||
|
sql = f"select last(voltage) from {db}.d0"
|
||||||
|
tdSql.checkFirstValue(sql, 5)
|
||||||
|
|
||||||
|
def checkDumpInOut(self):
|
||||||
|
args = [
|
||||||
|
["", 18],
|
||||||
|
["-R ", 22],
|
||||||
|
["-E http://localhost:6041", 21]
|
||||||
|
]
|
||||||
|
|
||||||
|
source = "cmdline/data/source.sql"
|
||||||
|
db = "db"
|
||||||
|
insertRows = 5
|
||||||
|
for arg in args:
|
||||||
|
# insert
|
||||||
|
self.checkDumpInOutMode(source, arg, db, insertRows)
|
||||||
|
|
||||||
def checkVersion(self):
|
def checkVersion(self):
|
||||||
rlist1 = self.taos("-V")
|
rlist1 = self.taos("-V")
|
||||||
rlist2 = self.taos("--version")
|
rlist2 = self.taos("--version")
|
||||||
|
@ -187,8 +205,6 @@ class TDTestCase(TBase):
|
||||||
]
|
]
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
print(arg[0])
|
|
||||||
print(arg[1])
|
|
||||||
rlist = self.taos(arg[0])
|
rlist = self.taos(arg[0])
|
||||||
if arg[1] != None:
|
if arg[1] != None:
|
||||||
self.checkListString(rlist, arg[1])
|
self.checkListString(rlist, arg[1])
|
||||||
|
|
|
@ -122,6 +122,7 @@ void shellCheckServerStatus() {
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
#ifdef WEBSOCKET
|
#ifdef WEBSOCKET
|
||||||
|
char dsn[1024] = "ws://localhost:6041";
|
||||||
void shellCheckConnectMode() {
|
void shellCheckConnectMode() {
|
||||||
if (shell.args.dsn) {
|
if (shell.args.dsn) {
|
||||||
shell.args.cloud = true;
|
shell.args.cloud = true;
|
||||||
|
@ -144,21 +145,22 @@ void shellCheckConnectMode() {
|
||||||
shell.args.restful = false;
|
shell.args.restful = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shell.args.restful) {
|
|
||||||
if (!shell.args.host) {
|
|
||||||
shell.args.host = "localhost";
|
|
||||||
}
|
|
||||||
if (!shell.args.port) {
|
|
||||||
shell.args.port = 6041;
|
|
||||||
}
|
|
||||||
shell.args.dsn = taosMemoryCalloc(1, 1024);
|
|
||||||
snprintf(shell.args.dsn, 1024, "ws://%s:%d",
|
|
||||||
shell.args.host, shell.args.port);
|
|
||||||
}
|
|
||||||
shell.args.cloud = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shell.args.restful) {
|
||||||
|
if (!shell.args.host) {
|
||||||
|
shell.args.host = "localhost";
|
||||||
|
}
|
||||||
|
if (!shell.args.port) {
|
||||||
|
shell.args.port = 6041;
|
||||||
|
}
|
||||||
|
shell.args.dsn = dsn;
|
||||||
|
snprintf(shell.args.dsn, 1024, "ws://%s:%d",
|
||||||
|
shell.args.host, shell.args.port);
|
||||||
|
}
|
||||||
|
shell.args.cloud = false;
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue