未验证 提交 d10cce1e 编写于 作者: Y Yang Zhao 提交者: GitHub

fix: add absolute execute file path in taosbenchmark develop test (#12309)

上级 b8c8bc4a
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_auto_create_table.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_auto_create_table.json" % binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -76,7 +99,7 @@ class TDTestCase:
tdSql.query("select distinct(c12) from db.`stb1-2`")
tdSql.checkData(0, 0, None)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/stmt_auto_create_table.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -93,7 +116,7 @@ class TDTestCase:
tdSql.query("select count(*) from db.`stb2-2`")
tdSql.checkData(0, 0, 160)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/rest_auto_create_table.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_auto_create_table.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -110,7 +133,7 @@ class TDTestCase:
tdSql.query("select count(*) from db.`stb3-2`")
tdSql.checkData(0, 0, 160)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_auto_create_table.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_auto_create_table.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -31,8 +31,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -F 7 -H 9 -n 10 -t 2 -x -y -M -C -d newtest -l 5 -A binary,nchar\(31\) -b tinyint,binary\(23\),bool,nchar -w 29 -E -m $%^*"
binPath = self.getPath()
cmd = "%s -F 7 -H 9 -n 10 -t 2 -x -y -M -C -d newtest -l 5 -A binary,nchar\(31\) -b tinyint,binary\(23\),bool,nchar -w 29 -E -m $%^*" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("use newtest")
......@@ -58,7 +81,7 @@ class TDTestCase:
tdSql.checkRows(2)
tdSql.execute("drop database if exists newtest")
cmd = "taosBenchmark -F 7 -n 10 -t 2 -y -M -I stmt"
cmd = "%s -F 7 -n 10 -t 2 -y -M -I stmt" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(tbname) from test.meters")
......@@ -66,55 +89,55 @@ class TDTestCase:
tdSql.query("select count(*) from test.meters")
tdSql.checkData(0, 0, 20)
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 2):
tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 3):
tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I sml 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I sml 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 2):
tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I sml 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I sml 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 3):
tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I stmt 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -I stmt 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 2):
tdLog.exit("expected sleep times 2, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I stmt 2>&1 | grep sleep | wc -l"
cmd = "%s -n 3 -t 3 -B 2 -i 1 -G -y -T 1 -r 1 -I stmt 2>&1 | grep sleep | wc -l" %binPath
sleepTimes = subprocess.check_output(cmd, shell=True).decode("utf-8")
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
if (int(sleepTimes) != 3):
tdLog.exit("expected sleep times 3, actual %d" % int(sleepTimes))
cmd = "taosBenchmark -S 17 -n 3 -t 1 -y -x"
cmd = "%s -S 17 -n 3 -t 1 -y -x" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select last(ts) from test.meters")
tdSql.checkData(0, 0 , "2017-07-14 10:40:00.034")
cmd = "taosBenchmark -N -I taosc -t 11 -n 11 -y -x -E"
cmd = "%s -N -I taosc -t 11 -n 11 -y -x -E" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("use test")
......@@ -125,7 +148,7 @@ class TDTestCase:
tdSql.query("select count(*) from `d10`")
tdSql.checkData(0, 0, 11)
cmd = "taosBenchmark -N -I rest -t 11 -n 11 -y -x"
cmd = "%s -N -I rest -t 11 -n 11 -y -x" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("use test")
......@@ -136,7 +159,7 @@ class TDTestCase:
tdSql.query("select count(*) from d10")
tdSql.checkData(0, 0, 11)
cmd = "taosBenchmark -N -I stmt -t 11 -n 11 -y -x"
cmd = "%s -N -I stmt -t 11 -n 11 -y -x" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("use test")
......@@ -147,134 +170,134 @@ class TDTestCase:
tdSql.query("select count(*) from d10")
tdSql.checkData(0, 0, 11)
cmd = "taosBenchmark -N -I sml -y"
cmd = "%s -N -I sml -y" %binPath
tdLog.info("%s" % cmd)
assert(os.system("%s" % cmd) !=0 )
cmd = "taosBenchmark -n 1 -t 1 -y -b bool"
cmd = "%s -n 1 -t 1 -y -b bool" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "BOOL")
cmd = "taosBenchmark -n 1 -t 1 -y -b tinyint"
cmd = "%s -n 1 -t 1 -y -b tinyint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "TINYINT")
cmd = "taosBenchmark -n 1 -t 1 -y -b utinyint"
cmd = "%s -n 1 -t 1 -y -b utinyint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "TINYINT UNSIGNED")
cmd = "taosBenchmark -n 1 -t 1 -y -b smallint"
cmd = "%s -n 1 -t 1 -y -b smallint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "SMALLINT")
cmd = "taosBenchmark -n 1 -t 1 -y -b usmallint"
cmd = "%s -n 1 -t 1 -y -b usmallint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "SMALLINT UNSIGNED")
cmd = "taosBenchmark -n 1 -t 1 -y -b int"
cmd = "%s -n 1 -t 1 -y -b int" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "INT")
cmd = "taosBenchmark -n 1 -t 1 -y -b uint"
cmd = "%s -n 1 -t 1 -y -b uint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "INT UNSIGNED")
cmd = "taosBenchmark -n 1 -t 1 -y -b bigint"
cmd = "%s -n 1 -t 1 -y -b bigint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "BIGINT")
cmd = "taosBenchmark -n 1 -t 1 -y -b ubigint"
cmd = "%s -n 1 -t 1 -y -b ubigint" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "BIGINT UNSIGNED")
cmd = "taosBenchmark -n 1 -t 1 -y -b timestamp"
cmd = "%s -n 1 -t 1 -y -b timestamp" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "TIMESTAMP")
cmd = "taosBenchmark -n 1 -t 1 -y -b float"
cmd = "%s -n 1 -t 1 -y -b float" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "FLOAT")
cmd = "taosBenchmark -n 1 -t 1 -y -b double"
cmd = "%s -n 1 -t 1 -y -b double" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "DOUBLE")
cmd = "taosBenchmark -n 1 -t 1 -y -b nchar"
cmd = "%s -n 1 -t 1 -y -b nchar" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "NCHAR")
cmd = "taosBenchmark -n 1 -t 1 -y -b nchar\(7\)"
cmd = "%s -n 1 -t 1 -y -b nchar\(7\)" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "NCHAR")
cmd = "taosBenchmark -n 1 -t 1 -y -b binary"
cmd = "%s -n 1 -t 1 -y -b binary" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "BINARY")
cmd = "taosBenchmark -n 1 -t 1 -y -b binary\(7\)"
cmd = "%s -n 1 -t 1 -y -b binary\(7\)" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(1, 1, "BINARY")
cmd = "taosBenchmark -n 1 -t 1 -y -A json\(7\)"
cmd = "%s -n 1 -t 1 -y -A json\(7\)" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("describe test.meters")
tdSql.checkData(4, 1, "JSON")
cmd = "taosBenchmark -n 1 -t 1 -y -b int,x"
cmd = "%s -n 1 -t 1 -y -b int,x" %binPath
tdLog.info("%s" % cmd)
assert(os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -n 1 -t 1 -y -A int,json"
cmd = "%s -n 1 -t 1 -y -A int,json" %binPath
tdLog.info("%s" % cmd)
assert(os.system("%s" % cmd) != 0)
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/custom_col_tag.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/custom_col_tag.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/default.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/default.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -31,8 +31,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -n 100 -t 100 -y"
binPath = self.getPath()
cmd = "%s -n 100 -t 100 -y" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("use test")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_insert_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(*) from db.stb")
......@@ -124,7 +147,7 @@ class TDTestCase:
tdSql.checkData(0, 0, 160)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_insert_alltypes.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_insert_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(*) from db.stb")
......@@ -162,7 +185,7 @@ class TDTestCase:
tdSql.checkData(25, 1, "NCHAR")
tdSql.checkData(26, 1, "NCHAR")
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/rest_insert_alltypes.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_insert_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(*) from db.stb")
......@@ -204,7 +227,7 @@ class TDTestCase:
tdSql.checkData(28, 1, "BINARY")
tdSql.checkData(28, 2, 19)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/stmt_insert_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(*) from db.stb")
......
......@@ -28,34 +28,57 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -F abc -P abc -I abc -T abc -H abc -i abc -S abc -B abc -r abc -t abc -n abc -l abc -w abc -w 16385 -R abc -O abc -a abc -n 2 -t 2 -r 1 -y"
binPath = self.getPath()
cmd = "%s -F abc -P abc -I abc -T abc -H abc -i abc -S abc -B abc -r abc -t abc -n abc -l abc -w abc -w 16385 -R abc -O abc -a abc -n 2 -t 2 -r 1 -y" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.query("select count(*) from test.meters")
tdSql.checkData(0, 0, 4)
cmd = "taosBenchmark non_exist_opt"
cmd = "%s non_exist_opt" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -f non_exist_file"
cmd = "%s -f non_exist_file" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -h non_exist_host"
cmd = "%s -h non_exist_host" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -p non_exist_pass"
cmd = "%s -p non_exist_pass" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -u non_exist_user"
cmd = "%s -u non_exist_user" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) != 0)
cmd = "taosBenchmark -c non_exist_dir -n 1 -t 1 -o non_exist_path -y"
cmd = "%s -c non_exist_dir -n 1 -t 1 -o non_exist_path -y" %binPath
tdLog.info("%s" % cmd)
assert (os.system("%s" % cmd) == 0)
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_json_tag.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_json_tag.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_only_create_table.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_only_create_table.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -48,7 +71,7 @@ class TDTestCase:
tdSql.checkData(28, 2, 64)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_limit_offset.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_limit_offset.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -32,7 +32,30 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
binPath = self.getPath()
os.system("rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0")
tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db")
......@@ -41,7 +64,7 @@ class TDTestCase:
tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)")
tdSql.execute("insert into stb_1 using stb tags (1) values (now, 1)")
tdSql.execute("insert into stb_2 using stb tags (2) values (now, 2)")
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_query.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_query.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
with open("%s" % "taosc_query_specified-0", 'r+') as f1:
......@@ -54,7 +77,7 @@ class TDTestCase:
queryTaosc = line.strip().split()[0]
assert queryTaosc == '1', "result is %s != expect: 1" % queryTaosc
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/rest_query.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_query.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/taosc_sample_use_ts.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/taosc_sample_use_ts.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_interlace.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_interlace.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_json_alltypes.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_json_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_telnet_alltypes.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_telnet_alltypes.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -28,7 +28,30 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
binPath = self.getPath()
tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db")
tdSql.execute("use db")
......@@ -36,11 +59,11 @@ class TDTestCase:
tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)")
tdSql.execute("insert into stb_1 using stb tags (1) values (now, 1)")
tdSql.execute("insert into stb_2 using stb tags (2) values (now, 2)")
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/specified_subscribe.json -g"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/specified_subscribe.json -g" %binPath
tdLog.info("%s" % cmd)
assert os.system("%s" % cmd) == 0
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/super_subscribe.json -g"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/super_subscribe.json -g" %binPath
tdLog.info("%s" % cmd)
assert os.system("%s" % cmd) == 0
......
......@@ -28,8 +28,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_rest_telnet.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_rest_telnet.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -42,7 +65,7 @@ class TDTestCase:
tdSql.query("select count(*) from db.stb2")
tdSql.checkData(0, 0, 160)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_rest_line.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_rest_line.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......@@ -55,7 +78,7 @@ class TDTestCase:
tdSql.query("select count(*) from db2.stb2")
tdSql.checkData(0, 0, 160)
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_rest_json.json"
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_rest_json.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
tdSql.execute("reset query cache")
......
......@@ -29,8 +29,31 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def run(self):
cmd = "taosBenchmark -f ./5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json"
binPath = self.getPath()
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json" %binPath
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
time.sleep(5)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册