diff --git a/tests/army/frame/etool.py b/tests/army/frame/etool.py index 0650d4a0e2..67af4f93c9 100644 --- a/tests/army/frame/etool.py +++ b/tests/army/frame/etool.py @@ -23,12 +23,23 @@ import frame.epath import frame.eos from frame.log import * -# run taosBenchmark with command or json file mode -def benchMark(command = "", json = "") : - # get taosBenchmark path +def taosDumpFile(): + bmFile = frame.epath.binFile("taosdump") + if frame.eos.isWin(): + bmFile += ".exe" + return bmFile + + +def benchMarkFile(): bmFile = frame.epath.binFile("taosBenchmark") if frame.eos.isWin(): bmFile += ".exe" + return bmFile + +# run taosBenchmark with command or json file mode +def benchMark(command = "", json = "") : + # get taosBenchmark path + bmFile = benchMarkFile() # run if command != "": diff --git a/tests/army/tools/benchmark/basic/bugs.py b/tests/army/tools/benchmark/basic/bugs.py index ec20a7e995..2d5b0c46fc 100644 --- a/tests/army/tools/benchmark/basic/bugs.py +++ b/tests/army/tools/benchmark/basic/bugs.py @@ -12,10 +12,14 @@ # -*- coding: utf-8 -*- import os import json -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * + +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * # reomve single and double quotation @@ -27,42 +31,12 @@ def removeQuotation(origin): return value -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] - def testBenchmarkJson(self, benchmark, jsonFile, options="", checkStep=False): # exe insert cmd = f"{benchmark} {options} -f {jsonFile}" @@ -132,33 +106,33 @@ class TDTestCase: # bugs ts def bugsTS(self, benchmark): - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5002.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TS-5002.json") # TS-5234 - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-1.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-2.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-3.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TS-5234-1.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TS-5234-2.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TS-5234-3.json") # bugs td def bugsTD(self, benchmark): - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-31490.json", checkStep = False) - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-31575.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32846.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-31490.json", checkStep = False) + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-31575.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-32846.json") # no drop db = "td32913db" vgroups = 4 tdSql.execute(f"create database {db} vgroups {vgroups}") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913.json", options="-Q") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-32913.json", options="-Q") tdSql.query(f"select `vgroups` from information_schema.ins_databases where name='{db}';") tdSql.checkData(0, 0, vgroups) # other - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-1.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-2.json", options="-T 6") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TD-32913-3.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-32913-1.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-32913-2.json", options="-T 6") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/TD-32913-3.json") def run(self): - benchmark = self.getPath() + benchmark = etool.benchMarkFile() # ts self.bugsTS(benchmark) diff --git a/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py b/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py index da6869a9ee..70ecaea1cf 100644 --- a/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py +++ b/tests/army/tools/benchmark/basic/commandline-partial-col-numpy.py @@ -12,50 +12,23 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19387] taosBenchmark support partial columns num """ - def init(self, conn, logSql): - 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")] - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 1 -n 1 -y -L 2 " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/commandline-retry.py b/tests/army/tools/benchmark/basic/commandline-retry.py index c8ff17a3ba..869532ba92 100644 --- a/tests/army/tools/benchmark/basic/commandline-retry.py +++ b/tests/army/tools/benchmark/basic/commandline-retry.py @@ -13,50 +13,25 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19985] taosBenchmark retry test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( "%s -t 1 -n 10 -i 1000 -r 1 -k 10 -z 1000 -y &" # "%s -t 1 -n 10 -i 5000 -r 1 -y &" diff --git a/tests/army/tools/benchmark/basic/commandline-single-table.py b/tests/army/tools/benchmark/basic/commandline-single-table.py index 7fe1d097d9..892f875c2f 100644 --- a/tests/army/tools/benchmark/basic/commandline-single-table.py +++ b/tests/army/tools/benchmark/basic/commandline-single-table.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21063] taosBenchmark single table test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -N -I taosc -t 1 -n 1 -y -E" % binPath tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/commandline-sml-rest.py b/tests/army/tools/benchmark/basic/commandline-sml-rest.py index b9277c115f..3f5bcd8040 100644 --- a/tests/army/tools/benchmark/basic/commandline-sml-rest.py +++ b/tests/army/tools/benchmark/basic/commandline-sml-rest.py @@ -12,51 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -def getPath(tool="taosBenchmark"): - 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: +class TDTestCase(TBase): def caseDescription(self): """ [TD-22334] taosBenchmark sml rest test cases """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) def run(self): - binPath = getPath() + binPath = etool.benchMarkFile() cmd = "%s -I sml-rest -t 1 -n 1 -y" % binPath tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/commandline-sml.py b/tests/army/tools/benchmark/basic/commandline-sml.py index 9994b35c61..a24bb515a7 100644 --- a/tests/army/tools/benchmark/basic/commandline-sml.py +++ b/tests/army/tools/benchmark/basic/commandline-sml.py @@ -13,13 +13,16 @@ import os import time -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -def getPath(tool="taosBenchmark"): +def etool.benchMarkFile() selfPath = os.path.dirname(os.path.realpath(__file__)) if "community" in selfPath: @@ -46,15 +49,12 @@ def getPath(tool="taosBenchmark"): return paths[0] -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21932] taosBenchmark sml test cases """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) def run(self): binPath = getPath() diff --git a/tests/army/tools/benchmark/basic/commandline-supplement-insert.py b/tests/army/tools/benchmark/basic/commandline-supplement-insert.py index 85dba23c4d..79da8f20e3 100644 --- a/tests/army/tools/benchmark/basic/commandline-supplement-insert.py +++ b/tests/army/tools/benchmark/basic/commandline-supplement-insert.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19352] taosBenchmark supplement insert test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 1 -n 1 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/commandline-vgroups.py b/tests/army/tools/benchmark/basic/commandline-vgroups.py index 4292e227d0..3e699c3c9c 100644 --- a/tests/army/tools/benchmark/basic/commandline-vgroups.py +++ b/tests/army/tools/benchmark/basic/commandline-vgroups.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21806] taosBenchmark specifying vgroups test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( "%s -t 1 -n 1 -v 3 -y &" % binPath diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py index dcec514662..e1ed3b90a4 100644 --- a/tests/army/tools/benchmark/basic/commandline.py +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -13,50 +13,25 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( "%s -F 7 -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 diff --git a/tests/army/tools/benchmark/basic/custom_col_tag.py b/tests/army/tools/benchmark/basic/custom_col_tag.py index 5e325aa845..87798fcadc 100644 --- a/tests/army/tools/benchmark/basic/custom_col_tag.py +++ b/tests/army/tools/benchmark/basic/custom_col_tag.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-13928] taosBenchmark improve user interface """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/custom_col_tag.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/custom_col_tag.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/default_json.py b/tests/army/tools/benchmark/basic/default_json.py index 86567f40da..dc468ad997 100644 --- a/tests/army/tools/benchmark/basic/default_json.py +++ b/tests/army/tools/benchmark/basic/default_json.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/default.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/default_tmq_json.py b/tests/army/tools/benchmark/basic/default_tmq_json.py index f3b0dc0c48..e59b72d1f3 100644 --- a/tests/army/tools/benchmark/basic/default_tmq_json.py +++ b/tests/army/tools/benchmark/basic/default_tmq_json.py @@ -13,59 +13,34 @@ # import os, signal import os from time import sleep -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): tdSql.execute("drop topic if exists topic_0") - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/default.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") tdSql.execute("alter database db WAL_RETENTION_PERIOD 3600000") - cmd = "%s -f ./taosbenchmark/json/tmq.json " % binPath + cmd = "%s -f ./tools/benchmark/basic/json/tmq.json " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) sleep(15) diff --git a/tests/army/tools/benchmark/basic/demo.py b/tests/army/tools/benchmark/basic/demo.py index d842d249c7..00545de0f9 100644 --- a/tests/army/tools/benchmark/basic/demo.py +++ b/tests/army/tools/benchmark/basic/demo.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-13823] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -n 100 -t 100 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/exportCsv.py b/tests/army/tools/benchmark/basic/exportCsv.py index 6659c4a606..1bce94853f 100644 --- a/tests/army/tools/benchmark/basic/exportCsv.py +++ b/tests/army/tools/benchmark/basic/exportCsv.py @@ -14,10 +14,13 @@ import os import json import csv -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * # reomve single and double quotation @@ -29,41 +32,13 @@ def removeQuotation(origin): return value -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] # check correct def checkCorrect(self, csvFile, allRows, interlaceRows): @@ -132,7 +107,7 @@ class TDTestCase: def run(self): # path - benchmark = self.getPath() + benchmark = etool.benchMarkFile() # do check json = "taosbenchmark/json/exportCsv.json" diff --git a/tests/army/tools/benchmark/basic/from-to-continue.py b/tests/army/tools/benchmark/basic/from-to-continue.py index 8503833982..6402525215 100644 --- a/tests/army/tools/benchmark/basic/from-to-continue.py +++ b/tests/army/tools/benchmark/basic/from-to-continue.py @@ -12,81 +12,56 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-20424] taosBenchmark insert child table from and to test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 6 -n 1 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) - cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-no.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/insert-from-to-continue-no.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from test.meters") tdSql.checkData(0, 0, 6 + 3) - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 5 -n 1 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("use test") tdSql.execute("create table d5 using meters tags (4, 'd5')") - cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-yes.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/insert-from-to-continue-yes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from test.meters") tdSql.checkData(0, 0, 5 + 3) - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 4 -n 1 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("use test") tdSql.execute("create table d4 using meters tags (4, 'd4')") - cmd = "%s -f ./taosbenchmark/json/insert-from-to-continue-smart.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/insert-from-to-continue-smart.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from test.meters") diff --git a/tests/army/tools/benchmark/basic/from-to.py b/tests/army/tools/benchmark/basic/from-to.py index b67db54670..9a410b917b 100644 --- a/tests/army/tools/benchmark/basic/from-to.py +++ b/tests/army/tools/benchmark/basic/from-to.py @@ -12,56 +12,29 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-22157] taosBenchmark insert child table from and to test cases """ - def init(self, conn, logSql): - 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")] - 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 paths[0] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/from-to.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/from-to.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.stb") diff --git a/tests/army/tools/benchmark/basic/insert-json-csv.py b/tests/army/tools/benchmark/basic/insert-json-csv.py index ec65fe50bd..bb89cc56c2 100644 --- a/tests/army/tools/benchmark/basic/insert-json-csv.py +++ b/tests/army/tools/benchmark/basic/insert-json-csv.py @@ -13,52 +13,27 @@ import os import time -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) +class TDTestCase(TBase): now = time.time() self.ts = int(round(now * 1000)) - def getPath(self, tool="taosBenchmark"): - 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/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath("taosBenchmark") + binPath = etool.benchMarkFile() if binPath == "": tdLog.exit("taosBenchmark not found!") else: @@ -66,7 +41,7 @@ class TDTestCase: # insert: create one or multiple tables per sql and insert multiple rows per sql # test case for https://jira.taosdata.com:18080/browse/TD-4985 - os.system("%s -f ./taosbenchmark/json/insert-json-csv.json -y " % binPath) + os.system("%s -f ./tools/benchmark/basic/json/insert-json-csv.json -y " % binPath) tdSql.execute("use db") if major_ver == "3": diff --git a/tests/army/tools/benchmark/basic/invalid_commandline.py b/tests/army/tools/benchmark/basic/invalid_commandline.py index 466c606753..0ca6ac7f85 100644 --- a/tests/army/tools/benchmark/basic/invalid_commandline.py +++ b/tests/army/tools/benchmark/basic/invalid_commandline.py @@ -11,50 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( "%s -F abc -P abc -I abc -T 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 diff --git a/tests/army/tools/benchmark/basic/json/TD-31490.json b/tests/army/tools/benchmark/basic/json/TD-31490.json index 7d01963722..a4c674fa50 100644 --- a/tests/army/tools/benchmark/basic/json/TD-31490.json +++ b/tests/army/tools/benchmark/basic/json/TD-31490.json @@ -47,7 +47,7 @@ "timestamp_step": 0, "start_timestamp": "2020-1-1 0:0:0", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/TD-31490.csv", + "sample_file": "./tools/benchmark/basic/csv/TD-31490.csv", "use_sample_ts": "yes", "tags_file": "", "columns": [ diff --git a/tests/army/tools/benchmark/basic/json/TS-5002.json b/tests/army/tools/benchmark/basic/json/TS-5002.json index 66e40818f0..024f9f0f9e 100644 --- a/tests/army/tools/benchmark/basic/json/TS-5002.json +++ b/tests/army/tools/benchmark/basic/json/TS-5002.json @@ -49,7 +49,7 @@ "disorder_range": 0, "timestamp_step": 900000, "start_timestamp": "2024-6-01 0:0:0", - "tags_file": "./taosbenchmark/csv/TS-5002.csv", + "tags_file": "./tools/benchmark/basic/csv/TS-5002.csv", "columns": [ { "type": "FLOAT", diff --git a/tests/army/tools/benchmark/basic/json/insert-json-csv.json b/tests/army/tools/benchmark/basic/json/insert-json-csv.json index c3c4bd9cb2..17896f6af5 100644 --- a/tests/army/tools/benchmark/basic/json/insert-json-csv.json +++ b/tests/army/tools/benchmark/basic/json/insert-json-csv.json @@ -40,7 +40,7 @@ "timestamp_step": 1, "start_timestamp": "2022-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/insert-json-csv.csv", + "sample_file": "./tools/benchmark/basic/csv/insert-json-csv.csv", "columns": [{"type": "INT","count":2}, {"type": "BINARY", "len": 16, "count":1}], "tags": [{"type": "INT", "count":2}, {"type": "BINARY", "len": 16, "count":1}] }] diff --git a/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json b/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json index b4bf21b786..38824e77b4 100644 --- a/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json +++ b/tests/army/tools/benchmark/basic/json/insert-sample-ts-stmt.json @@ -40,7 +40,7 @@ "timestamp_step": 1, "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/sample_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_ts.csv", "use_sample_ts": "yes", "tags_file": "", "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], @@ -68,7 +68,7 @@ "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", "sample_file": "./sample.csv", - "tags_file": "./taosbenchmark/csv/sample_ts_stmt_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_ts_stmt_tags.csv", "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] }] diff --git a/tests/army/tools/benchmark/basic/json/insert-sample-ts.json b/tests/army/tools/benchmark/basic/json/insert-sample-ts.json index a94131baaa..d27b468bab 100644 --- a/tests/army/tools/benchmark/basic/json/insert-sample-ts.json +++ b/tests/army/tools/benchmark/basic/json/insert-sample-ts.json @@ -40,7 +40,7 @@ "timestamp_step": 1, "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/sample_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_ts.csv", "use_sample_ts": "yes", "tags_file": "", "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], @@ -67,8 +67,8 @@ "timestamp_step": 10, "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/sample.csv", - "tags_file": "./taosbenchmark/csv/tags.csv", + "sample_file": "./tools/benchmark/basic/csv/sample.csv", + "tags_file": "./tools/benchmark/basic/csv/tags.csv", "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] }] diff --git a/tests/army/tools/benchmark/basic/json/insert-sample.json b/tests/army/tools/benchmark/basic/json/insert-sample.json index b2eb96edb6..b0da4f6a94 100644 --- a/tests/army/tools/benchmark/basic/json/insert-sample.json +++ b/tests/army/tools/benchmark/basic/json/insert-sample.json @@ -52,7 +52,7 @@ "timestamp_step": 1, "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/sample.csv", + "sample_file": "./tools/benchmark/basic/csv/sample.csv", "tags_file": "", "columns": [{"type": "INT", "count":3}, {"type": "DOUBLE", "count":3}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}, {"type": "BOOL"}], "tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":5}] @@ -78,8 +78,8 @@ "timestamp_step": 10, "start_timestamp": "2020-10-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/sample.csv", - "tags_file": "./taosbenchmark/csv/tags.csv", + "sample_file": "./tools/benchmark/basic/csv/sample.csv", + "tags_file": "./tools/benchmark/basic/csv/tags.csv", "columns": [{"type": "INT"}, {"type": "DOUBLE", "count":10}, {"type": "BINARY", "len": 16, "count":3}, {"type": "BINARY", "len": 32, "count":6}], "tags": [{"type": "TINYINT", "count":3}, {"type": "BINARY", "len": 16, "count":2}] }] diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json index aee3296249..7e4de1306f 100644 --- a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json @@ -31,7 +31,7 @@ "start_timestamp":1700000000000, "auto_create_table": "no", "data_source": "sample", - "sample_file": "./taosbenchmark/csv/d0.csv", + "sample_file": "./tools/benchmark/basic/csv/d0.csv", "use_sample_ts": "yes", "columns": [ {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, diff --git a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json index 150f6a8c57..2ed0f2fdde 100644 --- a/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json +++ b/tests/army/tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json @@ -31,7 +31,7 @@ "start_timestamp":1700000000000, "auto_create_table": "yes", "data_source": "sample", - "sample_file": "./taosbenchmark/csv/d0.csv", + "sample_file": "./tools/benchmark/basic/csv/d0.csv", "use_sample_ts": "yes", "columns": [ {"type": "FLOAT", "name": "current", "count": 1, "max": 12, "min": 8 }, diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json b/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json index 67253fefa4..f18ae29057 100644 --- a/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json @@ -39,9 +39,9 @@ "disorder_range": 1000, "timestamp_step": 1, "start_timestamp": "now", - "sample_file": "./taosbenchmark/csv/sample_no_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_no_ts.csv", "use_sample_ts": "no", - "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_tags.csv", "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json index 67fce72843..c2fbdca58d 100644 --- a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json @@ -24,7 +24,7 @@ "child_table_exists":"no", "childtable_count": 8, "childtable_prefix": "stb", - "childtable_sample_file": "./taosbenchmark/csv/sample_use_ts-XXXX.csv", + "childtable_sample_file": "./tools/benchmark/basic/csv/sample_use_ts-XXXX.csv", "escape_character": "no", "auto_create_table": "no", "batch_create_tbl_num": 10, @@ -39,9 +39,9 @@ "disorder_range": 1000, "timestamp_step": 1, "start_timestamp": "now", - "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_use_ts.csv", "use_sample_ts": "yes", - "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_tags.csv", "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] diff --git a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json index 3a6185ef11..7e036189b5 100644 --- a/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json +++ b/tests/army/tools/benchmark/basic/json/stmt_sample_use_ts.json @@ -39,9 +39,9 @@ "disorder_range": 1000, "timestamp_step": 1, "start_timestamp": "now", - "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_use_ts.csv", "use_sample_ts": "yes", - "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_tags.csv", "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json b/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json index fe87790d18..814ae3fc46 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json +++ b/tests/army/tools/benchmark/basic/json/taosc_query-error-sqlfile.json @@ -14,7 +14,7 @@ { "query_interval": 1, "concurrent":1, - "sql_file": "./taosbenchmark/json/query-error-sqls.txt", + "sql_file": "./tools/benchmark/basic/json/query-error-sqls.txt", "result": "taosc_query_specified-sqlfile" } } diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json b/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json index 6fc8e01605..0fd9b15277 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json +++ b/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json @@ -14,6 +14,6 @@ "specified_table_query": { "query_interval": 3, "concurrent": 3, - "sql_file": "./taosbenchmark/json/query-sqls-slow-query.txt" + "sql_file": "./tools/benchmark/basic/json/query-sqls-slow-query.txt" } } diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json b/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json index 236e87a36d..1dc94af6eb 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json +++ b/tests/army/tools/benchmark/basic/json/taosc_query-sqlfile.json @@ -13,7 +13,7 @@ { "query_interval": 1, "concurrent":1, - "sql_file": "./taosbenchmark/json/query-sqls.txt", + "sql_file": "./tools/benchmark/basic/json/query-sqls.txt", "result": "taosc_query_specified-sqlfile" } } diff --git a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json index e2396a99ae..8e489cf005 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json +++ b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json @@ -24,7 +24,7 @@ "child_table_exists":"no", "childtable_count": 8, "childtable_prefix": "stb", - "childtable_sample_file": "./taosbenchmark/csv/sample_use_ts-XXXX.csv", + "childtable_sample_file": "./tools/benchmark/basic/csv/sample_use_ts-XXXX.csv", "escape_character": "no", "auto_create_table": "no", "batch_create_tbl_num": 10, @@ -39,9 +39,9 @@ "disorder_range": 1000, "timestamp_step": 1, "start_timestamp": "now", - "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_use_ts.csv", "use_sample_ts": "yes", - "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_tags.csv", "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] diff --git a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json index 109e0428f8..d4a0c97314 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json +++ b/tests/army/tools/benchmark/basic/json/taosc_sample_use_ts.json @@ -39,9 +39,9 @@ "disorder_range": 1000, "timestamp_step": 1, "start_timestamp": "now", - "sample_file": "./taosbenchmark/csv/sample_use_ts.csv", + "sample_file": "./tools/benchmark/basic/csv/sample_use_ts.csv", "use_sample_ts": "yes", - "tags_file": "./taosbenchmark/csv/sample_tags.csv", + "tags_file": "./tools/benchmark/basic/csv/sample_tags.csv", "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] diff --git a/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json index 685de732e9..0dca7c746d 100644 --- a/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json +++ b/tests/army/tools/benchmark/basic/json/taosdemoTestNanoDatabasecsv.json @@ -50,8 +50,8 @@ "timestamp_step": 10000000, "start_timestamp": "2021-07-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/nano_samples.csv", - "tags_file": "./taosbenchmark/csv/nano_sampletags.csv", + "sample_file": "./tools/benchmark/basic/csv/nano_samples.csv", + "tags_file": "./tools/benchmark/basic/csv/nano_sampletags.csv", "columns": [{"type": "DOUBLE"}, {"type": "BINARY", "len": 64, "count":1}, {"type": "TIMESTAMP", "count":1}], "tags": [{"type": "BINARY", "len": 16, "count":1},{"type": "INT"},{"type": "DOUBLE"}] }, @@ -74,8 +74,8 @@ "timestamp_step": 10000000, "start_timestamp": "2021-07-01 00:00:00.000", "sample_format": "csv", - "sample_file": "./taosbenchmark/csv/nano_samples.csv", - "tags_file": "./taosbenchmark/csv/nano_sampletags.csv", + "sample_file": "./tools/benchmark/basic/csv/nano_samples.csv", + "tags_file": "./tools/benchmark/basic/csv/nano_sampletags.csv", "columns": [{"type": "DOUBLE"}, {"type": "BINARY", "len": 64, "count":1}, {"type": "TIMESTAMP", "count":1}], "tags": [{"type": "BINARY", "len": 16, "count":1},{"type": "INT"},{"type": "DOUBLE"}] }] diff --git a/tests/army/tools/benchmark/basic/json_tag.py b/tests/army/tools/benchmark/basic/json_tag.py index eced914eba..ff61322ac6 100644 --- a/tests/army/tools/benchmark/basic/json_tag.py +++ b/tests/army/tools/benchmark/basic/json_tag.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_json_tag.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_json_tag.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/limit_offset_json.py b/tests/army/tools/benchmark/basic/limit_offset_json.py index d35af35bc6..9ff73aa1cb 100644 --- a/tests/army/tools/benchmark/basic/limit_offset_json.py +++ b/tests/army/tools/benchmark/basic/limit_offset_json.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_only_create_table.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_only_create_table.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") @@ -86,7 +61,7 @@ class TDTestCase: tdSql.checkData(23, 2, 64) tdSql.checkData(28, 2, 64) - cmd = "%s -f ./taosbenchmark/json/taosc_limit_offset.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/taosc_limit_offset.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py b/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py index cc2075c8ff..04dfba5463 100644 --- a/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py +++ b/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py @@ -13,53 +13,25 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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 find %s in path: %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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( "%s -b binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar -t 2 -n 50000 -I stmt -y > /dev/null" @@ -72,7 +44,7 @@ class TDTestCase: tdLog.info("%s" % cmd) os.system("%s" % cmd) - cmd = "%s -f ./taosbenchmark/json/taosc_query-kill-slow-query.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/taosc_query-kill-slow-query.json" % binPath tdLog.info("%s" % cmd) output = subprocess.check_output(cmd, shell=True).decode("utf-8") if "KILL QUERY" not in output: diff --git a/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py b/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py index b5f30981e2..7ebbf695d5 100644 --- a/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py +++ b/tests/army/tools/benchmark/basic/query_json-with-error-sqlfile.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() os.system( "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" ) @@ -66,7 +41,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 = "%s -f ./taosbenchmark/json/taosc_query-error-sqlfile.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/taosc_query-error-sqlfile.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py b/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py index cf3d8649f7..e5c7445d80 100644 --- a/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py +++ b/tests/army/tools/benchmark/basic/query_json-with-sqlfile.py @@ -12,50 +12,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() os.system( "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" ) @@ -66,7 +41,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 = "%s -f ./taosbenchmark/json/taosc_query-sqlfile.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/taosc_query-sqlfile.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/query_json.py b/tests/army/tools/benchmark/basic/query_json.py index edc43237ce..8a06fa45bb 100644 --- a/tests/army/tools/benchmark/basic/query_json.py +++ b/tests/army/tools/benchmark/basic/query_json.py @@ -14,53 +14,25 @@ import ast import os import re -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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 find %s in path: %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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() os.system( "rm -f rest_query_specified-0 rest_query_super-0 taosc_query_specified-0 taosc_query_super-0" ) @@ -71,7 +43,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 = "%s -f ./taosbenchmark/json/taosc_query.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/taosc_query.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) with open("%s" % "taosc_query_specified-0", "r+") as f1: @@ -84,7 +56,7 @@ class TDTestCase: queryTaosc = line.strip().split()[0] assert queryTaosc == "1", "result is %s != expect: 1" % queryTaosc - cmd = "%s -f ./taosbenchmark/json/rest_query.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/rest_query.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py index a263b350bc..d34c82faf6 100644 --- a/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py +++ b/tests/army/tools/benchmark/basic/rest_insert_alltypes_json.py @@ -11,53 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/rest_insert_alltypes.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/rest_insert_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.stb") diff --git a/tests/army/tools/benchmark/basic/reuse-exist-stb.py b/tests/army/tools/benchmark/basic/reuse-exist-stb.py index cc49570aa5..9b0e3d5b5f 100644 --- a/tests/army/tools/benchmark/basic/reuse-exist-stb.py +++ b/tests/army/tools/benchmark/basic/reuse-exist-stb.py @@ -12,64 +12,36 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-22190] taosBenchmark reuse exist stb test cases """ - def init(self, conn, logSql): - 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")] - 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 find %s in path: %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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() tdSql.execute("drop database if exists db") tdSql.execute("create database if not exists db") tdSql.execute("use db") tdSql.execute("create table stb (ts timestamp, c0 int) tags (t0 int)") tdSql.execute("insert into stb_0 using stb tags (0) values (now, 0)") # sys.exit(0) - cmd = "%s -f ./taosbenchmark/json/reuse-exist-stb.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/reuse-exist-stb.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.new_0") diff --git a/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py b/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py index d3daaa04ac..9d5a3c7994 100644 --- a/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py +++ b/tests/army/tools/benchmark/basic/sml_auto_create_table_json.py @@ -11,52 +11,27 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/sml_auto_create_table.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/sml_auto_create_table.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py index 8e7cce3b69..7e3944a9f9 100644 --- a/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py +++ b/tests/army/tools/benchmark/basic/sml_insert_alltypes_json.py @@ -11,53 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/sml_insert_alltypes.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/sml_insert_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.stb") diff --git a/tests/army/tools/benchmark/basic/sml_interlace.py b/tests/army/tools/benchmark/basic/sml_interlace.py index a179cbe95e..1ba838a7d3 100644 --- a/tests/army/tools/benchmark/basic/sml_interlace.py +++ b/tests/army/tools/benchmark/basic/sml_interlace.py @@ -11,58 +11,28 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_interlace.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_interlace.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py b/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py index 0dd7110aa5..52a9a46eb2 100644 --- a/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py +++ b/tests/army/tools/benchmark/basic/sml_json_alltypes-interlace.py @@ -11,58 +11,28 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21932] taosBenchmark schemaless refine """ - def init(self, conn, logSql): - 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")] - 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] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_json_alltypes-interlace.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_json_alltypes-interlace.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_json_alltypes.py b/tests/army/tools/benchmark/basic/sml_json_alltypes.py index c46797f420..cc6cdefa1a 100644 --- a/tests/army/tools/benchmark/basic/sml_json_alltypes.py +++ b/tests/army/tools/benchmark/basic/sml_json_alltypes.py @@ -11,58 +11,31 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_json_alltypes.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_json_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py index e345fbd3b5..3c2e15f923 100644 --- a/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py +++ b/tests/army/tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py @@ -11,60 +11,29 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-23292] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/sml_json_insert_alltypes-same-min-max.json" + "%s -f ./tools/benchmark/basic/json/sml_json_insert_alltypes-same-min-max.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py b/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py index 7870a44fc7..f46c63a40f 100644 --- a/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py +++ b/tests/army/tools/benchmark/basic/sml_taosjson_alltypes.py @@ -11,13 +11,16 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -def getPath(tool="taosBenchmark"): +def etool.benchMarkFile() selfPath = os.path.dirname(os.path.realpath(__file__)) if "community" in selfPath: @@ -47,15 +50,12 @@ def getPath(tool="taosBenchmark"): return paths[0] -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21932] taosBenchmark sml test cases """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) def run(self): tdSql.query("select client_version()") @@ -63,7 +63,7 @@ class TDTestCase: major_ver = client_ver.split(".")[0] binPath = getPath() - cmd = "%s -f ./taosbenchmark/json/sml_taosjson_alltypes.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/sml_taosjson_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py index 8edf34fe33..594a5a7fbb 100644 --- a/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py +++ b/tests/army/tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py @@ -11,56 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-23292] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/sml_taosjson_insert_alltypes-same-min-max.json" + "%s -f ./tools/benchmark/basic/json/sml_taosjson_insert_alltypes-same-min-max.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py b/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py index cea2fa1fc2..399851b214 100644 --- a/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py +++ b/tests/army/tools/benchmark/basic/sml_telnet_alltypes.py @@ -11,58 +11,31 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_telnet_alltypes.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_telnet_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py index e1ec7d998e..e27c013490 100644 --- a/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py +++ b/tests/army/tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py @@ -11,60 +11,29 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-23292] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/sml_telnet_insert_alltypes-same-min-max.json" + "%s -f ./tools/benchmark/basic/json/sml_telnet_insert_alltypes-same-min-max.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/stmt2_insert.py b/tests/army/tools/benchmark/basic/stmt2_insert.py index a1f8f3bf10..37e6249e55 100644 --- a/tests/army/tools/benchmark/basic/stmt2_insert.py +++ b/tests/army/tools/benchmark/basic/stmt2_insert.py @@ -12,47 +12,22 @@ # -*- coding: utf-8 -*- import os import json -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def testBenchmarkJson(self, benchmark, jsonFile): # exe insert @@ -85,17 +60,17 @@ class TDTestCase: def run(self): - benchmark = self.getPath() + benchmark = etool.benchMarkFile() ''' stmt2 engine have some problem # batch - auto-create-table(yes or no) - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_batch_autoctb_yes.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_batch_autoctb_no.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_batch_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_batch_autoctb_no.json") # interlace - auto-create-table(yes or no) - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_interlace_autoctb_yes.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_interlace_autoctb_no.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_interlace_autoctb_no.json") # csv - (batch or interlace) - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_csv_interlace_autoctb_yes.json") - self.testBenchmarkJson(benchmark, "./taosbenchmark/json/stmt2_insert_csv_batch_autoctb_no.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_csv_interlace_autoctb_yes.json") + self.testBenchmarkJson(benchmark, "./tools/benchmark/basic/json/stmt2_insert_csv_batch_autoctb_no.json") ''' diff --git a/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py b/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py index baab1b4cc3..7edb5598d8 100644 --- a/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py +++ b/tests/army/tools/benchmark/basic/stmt_auto_create_table_json.py @@ -11,52 +11,27 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/stmt_auto_create_table.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/stmt_auto_create_table.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py index 50adc0f053..392277918c 100644 --- a/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py +++ b/tests/army/tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py @@ -11,56 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-23292] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/stmt_insert_alltypes-same-min-max.json" + "%s -f ./tools/benchmark/basic/json/stmt_insert_alltypes-same-min-max.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py index 11617db7b2..74a3cea1e3 100644 --- a/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py +++ b/tests/army/tools/benchmark/basic/stmt_insert_alltypes_json.py @@ -11,52 +11,27 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() - cmd = "%s -f ./taosbenchmark/json/stmt_insert_alltypes.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/stmt_insert_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.stb") diff --git a/tests/army/tools/benchmark/basic/stmt_offset_json.py b/tests/army/tools/benchmark/basic/stmt_offset_json.py index a15a65b0d0..f4ad5270d7 100644 --- a/tests/army/tools/benchmark/basic/stmt_offset_json.py +++ b/tests/army/tools/benchmark/basic/stmt_offset_json.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TS-3060] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_only_create_table.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_only_create_table.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") @@ -86,7 +61,7 @@ class TDTestCase: tdSql.checkData(23, 2, 64) tdSql.checkData(28, 2, 64) - cmd = "%s -f ./taosbenchmark/json/stmt_limit_offset.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/stmt_limit_offset.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py index 1f63d12386..61655a3df8 100644 --- a/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json-subtable.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/stmt_sample_use_ts-subtable.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/stmt_sample_use_ts-subtable.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py index f956fbeeac..a01c6d24d4 100644 --- a/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/stmt_sample_use_ts.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/stmt_sample_use_ts.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py b/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py index 964d5a4282..ee4cea2d34 100644 --- a/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py +++ b/tests/army/tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/stmt_sample_doesnt_use_ts.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/stmt_sample_doesnt_use_ts.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stream-test.py b/tests/army/tools/benchmark/basic/stream-test.py index 84941e66c3..85d2706f48 100644 --- a/tests/army/tools/benchmark/basic/stream-test.py +++ b/tests/army/tools/benchmark/basic/stream-test.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21047] taosBenchmark stream test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/stream-test.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/stream-test.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/stream_function_test.py b/tests/army/tools/benchmark/basic/stream_function_test.py index 90c33c608f..38752a8eeb 100644 --- a/tests/army/tools/benchmark/basic/stream_function_test.py +++ b/tests/army/tools/benchmark/basic/stream_function_test.py @@ -11,54 +11,29 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-21047] taosBenchmark stream test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/stream_exist_stb_tag_prepare.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/stream_exist_stb_tag_prepare.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) - cmd = "%s -f ./taosbenchmark/json/stream_exist_stb_tag_insert_partition.json " % binPath + cmd = "%s -f ./tools/benchmark/basic/json/stream_exist_stb_tag_insert_partition.json " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/taosadapter_json.py b/tests/army/tools/benchmark/basic/taosadapter_json.py index 7f1c31fce8..5631fc175c 100644 --- a/tests/army/tools/benchmark/basic/taosadapter_json.py +++ b/tests/army/tools/benchmark/basic/taosadapter_json.py @@ -11,50 +11,24 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] - def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_rest_telnet.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_rest_telnet.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") @@ -66,7 +40,7 @@ class TDTestCase: tdSql.query("select count(*) from db.stb2") tdSql.checkData(0, 0, 160) - cmd = "%s -f ./taosbenchmark/json/sml_rest_line.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/sml_rest_line.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") @@ -78,7 +52,7 @@ class TDTestCase: tdSql.query("select count(*) from db2.stb2") tdSql.checkData(0, 0, 160) - cmd = "%s -f ./taosbenchmark/json/sml_rest_json.json" % binPath + cmd = "%s -f ./tools/benchmark/basic/json/sml_rest_json.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py b/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py index cb11b2b5e2..a42cd79b29 100644 --- a/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py +++ b/tests/army/tools/benchmark/basic/taosc_auto_create_table_json.py @@ -11,58 +11,31 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_auto_create_table.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_auto_create_table.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/taosc_insert-mix.py b/tests/army/tools/benchmark/basic/taosc_insert-mix.py index e40a6a4d77..85db88f35d 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert-mix.py +++ b/tests/army/tools/benchmark/basic/taosc_insert-mix.py @@ -13,56 +13,31 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ taosBenchmark insert mix data """ @classmethod - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) @classmethod - def getPath(self, tool="taosBenchmark"): - 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] @classmethod def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() # mix 1 ~ 4 for i in range(4): - cmd = "%s -f ./taosbenchmark/json/case-insert-mix%d.json" % (binPath, i + 1) + cmd = "%s -f ./tools/benchmark/basic/json/case-insert-mix%d.json" % (binPath, i + 1) tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py index 1608e33223..a6761b83b0 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py +++ b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-global.py @@ -13,51 +13,26 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19985] taosBenchmark retry test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_insert_retry-global.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_insert_retry-global.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(2) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py index fba50f296e..1072a4b410 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py +++ b/tests/army/tools/benchmark/basic/taosc_insert-retry-json-stb.py @@ -13,51 +13,26 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19985] taosBenchmark retry test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_insert_retry-stb.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_insert_retry-stb.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(2) diff --git a/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py b/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py index 65eef2173c..4815a0fa94 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py +++ b/tests/army/tools/benchmark/basic/taosc_insert-table-creating-interval.py @@ -13,56 +13,31 @@ import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-19449] taosBenchmark creating table interval test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/taosc_insert_table-creating-interval.json -g 2>&1| grep sleep | wc -l" + "%s -f ./tools/benchmark/basic/json/taosc_insert_table-creating-interval.json -g 2>&1| grep sleep | wc -l" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py index 8bb2b30c00..ab3ec8091e 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py @@ -11,56 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-23292] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/taosc_insert_alltypes-same-min-max.json" + "%s -f ./tools/benchmark/basic/json/taosc_insert_alltypes-same-min-max.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py index 2db3818709..3befbd6998 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py @@ -11,56 +11,25 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = ( - "%s -f ./taosbenchmark/json/taosc_insert_alltypes-partial-col.json" + "%s -f ./tools/benchmark/basic/json/taosc_insert_alltypes-partial-col.json" % binPath ) tdLog.info("%s" % cmd) diff --git a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py index a2b1a88737..f54df5948e 100644 --- a/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py +++ b/tests/army/tools/benchmark/basic/taosc_insert_alltypes_json.py @@ -11,59 +11,28 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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/" - - tdLog.info("projPath: %s" % projPath) - 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] - def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_insert_alltypes.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_insert_alltypes.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.query("select count(*) from db.stb") diff --git a/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py b/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py index a3b2c71c8e..a6ee5a417f 100644 --- a/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py +++ b/tests/army/tools/benchmark/basic/taosc_sample_csv_json-subtable.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_sample_use_ts-subtable.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_sample_use_ts-subtable.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py b/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py index fe4e27e865..82198f9dec 100644 --- a/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py +++ b/tests/army/tools/benchmark/basic/taosc_sample_csv_json.py @@ -11,51 +11,26 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/taosc_sample_use_ts.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/taosc_sample_use_ts.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("reset query cache") diff --git a/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py b/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py index 6aefcb5665..d5d979cbdd 100644 --- a/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py +++ b/tests/army/tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py @@ -12,57 +12,32 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) +class TDTestCase(TBase): # pylint: disable=R0201 - def getPath(self, tool="taosBenchmark"): - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() + binPath = etool.benchMarkFile() if binPath == "": tdLog.exit("taosBenchmark not found!") else: tdLog.info("taosBenchmark use %s" % binPath) # insert: sample json - os.system("%s -f ./taosbenchmark/json/insert-sample-ts-stmt.json -y " % binPath) + os.system("%s -f ./tools/benchmark/basic/json/insert-sample-ts-stmt.json -y " % binPath) tdSql.execute("use dbtest123") tdSql.query("select c2 from stb0") tdSql.checkData(0, 0, 2147483647) @@ -82,7 +57,7 @@ class TDTestCase: tdSql.checkRows(10) # insert: timestamp and step - os.system("%s -f ./taosbenchmark/json/insert-timestep-stmt.json -y " % binPath) + os.system("%s -f ./tools/benchmark/basic/json/insert-timestep-stmt.json -y " % binPath) tdSql.execute("use db") tdSql.query("show stables") if major_ver == "3": @@ -106,7 +81,7 @@ class TDTestCase: # # insert: disorder_ratio os.system( - "%s -f ./taosbenchmark/json/insert-disorder-stmt.json 2>&1 -y " % binPath + "%s -f ./tools/benchmark/basic/json/insert-disorder-stmt.json 2>&1 -y " % binPath ) tdSql.execute("use db") if major_ver == "3": @@ -138,7 +113,7 @@ class TDTestCase: # insert: test interlace parament os.system( - "%s -f ./taosbenchmark/json/insert-interlace-row-stmt.json -y " % binPath + "%s -f ./tools/benchmark/basic/json/insert-interlace-row-stmt.json -y " % binPath ) tdSql.execute("use db") if major_ver == "3": @@ -155,7 +130,7 @@ class TDTestCase: tdSql.execute("create database db") tdSql.execute("use db") os.system( - "%s -y -f ./taosbenchmark/json/insert-drop-exist-auto-N00-stmt.json " + "%s -y -f ./tools/benchmark/basic/json/insert-drop-exist-auto-N00-stmt.json " % binPath ) # drop = no, child_table_exists, auto_create_table varies tdSql.execute("use db") @@ -186,7 +161,7 @@ class TDTestCase: tdSql.execute("drop database if exists db") os.system( - "%s -y -f ./taosbenchmark/json/insert-drop-exist-auto-Y00-stmt.json " + "%s -y -f ./tools/benchmark/basic/json/insert-drop-exist-auto-Y00-stmt.json " % binPath ) # drop = yes, child_table_exists, auto_create_table varies tdSql.execute("use db") diff --git a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py index 0a4a14e1e1..c716c119a6 100644 --- a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py +++ b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * import ast import re @@ -23,38 +26,10 @@ import re import subprocess -class TDTestCase: +class TDTestCase(TBase): # pylint: disable=R0201 - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) # pylint: disable=R0201 - def getPath(self, tool="taosBenchmark"): - 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] # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 def assertfileDataTaosc(self, filename, expectResult): @@ -106,7 +81,7 @@ class TDTestCase: ) def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() if binPath == "": tdLog.exit("taosBenchmark not found!") else: @@ -117,8 +92,8 @@ class TDTestCase: os.system("rm -rf ./all_query*") # taosc query: query specified table and query super table - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) - os.system("%s -f ./taosbenchmark/json/queryTaosc-mixed-query.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryTaosc-mixed-query.json" % binPath) os.system("cat query_res2.txt* > all_query_res2_taosc.txt") # correct Times testcases @@ -134,8 +109,8 @@ class TDTestCase: os.system("rm -rf ./all_query*") # use restful api to query - os.system("%s -f ./taosbenchmark/json/queryInsertrestdata.json" % binPath) - os.system("%s -f ./taosbenchmark/json/queryRestful.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertrestdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryRestful.json" % binPath) os.system("cat query_res2.txt* > all_query_res2_rest.txt") # correct Times testcases @@ -154,49 +129,49 @@ class TDTestCase: # query times less than or equal to 100 assert ( - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) == 0 + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) == 0 ) assert ( - os.system("%s -f ./taosbenchmark/json/querySpeciMutisql100.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/querySpeciMutisql100.json" % binPath) != 0 ) assert ( - os.system("%s -f ./taosbenchmark/json/querySuperMutisql100.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/querySuperMutisql100.json" % binPath) == 0 ) # query result print QPS - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) - exceptcode = os.system("%s -f ./taosbenchmark/json/queryQps.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) + exceptcode = os.system("%s -f ./tools/benchmark/basic/json/queryQps.json" % binPath) assert exceptcode == 0 # 2021.02.09 need modify taosBenchmakr code # use illegal or out of range parameters query json file - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) # 2021.02.09 need modify taosBenchmakr code # exceptcode = os.system( - # "%s -f ./taosbenchmark/json/queryTimes0.json" % + # "%s -f ./tools/benchmark/basic/json/queryTimes0.json" % # binPath) # assert exceptcode != 0 # 2021.02.09 need modify taosBenchmakr code # exceptcode0 = os.system( - # "%s -f ./taosbenchmark/json/queryTimesless0.json" % + # "%s -f ./tools/benchmark/basic/json/queryTimesless0.json" % # binPath) # assert exceptcode0 != 0 # exceptcode1 = os.system( - # "%s -f ./taosbenchmark/json/queryConcurrent0.json" % + # "%s -f ./tools/benchmark/basic/json/queryConcurrent0.json" % # binPath) # assert exceptcode2 != 0 # exceptcode3 = os.system( - # "%s -f ./taosbenchmark/json/querrThreadsless0.json" % + # "%s -f ./tools/benchmark/basic/json/querrThreadsless0.json" % # binPath) # assert exceptcode3 != 0 # exceptcode4 = os.system( - # "%s -f ./taosbenchmark/json/querrThreads0.json" % + # "%s -f ./tools/benchmark/basic/json/querrThreads0.json" % # binPath) # assert exceptcode4 != 0 diff --git a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py index b3341f2106..ac572718e3 100644 --- a/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py +++ b/tests/army/tools/benchmark/basic/taosdemoTestQueryWithJson.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * import ast import re @@ -23,36 +26,8 @@ import re import subprocess -class TDTestCase: - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) +class TDTestCase(TBase): - def getPath(self, tool="taosBenchmark"): - 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] # 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。 def assertfileDataTaosc(self, filename, expectResult): @@ -104,7 +79,7 @@ class TDTestCase: ) def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() if binPath == "": tdLog.exit("taosBenchmark not found!") else: @@ -115,8 +90,8 @@ class TDTestCase: os.system("rm -rf ./all_query*") # taosc query: query specified table and query super table - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) - os.system("%s -f ./taosbenchmark/json/queryTaosc.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryTaosc.json" % binPath) os.system("cat query_res0.txt* > all_query_res0_taosc.txt") os.system("cat query_res1.txt* > all_query_res1_taosc.txt") os.system("cat query_res2.txt* > all_query_res2_taosc.txt") @@ -141,8 +116,8 @@ class TDTestCase: os.system("rm -rf ./all_query*") # use restful api to query - os.system("%s -f ./taosbenchmark/json/queryInsertrestdata.json" % binPath) - os.system("%s -f ./taosbenchmark/json/queryRestful.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertrestdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryRestful.json" % binPath) os.system("cat query_res0.txt* > all_query_res0_rest.txt") os.system("cat query_res1.txt* > all_query_res1_rest.txt") os.system("cat query_res2.txt* > all_query_res2_rest.txt") @@ -176,49 +151,49 @@ class TDTestCase: # query times less than or equal to 100 assert ( - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) == 0 + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) == 0 ) assert ( - os.system("%s -f ./taosbenchmark/json/querySpeciMutisql100.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/querySpeciMutisql100.json" % binPath) != 0 ) assert ( - os.system("%s -f ./taosbenchmark/json/querySuperMutisql100.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/querySuperMutisql100.json" % binPath) == 0 ) # query result print QPS - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) - exceptcode = os.system("%s -f ./taosbenchmark/json/queryQps.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) + exceptcode = os.system("%s -f ./tools/benchmark/basic/json/queryQps.json" % binPath) assert exceptcode == 0 # 2021.02.09 need modify taosBenchmakr code # use illegal or out of range parameters query json file - os.system("%s -f ./taosbenchmark/json/queryInsertdata.json" % binPath) + os.system("%s -f ./tools/benchmark/basic/json/queryInsertdata.json" % binPath) # 2021.02.09 need modify taosBenchmakr code # exceptcode = os.system( - # "%s -f ./taosbenchmark/json/queryTimes0.json" % + # "%s -f ./tools/benchmark/basic/json/queryTimes0.json" % # binPath) # assert exceptcode != 0 # 2021.02.09 need modify taosBenchmakr code # exceptcode0 = os.system( - # "%s -f ./taosbenchmark/json/queryTimesless0.json" % + # "%s -f ./tools/benchmark/basic/json/queryTimesless0.json" % # binPath) # assert exceptcode0 != 0 # exceptcode1 = os.system( - # "%s -f ./taosbenchmark/json/queryConcurrent0.json" % + # "%s -f ./tools/benchmark/basic/json/queryConcurrent0.json" % # binPath) # assert exceptcode2 != 0 # exceptcode3 = os.system( - # "%s -f ./taosbenchmark/json/querrThreadsless0.json" % + # "%s -f ./tools/benchmark/basic/json/querrThreadsless0.json" % # binPath) # assert exceptcode3 != 0 # exceptcode4 = os.system( - # "%s -f ./taosbenchmark/json/querrThreads0.json" % + # "%s -f ./tools/benchmark/basic/json/querrThreads0.json" % # binPath) # assert exceptcode4 != 0 diff --git a/tests/army/tools/benchmark/basic/telnet_tcp.py b/tests/army/tools/benchmark/basic/telnet_tcp.py index e74088d493..256542675e 100644 --- a/tests/army/tools/benchmark/basic/telnet_tcp.py +++ b/tests/army/tools/benchmark/basic/telnet_tcp.py @@ -12,58 +12,31 @@ # -*- coding: utf-8 -*- import os import time -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - 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] def run(self): tdSql.query("select client_version()") client_ver = "".join(tdSql.queryResult[0]) major_ver = client_ver.split(".")[0] - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/sml_telnet_tcp.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/sml_telnet_tcp.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(5) diff --git a/tests/army/tools/benchmark/basic/tmq_case.py b/tests/army/tools/benchmark/basic/tmq_case.py index 458b50c903..a2a704813a 100644 --- a/tests/army/tools/benchmark/basic/tmq_case.py +++ b/tests/army/tools/benchmark/basic/tmq_case.py @@ -12,67 +12,42 @@ # -*- coding: utf-8 -*- import os import time -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-11510] taosBenchmark test cases """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): tdSql.execute("drop topic if exists tmq_topic_0") tdSql.execute("drop topic if exists tmq_topic_1") - binPath = self.getPath() - cmd = "%s -f ./taosbenchmark/json/default.json" % binPath + binPath = etool.benchMarkFile() + cmd = "%s -f ./tools/benchmark/basic/json/default.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) tdSql.execute("alter database db WAL_RETENTION_PERIOD 3600000") tdSql.execute("reset query cache") - cmd = "%s -f ./taosbenchmark/json/tmq_basic.json " % binPath + cmd = "%s -f ./tools/benchmark/basic/json/tmq_basic.json " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(5) - cmd = "%s -f ./taosbenchmark/json/tmq_basic2.json " % binPath + cmd = "%s -f ./tools/benchmark/basic/json/tmq_basic2.json " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(5) - cmd = "%s -f ./taosbenchmark/json/tmq_basic3.json " % binPath + cmd = "%s -f ./tools/benchmark/basic/json/tmq_basic3.json " % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(5) diff --git a/tests/army/tools/benchmark/cloud/cloud-test.py b/tests/army/tools/benchmark/cloud/cloud-test.py index 01a9fbf93a..24acd5e788 100644 --- a/tests/army/tools/benchmark/cloud/cloud-test.py +++ b/tests/army/tools/benchmark/cloud/cloud-test.py @@ -12,53 +12,23 @@ # -*- coding: utf-8 -*- import os import subprocess -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-22022] taosBenchmark cloud test cases """ - def init(self, conn, logSql): - 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")] - 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 find %s in path: %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.info(f"{tool} not found in {projPath}!") - return f"/usr/local/taos/bin/{tool}" - else: - tdLog.info(f"{tool} is found in {paths[0]}!") - return paths[0] - def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -T 1 -t 2 -n 10 -y" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/benchmark/ws/websocket.py b/tests/army/tools/benchmark/ws/websocket.py index af9a06f1d4..1394e892ef 100644 --- a/tests/army/tools/benchmark/ws/websocket.py +++ b/tests/army/tools/benchmark/ws/websocket.py @@ -10,50 +10,25 @@ ################################################################### # -*- coding: utf-8 -*- -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * -class TDTestCase: +class TDTestCase(TBase): def caseDescription(self): """ [TD-17079] taosBenchmark test cloud """ - def init(self, conn, logSql): - 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")] - elif "src" in selfPath: - projPath = selfPath[: selfPath.find("src")] - elif "/tools/" in selfPath: - projPath = selfPath[: selfPath.find("/tools/")] - else: - projPath = selfPath[: selfPath.find("tests")] - - 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] def run(self): - binPath = self.getPath() + binPath = etool.benchMarkFile() cmd = "%s -t 1 -n 1 -y -W http://localhost:6041 -D 30" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) diff --git a/tests/army/tools/taosdump/native/taosdumpDbNtb.py b/tests/army/tools/taosdump/native/taosdumpDbNtb.py index d9f149f35e..5a8525535a 100644 --- a/tests/army/tools/taosdump/native/taosdumpDbNtb.py +++ b/tests/army/tools/taosdump/native/taosdumpDbNtb.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,7 @@ class TDTestCase: case1: [TD-18291] taosdump basic test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -89,7 +63,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpDbStb.py b/tests/army/tools/taosdump/native/taosdumpDbStb.py index bdc3f89db7..24d0e0c5cd 100644 --- a/tests/army/tools/taosdump/native/taosdumpDbStb.py +++ b/tests/army/tools/taosdump/native/taosdumpDbStb.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-18291] taosdump basic test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -89,7 +64,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py index 6bb7eb1db9..198bb7d156 100644 --- a/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py +++ b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-20506] taosdump dump db with non-root """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -89,7 +64,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpEscapedDb.py b/tests/army/tools/taosdump/native/taosdumpEscapedDb.py index 77a17f76f1..f3698dd862 100644 --- a/tests/army/tools/taosdump/native/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/native/taosdumpEscapedDb.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -73,7 +48,7 @@ class TDTestCase: ) # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpInDiffType.py b/tests/army/tools/taosdump/native/taosdumpInDiffType.py index 5fa15fd7cf..7f53377fdf 100644 --- a/tests/army/tools/taosdump/native/taosdumpInDiffType.py +++ b/tests/army/tools/taosdump/native/taosdumpInDiffType.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,39 +27,11 @@ class TDTestCase: case1: [TS-3102] taosdump in diff type test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpManyCols.py b/tests/army/tools/taosdump/native/taosdumpManyCols.py index d1159f4169..d6959e39fc 100644 --- a/tests/army/tools/taosdump/native/taosdumpManyCols.py +++ b/tests/army/tools/taosdump/native/taosdumpManyCols.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TS-1762] taosdump with many columns """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -93,7 +68,7 @@ class TDTestCase: ins_sql += ")" tdSql.execute(ins_sql) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpStartEndTime.py b/tests/army/tools/taosdump/native/taosdumpStartEndTime.py index 26e326f779..ff469dce58 100644 --- a/tests/army/tools/taosdump/native/taosdumpStartEndTime.py +++ b/tests/army/tools/taosdump/native/taosdumpStartEndTime.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,39 +27,11 @@ class TDTestCase: case1: [TS-2769] taosdump start-time end-time test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py b/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py index a5718b1c45..d7d9f68053 100644 --- a/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py +++ b/tests/army/tools/taosdump/native/taosdumpStartEndTimeLong.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,39 +27,11 @@ class TDTestCase: case1: [TS-2769] taosdump start-time end-time test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTest.py b/tests/army/tools/taosdump/native/taosdumpTest.py index a1ee9f6a64..ac214ed6d7 100644 --- a/tests/army/tools/taosdump/native/taosdumpTest.py +++ b/tests/army/tools/taosdump/native/taosdumpTest.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -34,31 +37,6 @@ class TDTestCase: else: return True - def getPath(self, tool="taosdump"): - 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] def run(self): if not os.path.exists("./taosdumptest/tmp1"): @@ -93,7 +71,7 @@ class TDTestCase: sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) tdSql.execute(sql) - binPath = self.getPath("taosdump") + binPath = self.etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTest2.py b/tests/army/tools/taosdump/native/taosdumpTest2.py index 9618ac4169..972f866aed 100644 --- a/tests/army/tools/taosdump/native/taosdumpTest2.py +++ b/tests/army/tools/taosdump/native/taosdumpTest2.py @@ -13,10 +13,13 @@ from logging.config import dictConfig import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * import string import random @@ -30,31 +33,6 @@ class TDTestCase: self.numberOfTables = 1 self.numberOfRecords = 150 - def getPath(self, tool="taosdump"): - 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] def generateString(self, length): chars = string.ascii_uppercase + string.ascii_lowercase @@ -90,7 +68,7 @@ class TDTestCase: break tdSql.execute(sql) - binPath = self.getPath("taosdump") + binPath = self.etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestBasic.py b/tests/army/tools/taosdump/native/taosdumpTestBasic.py index 13bc405675..f0c5f414c0 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestBasic.py +++ b/tests/army/tools/taosdump/native/taosdumpTestBasic.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-18291] taosdump basic test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -89,7 +64,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestInspect.py b/tests/army/tools/taosdump/native/taosdumpTestInspect.py index 0d45b45fff..fe2572bc44 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestInspect.py +++ b/tests/army/tools/taosdump/native/taosdumpTestInspect.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,37 +27,6 @@ class TDTestCase: case1: [TD-14544] taosdump data inspect """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - - def getPath(self, tool="taosdump"): - 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] - def run(self): tdSql.prepare() @@ -80,7 +52,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py b/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py index 3703ab79db..448a3b8551 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py +++ b/tests/army/tools/taosdump/native/taosdumpTestLooseMode.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-19436] taosdump loose mode test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -79,7 +54,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py b/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py index f76d2d776f..4e3d723df9 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py +++ b/tests/army/tools/taosdump/native/taosdumpTestNanoSupport.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -34,31 +37,6 @@ class TDTestCase: else: return True - def getPath(self, tool="taosdump"): - 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] def createdb(self, precision="ns"): tb_nums = self.numberOfTables @@ -132,7 +110,7 @@ class TDTestCase: if not os.path.exists("./taosdumptest/dumptmp3"): os.makedirs("./taosdumptest/dumptmp3") - binPath = self.getPath("taosdump") + binPath = self.etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py index f0b2a45ad1..d42457cb36 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBigInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports big int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -77,7 +52,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py index 3e6933d5d5..1e5c349f51 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBinary.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports binary """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -71,7 +46,7 @@ class TDTestCase: tdSql.execute("create table t2 using st tags(NULL)") tdSql.execute("insert into t2 values(1640000000000, NULL, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py b/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py index ab2f5e8985..ff3337c272 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeBool.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports bool """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -70,7 +45,7 @@ class TDTestCase: tdSql.execute("create table t3 using st tags(NULL)") tdSql.execute("insert into t3 values(1640000000000, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py b/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py index bf370c7fa2..91b5ba5491 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeDouble.py @@ -13,10 +13,13 @@ import os import math -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -25,36 +28,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports double """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -78,7 +53,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py b/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py index 77e1e02383..640d35629b 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeFloat.py @@ -13,10 +13,13 @@ import os import math -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -25,36 +28,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports float """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -78,7 +53,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py index 092c8ee73b..11638a7bd2 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py b/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py index dca1188168..456b3ec801 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeJson.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12362] taosdump supports JSON """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py index f3fcdaab1a..5f2998b826 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeSmallInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports small int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -75,7 +50,7 @@ class TDTestCase: tdSql.execute("create table t4 using st tags(NULL)") tdSql.execute("insert into t4 values(1640000000000, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py index 88c3929fe2..e86ce020f2 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeTinyInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports tiny int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -77,7 +52,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py index b5c9c01ce7..eee9016264 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedBigInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12655] taosdump supports unsigned big int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py index 26ad2069eb..c38d14faa2 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py index 11b8db7451..a52d573828 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedSmallInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned small int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py index c0d3d28b1c..a477d0177b 100644 --- a/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py +++ b/tests/army/tools/taosdump/native/taosdumpTestTypeUnsignedTinyInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned tiny int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -74,7 +49,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py b/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py index 6610339ba9..80c565d641 100644 --- a/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py +++ b/tests/army/tools/taosdump/native/taosdumpTypeGeometry.py @@ -14,10 +14,13 @@ import os import json import copy -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -26,51 +29,20 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - - def getPath(self, tool="taosdump"): - 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] - def exec(self, command): tdLog.info(command) return os.system(command) def findPrograme(self): # taosdump - taosdump = self.getPath("taosdump") + taosdump = self.etool.taosDumpFile() if taosdump == "": tdLog.exit("taosdump not found!") else: tdLog.info("taosdump found in %s" % taosdump) # taosBenchmark - benchmark = self.getPath("taosBenchmark") + benchmark = etool.benchMarkFile() if benchmark == "": tdLog.exit("benchmark not found!") else: diff --git a/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py b/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py index adbed7d877..39c6582119 100644 --- a/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py +++ b/tests/army/tools/taosdump/native/taosdumpTypeVarbinary.py @@ -14,10 +14,13 @@ import os import json import copy -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -26,36 +29,8 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def exec(self, command): tdLog.info(command) @@ -63,14 +38,14 @@ class TDTestCase: def findPrograme(self): # taosdump - taosdump = self.getPath("taosdump") + taosdump = self.etool.taosDumpFile() if taosdump == "": tdLog.exit("taosdump not found!") else: tdLog.info("taosdump found in %s" % taosdump) # taosBenchmark - benchmark = self.getPath("taosBenchmark") + benchmark = etool.benchMarkFile() if benchmark == "": tdLog.exit("benchmark not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py index e9d35393da..611cc9bf80 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/ws3/taosdumpEscapedDb.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,8 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def run(self): tdSql.prepare() @@ -73,7 +48,7 @@ class TDTestCase: ) # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py b/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py index aa67a2f73c..d821ecc94f 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py +++ b/tests/army/tools/taosdump/ws3/taosdumpPrimaryKey.py @@ -13,10 +13,13 @@ import os import json -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -25,36 +28,8 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def exec(self, command): tdLog.info(command) @@ -62,14 +37,14 @@ class TDTestCase: def findPrograme(self): # taosdump - taosdump = self.getPath("taosdump") + taosdump = self.etool.taosDumpFile() if taosdump == "": tdLog.exit("taosdump not found!") else: tdLog.info("taosdump found in %s" % taosdump) # taosBenchmark - benchmark = self.getPath("taosBenchmark") + benchmark = etool.benchMarkFile() if benchmark == "": tdLog.exit("benchmark not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpRetry.py b/tests/army/tools/taosdump/ws3/taosdumpRetry.py index f66b0a7890..800189b1f0 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpRetry.py +++ b/tests/army/tools/taosdump/ws3/taosdumpRetry.py @@ -18,10 +18,13 @@ import time from threading import Thread from threading import Event -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * # # kill taosadapter task @@ -50,36 +53,8 @@ class TDTestCase: case1: [TS-3072] taosdump dump escaped db name test """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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] def exec(self, command): tdLog.info(command) @@ -87,14 +62,14 @@ class TDTestCase: def findPrograme(self): # taosdump - taosdump = self.getPath("taosdump") + taosdump = self.etool.taosDumpFile() if taosdump == "": tdLog.exit("taosdump not found!") else: tdLog.info("taosdump found in %s" % taosdump) # taosBenchmark - benchmark = self.getPath("taosBenchmark") + benchmark = etool.benchMarkFile() if benchmark == "": tdLog.exit("benchmark not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py index 175c6146ff..a9c29c441c 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBigInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports big int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -77,7 +53,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py index a40c61ca55..cac85b863c 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBinary.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports binary """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -71,7 +47,7 @@ class TDTestCase: tdSql.execute("create table t2 using st tags(NULL)") tdSql.execute("insert into t2 values(1640000000000, NULL, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py index b30a06af9e..984b4d15c7 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeBool.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports bool """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -70,7 +46,7 @@ class TDTestCase: tdSql.execute("create table t3 using st tags(NULL)") tdSql.execute("insert into t3 values(1640000000000, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py index 3f6a1bbdd5..ba1fc55c4a 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeDouble.py @@ -13,10 +13,13 @@ import os import math -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -25,36 +28,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports double """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -78,7 +54,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py index 6082162f5c..9de92786d5 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeFloat.py @@ -13,10 +13,13 @@ import os import math -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -25,36 +28,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports float """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -78,7 +54,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py index 168362373f..b542423d3a 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -74,7 +50,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py index 936606ada8..8e64018670 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeJson.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12362] taosdump supports JSON """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -74,7 +50,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py index 073b56c61d..f66d396c12 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeSmallInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports small int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -75,7 +51,7 @@ class TDTestCase: tdSql.execute("create table t4 using st tags(NULL)") tdSql.execute("insert into t4 values(1640000000000, NULL)") - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py index 932d7d4d7f..2fd1781da2 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeTinyInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports tiny int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -77,7 +53,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py index cdc98d0a9b..2ec59210c8 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedBigInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12655] taosdump supports unsigned big int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -75,7 +51,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py index 12043fbbab..3e425b06f9 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -74,7 +50,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py index f64c9f33a7..6ee6008f77 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedSmallInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned small int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -75,7 +51,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: diff --git a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py index d81640f654..fe2a973c19 100644 --- a/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py +++ b/tests/army/tools/taosdump/ws3/taosdumpTestTypeUnsignedTinyInt.py @@ -12,10 +12,13 @@ # -*- coding: utf-8 -*- import os -from util.log import * -from util.cases import * -from util.sql import * -from util.dnodes import * +import frame +import frame.etool +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * class TDTestCase: @@ -24,36 +27,9 @@ class TDTestCase: case1: [TD-12526] taosdump supports unsigned tiny int """ - def init(self, conn, logSql): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(), logSql) - self.tmpdir = "tmp" - def getPath(self, tool="taosdump"): - 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 find %s in path: %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] def run(self): tdSql.prepare() @@ -75,7 +51,7 @@ class TDTestCase: # sys.exit(1) - binPath = self.getPath() + binPath = etool.taosDumpFile() if binPath == "": tdLog.exit("taosdump not found!") else: