fix: replace getPath() function
This commit is contained in:
parent
5cb8a5de3c
commit
f4e00a2483
|
@ -23,19 +23,27 @@ import frame.epath
|
||||||
import frame.eos
|
import frame.eos
|
||||||
from frame.log import *
|
from frame.log import *
|
||||||
|
|
||||||
|
# taosdump
|
||||||
def taosDumpFile():
|
def taosDumpFile():
|
||||||
bmFile = frame.epath.binFile("taosdump")
|
bmFile = frame.epath.binFile("taosdump")
|
||||||
if frame.eos.isWin():
|
if frame.eos.isWin():
|
||||||
bmFile += ".exe"
|
bmFile += ".exe"
|
||||||
return bmFile
|
return bmFile
|
||||||
|
|
||||||
|
# taosBenchmark
|
||||||
def benchMarkFile():
|
def benchMarkFile():
|
||||||
bmFile = frame.epath.binFile("taosBenchmark")
|
bmFile = frame.epath.binFile("taosBenchmark")
|
||||||
if frame.eos.isWin():
|
if frame.eos.isWin():
|
||||||
bmFile += ".exe"
|
bmFile += ".exe"
|
||||||
return bmFile
|
return bmFile
|
||||||
|
|
||||||
|
# taosAdapter
|
||||||
|
def taosAdapterFile():
|
||||||
|
bmFile = frame.epath.binFile("taosAdapter")
|
||||||
|
if frame.eos.isWin():
|
||||||
|
bmFile += ".exe"
|
||||||
|
return bmFile
|
||||||
|
|
||||||
# run taosBenchmark with command or json file mode
|
# run taosBenchmark with command or json file mode
|
||||||
def benchMark(command = "", json = "") :
|
def benchMark(command = "", json = "") :
|
||||||
# get taosBenchmark path
|
# get taosBenchmark path
|
||||||
|
|
|
@ -22,42 +22,13 @@ from frame.caseBase import *
|
||||||
from frame import *
|
from frame import *
|
||||||
|
|
||||||
|
|
||||||
def etool.benchMarkFile()
|
|
||||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
|
|
||||||
if "community" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("community")]
|
|
||||||
elif "src" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("src")]
|
|
||||||
elif "/tools/" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("/tools/")]
|
|
||||||
elif "/tests/" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("/tests/")]
|
|
||||||
else:
|
|
||||||
tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
|
|
||||||
projPath = "/usr/local/taos/bin/"
|
|
||||||
|
|
||||||
paths = []
|
|
||||||
for root, dummy, 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:
|
|
||||||
return ""
|
|
||||||
return paths[0]
|
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase(TBase):
|
class TDTestCase(TBase):
|
||||||
def caseDescription(self):
|
def caseDescription(self):
|
||||||
"""
|
"""
|
||||||
[TD-21932] taosBenchmark sml test cases
|
[TD-21932] taosBenchmark sml test cases
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
binPath = getPath()
|
binPath = etool.benchMarkFile()
|
||||||
|
|
||||||
cmd = "%s -I sml -t 1 -n 1 -y" % binPath
|
cmd = "%s -I sml -t 1 -n 1 -y" % binPath
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
|
|
|
@ -23,11 +23,6 @@ from frame import *
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase(TBase):
|
class TDTestCase(TBase):
|
||||||
|
|
||||||
now = time.time()
|
|
||||||
self.ts = int(round(now * 1000))
|
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.query("select client_version()")
|
tdSql.query("select client_version()")
|
||||||
client_ver = "".join(tdSql.queryResult[0])
|
client_ver = "".join(tdSql.queryResult[0])
|
||||||
|
|
|
@ -20,49 +20,18 @@ from frame.caseBase import *
|
||||||
from frame import *
|
from frame import *
|
||||||
|
|
||||||
|
|
||||||
def etool.benchMarkFile()
|
|
||||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
|
|
||||||
if "community" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("community")]
|
|
||||||
elif "src" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("src")]
|
|
||||||
elif "/tools/" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("/tools/")]
|
|
||||||
elif "/tests/" in selfPath:
|
|
||||||
projPath = selfPath[: selfPath.find("/tests/")]
|
|
||||||
else:
|
|
||||||
tdLog.info("cannot found %s in path: %s, use system's" % (tool, selfPath))
|
|
||||||
projPath = "/usr/local/taos/bin/"
|
|
||||||
|
|
||||||
paths = []
|
|
||||||
for root, dummy, 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]
|
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase(TBase):
|
class TDTestCase(TBase):
|
||||||
def caseDescription(self):
|
def caseDescription(self):
|
||||||
"""
|
"""
|
||||||
[TD-21932] taosBenchmark sml test cases
|
[TD-21932] taosBenchmark sml test cases
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.query("select client_version()")
|
tdSql.query("select client_version()")
|
||||||
client_ver = "".join(tdSql.queryResult[0])
|
client_ver = "".join(tdSql.queryResult[0])
|
||||||
major_ver = client_ver.split(".")[0]
|
major_ver = client_ver.split(".")[0]
|
||||||
|
|
||||||
binPath = getPath()
|
binPath = etool.benchMarkFile()
|
||||||
cmd = "%s -f ./tools/benchmark/basic/json/sml_taosjson_alltypes.json" % binPath
|
cmd = "%s -f ./tools/benchmark/basic/json/sml_taosjson_alltypes.json" % binPath
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
os.system("%s" % cmd)
|
os.system("%s" % cmd)
|
||||||
|
|
|
@ -33,18 +33,6 @@ class TDTestCase(TBase):
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
os.system("%s" % cmd)
|
os.system("%s" % cmd)
|
||||||
|
|
||||||
'''
|
|
||||||
taosPath = self.getPath("taos")
|
|
||||||
cmd = f"{taosPath} -s 'select count(*) from test.meters'"
|
|
||||||
tdLog.info(f"{cmd}")
|
|
||||||
cmdOutput = subprocess.check_output(cmd, shell=True).decode("utf-8")
|
|
||||||
tdLog.info(f"{cmdOutput}")
|
|
||||||
if "20 |" in cmdOutput:
|
|
||||||
tdLog.info("count of records is correct!")
|
|
||||||
else:
|
|
||||||
tdLog.exit("count of records is incorrect")
|
|
||||||
'''
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
|
@ -71,7 +71,7 @@ class TDTestCase:
|
||||||
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
|
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
|
|
||||||
binPath = self.etool.taosDumpFile()
|
binPath = etool.taosDumpFile()
|
||||||
if binPath == "":
|
if binPath == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -68,7 +68,7 @@ class TDTestCase:
|
||||||
break
|
break
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
|
|
||||||
binPath = self.etool.taosDumpFile()
|
binPath = etool.taosDumpFile()
|
||||||
if binPath == "":
|
if binPath == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -110,7 +110,7 @@ class TDTestCase:
|
||||||
if not os.path.exists("./taosdumptest/dumptmp3"):
|
if not os.path.exists("./taosdumptest/dumptmp3"):
|
||||||
os.makedirs("./taosdumptest/dumptmp3")
|
os.makedirs("./taosdumptest/dumptmp3")
|
||||||
|
|
||||||
binPath = self.etool.taosDumpFile()
|
binPath = etool.taosDumpFile()
|
||||||
if binPath == "":
|
if binPath == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TDTestCase:
|
||||||
|
|
||||||
def findPrograme(self):
|
def findPrograme(self):
|
||||||
# taosdump
|
# taosdump
|
||||||
taosdump = self.etool.taosDumpFile()
|
taosdump = etool.taosDumpFile()
|
||||||
if taosdump == "":
|
if taosdump == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -38,7 +38,7 @@ class TDTestCase:
|
||||||
|
|
||||||
def findPrograme(self):
|
def findPrograme(self):
|
||||||
# taosdump
|
# taosdump
|
||||||
taosdump = self.etool.taosDumpFile()
|
taosdump = etool.taosDumpFile()
|
||||||
if taosdump == "":
|
if taosdump == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TDTestCase:
|
||||||
|
|
||||||
def findPrograme(self):
|
def findPrograme(self):
|
||||||
# taosdump
|
# taosdump
|
||||||
taosdump = self.etool.taosDumpFile()
|
taosdump = etool.taosDumpFile()
|
||||||
if taosdump == "":
|
if taosdump == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -53,16 +53,13 @@ class TDTestCase:
|
||||||
case1<sdsang>: [TS-3072] taosdump dump escaped db name test
|
case1<sdsang>: [TS-3072] taosdump dump escaped db name test
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def exec(self, command):
|
def exec(self, command):
|
||||||
tdLog.info(command)
|
tdLog.info(command)
|
||||||
return os.system(command)
|
return os.system(command)
|
||||||
|
|
||||||
def findPrograme(self):
|
def findPrograme(self):
|
||||||
# taosdump
|
# taosdump
|
||||||
taosdump = self.etool.taosDumpFile()
|
taosdump = etool.taosDumpFile()
|
||||||
if taosdump == "":
|
if taosdump == "":
|
||||||
tdLog.exit("taosdump not found!")
|
tdLog.exit("taosdump not found!")
|
||||||
else:
|
else:
|
||||||
|
@ -76,7 +73,7 @@ class TDTestCase:
|
||||||
tdLog.info("benchmark found in %s" % benchmark)
|
tdLog.info("benchmark found in %s" % benchmark)
|
||||||
|
|
||||||
# taosadapter
|
# taosadapter
|
||||||
taosadapter = self.getPath("taosadapter")
|
taosadapter = etool.taosAdapterFile()
|
||||||
if taosadapter == "":
|
if taosadapter == "":
|
||||||
tdLog.exit("taosadapter not found!")
|
tdLog.exit("taosadapter not found!")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue