tweak run and exe method

This commit is contained in:
Alex Duan 2024-01-13 15:10:48 +08:00
parent 7b29c97f27
commit 34878b4f0d
6 changed files with 29 additions and 17 deletions

View File

@ -34,7 +34,7 @@ class TDTestCase(TBase):
tdLog.info(f"insert data.")
# taosBenchmark run
jfile = etool.curFile(__file__, "snapshot.json")
etool.runBenchmark(json=jfile)
etool.benchMark(json=jfile)
tdSql.execute(f"use {self.db}")
# set insert data information

View File

@ -36,7 +36,10 @@ class TDTestCase(TBase):
self.timestamp_step = 1000
# taosBenchmark run
etool.runBenchmark(command = f"-d {self.db} -t {self.childtable_count} -n {self.insert_rows} -v 2 -y")
etool.benchMark(command = f"-d {self.db} -t {self.childtable_count} -n {self.insert_rows} -v 2 -y")
def doTaos(self):
tdLog.info(f"check taos command options...")
def doTaosd(self):
@ -72,11 +75,11 @@ class TDTestCase(TBase):
etool.runBinFile("taosd", f"-dm -c {cfg}")
sc.dnodeStop(idx)
etool.runBinFile("taosd", "-a http://192.168.1.10")
etool.runBinFile("taosd", f"-E abc -c {cfg}")
etool.runBinFile("taosd", f"-e abc -c {cfg}")
def doTaos(self):
tdLog.info(f"check taos command options...")
#exe
etool.exeBinFile("taosd", f"-E abc -c {cfg}")
sc.dnodeStop(idx)
etool.exeBinFile("taosd", f"-e def -c {cfg}")
# run
@ -86,11 +89,12 @@ class TDTestCase(TBase):
# insert data
self.insertData()
# do taos
self.doTaos()
# do action
self.doTaosd()
# do taos
self.doTaos()
tdLog.success(f"{__file__} successfully executed")

View File

@ -32,7 +32,7 @@ class TDTestCase(TBase):
tdLog.info(f"insert data.")
# taosBenchmark run
json = etool.curFile(__file__, "mlevel_basic.json")
etool.runBenchmark(json=json)
etool.benchMark(json=json)
tdSql.execute(f"use {self.db}")
# set insert data information

View File

@ -54,7 +54,7 @@ class TDTestCase(TBase):
tdLog.info(f"insert data.")
# taosBenchmark run
json = etool.curFile(__file__, "s3_basic.json")
etool.runBenchmark(json=json)
etool.benchMark(json=json)
tdSql.execute(f"use {self.db}")
# set insert data information

View File

@ -61,9 +61,9 @@ def exeNoWait(file):
# run return output and error
def run(command):
def run(command, timeout = 10):
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process.wait(3)
process.wait(timeout)
output = process.stdout.read().decode(encoding="gbk")
error = process.stderr.read().decode(encoding="gbk")
@ -72,8 +72,8 @@ def run(command):
# return list after run
def runRetList(command):
output,error = run(command)
def runRetList(command, timeout=10):
output,error = run(command, timeout)
return output.splitlines()

View File

@ -24,7 +24,7 @@ import frame.eos
from frame.log import *
# run taosBenchmark with command or json file mode
def runBenchmark(command = "", json = "") :
def benchMark(command = "", json = "") :
# get taosBenchmark path
bmFile = frame.epath.binFile("taosBenchmark")
if frame.eos.isWin():
@ -53,3 +53,11 @@ def runBinFile(fname, command):
binFile += ".exe"
frame.eos.runRetList(f"{binFile} {command}")
# exe build/bin file
def exeBinFile(fname, command):
binFile = frame.epath.binFile(fname)
if frame.eos.isWin():
binFile += ".exe"
frame.eos.exe(f"{binFile} {command}")