make python test framework detect TDinternal and TDengine automatically.
[TD-328]
This commit is contained in:
parent
ddc68fb721
commit
b814a46320
|
@ -38,9 +38,9 @@ class TDSimClient:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
def deploy(self):
|
def deploy(self):
|
||||||
self.logDir = "%s/sim/psim/log" % (self.path,)
|
self.logDir = "%s/pysim/psim/log" % (self.path,)
|
||||||
self.cfgDir = "%s/sim/psim/cfg" % (self.path)
|
self.cfgDir = "%s/pysim/psim/cfg" % (self.path)
|
||||||
self.cfgPath = "%s/sim/psim/cfg/taos.cfg" % (self.path)
|
self.cfgPath = "%s/pysim/psim/cfg/taos.cfg" % (self.path)
|
||||||
|
|
||||||
cmd = "rm -rf " + self.logDir
|
cmd = "rm -rf " + self.logDir
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
|
@ -100,10 +100,10 @@ class TDDnode:
|
||||||
self.valgrind = value
|
self.valgrind = value
|
||||||
|
|
||||||
def deploy(self):
|
def deploy(self):
|
||||||
self.logDir = "%s/sim/dnode%d/log" % (self.path, self.index)
|
self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index)
|
||||||
self.dataDir = "%s/sim/dnode%d/data" % (self.path, self.index)
|
self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index)
|
||||||
self.cfgDir = "%s/sim/dnode%d/cfg" % (self.path, self.index)
|
self.cfgDir = "%s/pysim/dnode%d/cfg" % (self.path, self.index)
|
||||||
self.cfgPath = "%s/sim/dnode%d/cfg/taos.cfg" % (self.path, self.index)
|
self.cfgPath = "%s/pysim/dnode%d/cfg/taos.cfg" % (self.path, self.index)
|
||||||
|
|
||||||
cmd = "rm -rf " + self.dataDir
|
cmd = "rm -rf " + self.dataDir
|
||||||
if os.system(cmd) != 0:
|
if os.system(cmd) != 0:
|
||||||
|
@ -177,21 +177,42 @@ class TDDnode:
|
||||||
(self.index, self.cfgPath))
|
(self.index, self.cfgPath))
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
binPath = os.path.dirname(os.path.realpath(__file__))
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
binPath = binPath + "/../../../debug/"
|
binPath = ""
|
||||||
binPath = os.path.realpath(binPath)
|
|
||||||
binPath += "/build/bin/"
|
if ("TDinternal" in selfPath):
|
||||||
|
projPath = selfPath + "/../../../../"
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(projPath):
|
||||||
|
if ("taosd" in files):
|
||||||
|
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||||
|
if ("community" not in rootRealPath):
|
||||||
|
binPath = os.path.join(root, "taosd")
|
||||||
|
break;
|
||||||
|
else:
|
||||||
|
projPath = selfPath + "/../../../"
|
||||||
|
for root, dirs, files in os.walk(projPath):
|
||||||
|
if ("taosd" in files):
|
||||||
|
rootRealPath = os.path.dirname(os.path.realpath(root))
|
||||||
|
if ("packaging" not in rootRealPath):
|
||||||
|
binPath = os.path.join(root, "taosd")
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (binPath == ""):
|
||||||
|
tdLog.exit("taosd not found!s")
|
||||||
|
else:
|
||||||
|
tdLog.notice("taosd found in %s" % rootRealPath)
|
||||||
|
|
||||||
if self.deployed == 0:
|
if self.deployed == 0:
|
||||||
tdLog.exit("dnode:%d is not deployed" % (self.index))
|
tdLog.exit("dnode:%d is not deployed" % (self.index))
|
||||||
|
|
||||||
if self.valgrind == 0:
|
if self.valgrind == 0:
|
||||||
cmd = "nohup %staosd -c %s > /dev/null 2>&1 & " % (
|
cmd = "nohup %s -c %s > /dev/null 2>&1 & " % (
|
||||||
binPath, self.cfgDir)
|
binPath, self.cfgDir)
|
||||||
else:
|
else:
|
||||||
valgrindCmdline = "valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
|
valgrindCmdline = "valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
|
||||||
|
|
||||||
cmd = "nohup %s %staosd -c %s 2>&1 & " % (
|
cmd = "nohup %s %s -c %s 2>&1 & " % (
|
||||||
valgrindCmdline, binPath, self.cfgDir)
|
valgrindCmdline, binPath, self.cfgDir)
|
||||||
|
|
||||||
print(cmd)
|
print(cmd)
|
||||||
|
@ -268,11 +289,11 @@ class TDDnode:
|
||||||
tdLog.exit(cmd)
|
tdLog.exit(cmd)
|
||||||
|
|
||||||
def getDnodeRootDir(self, index):
|
def getDnodeRootDir(self, index):
|
||||||
dnodeRootDir = "%s/sim/psim/dnode%d" % (self.path, index)
|
dnodeRootDir = "%s/pysim/psim/dnode%d" % (self.path, index)
|
||||||
return dnodeRootDir
|
return dnodeRootDir
|
||||||
|
|
||||||
def getDnodesRootDir(self):
|
def getDnodesRootDir(self):
|
||||||
dnodesRootDir = "%s/sim/psim" % (self.path)
|
dnodesRootDir = "%s/pysim/psim" % (self.path)
|
||||||
return dnodesRootDir
|
return dnodesRootDir
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,7 +438,7 @@ class TDDnodes:
|
||||||
# tdLog.exit(cmd)
|
# tdLog.exit(cmd)
|
||||||
|
|
||||||
def getDnodesRootDir(self):
|
def getDnodesRootDir(self):
|
||||||
dnodesRootDir = "%s/sim" % (self.path)
|
dnodesRootDir = "%s/pysim" % (self.path)
|
||||||
return dnodesRootDir
|
return dnodesRootDir
|
||||||
|
|
||||||
def getSimCfgPath(self):
|
def getSimCfgPath(self):
|
||||||
|
|
Loading…
Reference in New Issue