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.") tdLog.info(f"insert data.")
# taosBenchmark run # taosBenchmark run
jfile = etool.curFile(__file__, "snapshot.json") jfile = etool.curFile(__file__, "snapshot.json")
etool.runBenchmark(json=jfile) etool.benchMark(json=jfile)
tdSql.execute(f"use {self.db}") tdSql.execute(f"use {self.db}")
# set insert data information # set insert data information

View File

@ -36,8 +36,11 @@ class TDTestCase(TBase):
self.timestamp_step = 1000 self.timestamp_step = 1000
# taosBenchmark run # 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): def doTaosd(self):
tdLog.info(f"check taosd command options...") tdLog.info(f"check taosd command options...")
@ -72,11 +75,11 @@ class TDTestCase(TBase):
etool.runBinFile("taosd", f"-dm -c {cfg}") etool.runBinFile("taosd", f"-dm -c {cfg}")
sc.dnodeStop(idx) sc.dnodeStop(idx)
etool.runBinFile("taosd", "-a http://192.168.1.10") 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): #exe
tdLog.info(f"check taos command options...") etool.exeBinFile("taosd", f"-E abc -c {cfg}")
sc.dnodeStop(idx)
etool.exeBinFile("taosd", f"-e def -c {cfg}")
# run # run
@ -86,11 +89,12 @@ class TDTestCase(TBase):
# insert data # insert data
self.insertData() self.insertData()
# do taos
self.doTaos()
# do action # do action
self.doTaosd() self.doTaosd()
# do taos
self.doTaos()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ import frame.eos
from frame.log import * from frame.log import *
# run taosBenchmark with command or json file mode # run taosBenchmark with command or json file mode
def runBenchmark(command = "", json = "") : def benchMark(command = "", json = "") :
# get taosBenchmark path # get taosBenchmark path
bmFile = frame.epath.binFile("taosBenchmark") bmFile = frame.epath.binFile("taosBenchmark")
if frame.eos.isWin(): if frame.eos.isWin():
@ -52,4 +52,12 @@ def runBinFile(fname, command):
if frame.eos.isWin(): if frame.eos.isWin():
binFile += ".exe" binFile += ".exe"
frame.eos.runRetList(f"{binFile} {command}") 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}")