Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4ad2e236
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4ad2e236
编写于
8月 23, 2021
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6169]<fix>: windows dll client can not quit.
上级
8d7cb8f0
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
120 addition
and
82 deletion
+120
-82
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+6
-1
src/os/src/detail/osFile.c
src/os/src/detail/osFile.c
+1
-1
tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md
tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md
+6
-0
tests/pytest/cluster/clusterSetup.py
tests/pytest/cluster/clusterSetup.py
+2
-2
tests/pytest/dockerCluster/basic.py
tests/pytest/dockerCluster/basic.py
+2
-2
tests/pytest/insert/binary.py
tests/pytest/insert/binary.py
+3
-2
tests/pytest/query/queryWithTaosdKilled.py
tests/pytest/query/queryWithTaosdKilled.py
+2
-1
tests/pytest/test.py
tests/pytest/test.py
+1
-1
tests/pytest/util/dnodes-default.py
tests/pytest/util/dnodes-default.py
+22
-17
tests/pytest/util/dnodes-no-random-fail.py
tests/pytest/util/dnodes-no-random-fail.py
+22
-17
tests/pytest/util/dnodes-random-fail.py
tests/pytest/util/dnodes-random-fail.py
+22
-17
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+30
-20
tests/pytest/wal/addOldWalTest.py
tests/pytest/wal/addOldWalTest.py
+1
-1
未找到文件。
src/connector/python/taos/cinterface.py
浏览文件 @
4ad2e236
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
ctypes
import
ctypes
import
platform
import
platform
import
sys
import
sys
import
os
from
ctypes
import
*
from
ctypes
import
*
try
:
try
:
from
typing
import
Any
from
typing
import
Any
...
@@ -37,7 +38,11 @@ def _load_taos_darwin():
...
@@ -37,7 +38,11 @@ def _load_taos_darwin():
def
_load_taos_windows
():
def
_load_taos_windows
():
return
ctypes
.
windll
.
LoadLibrary
(
"taos"
)
if
os
.
path
.
exists
(
"c:
\\
Windows
\\
System32
\\
taos.dll"
):
return
ctypes
.
windll
.
LoadLibrary
(
"taos"
)
else
:
print
(
"Please copy the
\"
C:
\\
TDengine
\\
driver
\\
taos.dll
\"
file to the
\"
C:
\\
windows
\\
system32
\"
directory."
)
return
ctypes
.
windll
.
LoadLibrary
(
"C:
\\
TDengine
\\
driver
\\
taos.dll"
)
def
_load_taos
():
def
_load_taos
():
...
...
src/os/src/detail/osFile.c
浏览文件 @
4ad2e236
...
@@ -368,7 +368,7 @@ int32_t taosFsync(FileFd fd) {
...
@@ -368,7 +368,7 @@ int32_t taosFsync(FileFd fd) {
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
(
fd
);
HANDLE
h
=
(
HANDLE
)
_get_osfhandle
(
fd
);
return
FlushFileBuffers
(
h
);
return
!
FlushFileBuffers
(
h
);
}
}
int32_t
taosRename
(
char
*
oldName
,
char
*
newName
)
{
int32_t
taosRename
(
char
*
oldName
,
char
*
newName
)
{
...
...
tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md
浏览文件 @
4ad2e236
...
@@ -49,6 +49,12 @@
...
@@ -49,6 +49,12 @@
> before the script line. Then you can look for the core file in
> before the script line. Then you can look for the core file in
> \<TDengine\>/tests/pytest after the program crash.
> \<TDengine\>/tests/pytest after the program crash.
> Note3: if you are on the windows platform, you can install the git client,
> and then add %GitPath%\usr\bin;%GitPath%\mingw64\bin;%GitPath%\bin to the system
> environment variable Path. Note that %GitPath% is the installation path of git,
> such as C:\Program Files\Git. Then you can run the test script using the
> "sh smoketest.sh" command.
### How to add a new test case
### How to add a new test case
...
...
tests/pytest/cluster/clusterSetup.py
浏览文件 @
4ad2e236
...
@@ -92,13 +92,13 @@ class Node:
...
@@ -92,13 +92,13 @@ class Node:
self
.
conn
.
run
(
"yes|./install.sh"
)
self
.
conn
.
run
(
"yes|./install.sh"
)
def
configTaosd
(
self
,
taosConfigKey
,
taosConfigValue
):
def
configTaosd
(
self
,
taosConfigKey
,
taosConfigValue
):
self
.
conn
.
run
(
"sudo echo
'%s %s'
>> %s"
%
(
taosConfigKey
,
taosConfigValue
,
"/etc/taos/taos.cfg"
))
self
.
conn
.
run
(
"sudo echo
%s %s
>> %s"
%
(
taosConfigKey
,
taosConfigValue
,
"/etc/taos/taos.cfg"
))
def
removeTaosConfig
(
self
,
taosConfigKey
,
taosConfigValue
):
def
removeTaosConfig
(
self
,
taosConfigKey
,
taosConfigValue
):
self
.
conn
.
run
(
"sudo sed -in-place -e '/%s %s/d' %s"
%
(
taosConfigKey
,
taosConfigValue
,
"/etc/taos/taos.cfg"
))
self
.
conn
.
run
(
"sudo sed -in-place -e '/%s %s/d' %s"
%
(
taosConfigKey
,
taosConfigValue
,
"/etc/taos/taos.cfg"
))
def
configHosts
(
self
,
ip
,
name
):
def
configHosts
(
self
,
ip
,
name
):
self
.
conn
.
run
(
"echo
'%s %s'
>> %s"
%
(
ip
,
name
,
'/etc/hosts'
))
self
.
conn
.
run
(
"echo
%s %s
>> %s"
%
(
ip
,
name
,
'/etc/hosts'
))
def
removeData
(
self
):
def
removeData
(
self
):
try
:
try
:
...
...
tests/pytest/dockerCluster/basic.py
浏览文件 @
4ad2e236
...
@@ -113,7 +113,7 @@ class BuildDockerCluser:
...
@@ -113,7 +113,7 @@ class BuildDockerCluser:
def
cfg
(
self
,
option
,
value
,
nodeIndex
):
def
cfg
(
self
,
option
,
value
,
nodeIndex
):
cfgPath
=
"%s/node%d/cfg/taos.cfg"
%
(
self
.
dockerDir
,
nodeIndex
)
cfgPath
=
"%s/node%d/cfg/taos.cfg"
%
(
self
.
dockerDir
,
nodeIndex
)
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
cfgPath
)
self
.
execCmd
(
cmd
)
self
.
execCmd
(
cmd
)
def
updateLocalhosts
(
self
):
def
updateLocalhosts
(
self
):
...
@@ -122,7 +122,7 @@ class BuildDockerCluser:
...
@@ -122,7 +122,7 @@ class BuildDockerCluser:
print
(
result
)
print
(
result
)
if
result
is
None
or
result
.
isspace
():
if
result
is
None
or
result
.
isspace
():
print
(
"=========="
)
print
(
"=========="
)
cmd
=
"echo
'172.27.0.7 tdnode1'
>> /etc/hosts"
cmd
=
"echo
172.27.0.7 tdnode1
>> /etc/hosts"
display
=
"echo %s"
%
cmd
display
=
"echo %s"
%
cmd
self
.
execCmd
(
display
)
self
.
execCmd
(
display
)
self
.
execCmd
(
cmd
)
self
.
execCmd
(
cmd
)
...
...
tests/pytest/insert/binary.py
浏览文件 @
4ad2e236
...
@@ -53,8 +53,9 @@ class TDTestCase:
...
@@ -53,8 +53,9 @@ class TDTestCase:
tdLog
.
info
(
"tdSql.checkData(0, 0, '34567')"
)
tdLog
.
info
(
"tdSql.checkData(0, 0, '34567')"
)
tdSql
.
checkData
(
0
,
0
,
'34567'
)
tdSql
.
checkData
(
0
,
0
,
'34567'
)
tdLog
.
info
(
"insert into tb values (now+4a,
\"
'';
\"
)"
)
tdLog
.
info
(
"insert into tb values (now+4a,
\"
'';
\"
)"
)
config_dir
=
subprocess
.
check_output
(
str
(
"ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"
),
stderr
=
subprocess
.
STDOUT
,
shell
=
True
).
decode
(
'utf-8'
).
replace
(
'
\n
'
,
''
)
# config_dir = subprocess.check_output(str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"), stderr=subprocess.STDOUT, shell=True).decode('utf-8').replace('\n', '')
result
=
''
.
join
(
os
.
popen
(
r
"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""
%
(
config_dir
)).
readlines
())
# result = ''.join(os.popen(r"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""%(config_dir)).readlines())
result
=
''
.
join
(
os
.
popen
(
r
"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""
%
(
tdSql
.
cursor
.
_connection
.
_config
)).
readlines
())
if
"Query OK"
not
in
result
:
tdLog
.
exit
(
"err:insert '';"
)
if
"Query OK"
not
in
result
:
tdLog
.
exit
(
"err:insert '';"
)
tdLog
.
info
(
'drop database db'
)
tdLog
.
info
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
...
...
tests/pytest/query/queryWithTaosdKilled.py
浏览文件 @
4ad2e236
...
@@ -34,7 +34,8 @@ class TDTestCase:
...
@@ -34,7 +34,8 @@ class TDTestCase:
path
=
tdDnodes
.
dnodes
[
1
].
getDnodeRootDir
(
1
)
path
=
tdDnodes
.
dnodes
[
1
].
getDnodeRootDir
(
1
)
print
(
path
)
print
(
path
)
tdLog
.
info
(
"sudo mkdir -p %s/data/vnode/vnode2/wal/old"
%
path
)
tdLog
.
info
(
"sudo mkdir -p %s/data/vnode/vnode2/wal/old"
%
path
)
os
.
system
(
"sudo mkdir -p %s/data/vnode/vnode2/wal/old"
%
path
)
# os.system("sudo mkdir -p %s/data/vnode/vnode2/wal/old" % path)
os
.
makedirs
(
"%s/data/vnode/vnode2/wal/old"
%
path
,
exist_ok
=
True
)
# like "mkdir -p"
def
run
(
self
):
def
run
(
self
):
# os.system("rm -rf %s/ " % tdDnodes.getDnodesRootDir())
# os.system("rm -rf %s/ " % tdDnodes.getDnodesRootDir())
...
...
tests/pytest/test.py
浏览文件 @
4ad2e236
...
@@ -55,7 +55,7 @@ if __name__ == "__main__":
...
@@ -55,7 +55,7 @@ if __name__ == "__main__":
restart
=
True
restart
=
True
if
key
in
[
'-f'
,
'--file'
]:
if
key
in
[
'-f'
,
'--file'
]:
fileName
=
value
fileName
=
value
.
replace
(
'
\r
'
,
""
)
if
key
in
[
'-p'
,
'--path'
]:
if
key
in
[
'-p'
,
'--path'
]:
deployPath
=
value
deployPath
=
value
...
...
tests/pytest/util/dnodes-default.py
浏览文件 @
4ad2e236
...
@@ -60,7 +60,7 @@ class TDSimClient:
...
@@ -60,7 +60,7 @@ class TDSimClient:
self
.
cfgDict
.
update
({
option
:
value
})
self
.
cfgDict
.
update
({
option
:
value
})
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
@@ -73,17 +73,19 @@ class TDSimClient:
...
@@ -73,17 +73,19 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"rm -rf "
+
self
.
cfgDir
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -149,17 +151,20 @@ class TDDnode:
...
@@ -149,17 +151,20 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
dataDir
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.dataDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -320,7 +325,7 @@ class TDDnode:
...
@@ -320,7 +325,7 @@ class TDDnode:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
...
tests/pytest/util/dnodes-no-random-fail.py
浏览文件 @
4ad2e236
...
@@ -58,7 +58,7 @@ class TDSimClient:
...
@@ -58,7 +58,7 @@ class TDSimClient:
self
.
cfgDict
.
update
({
option
:
value
})
self
.
cfgDict
.
update
({
option
:
value
})
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
@@ -71,17 +71,19 @@ class TDSimClient:
...
@@ -71,17 +71,19 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"rm -rf "
+
self
.
cfgDir
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -147,17 +149,20 @@ class TDDnode:
...
@@ -147,17 +149,20 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
dataDir
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.dataDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -318,7 +323,7 @@ class TDDnode:
...
@@ -318,7 +323,7 @@ class TDDnode:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
...
tests/pytest/util/dnodes-random-fail.py
浏览文件 @
4ad2e236
...
@@ -58,7 +58,7 @@ class TDSimClient:
...
@@ -58,7 +58,7 @@ class TDSimClient:
self
.
cfgDict
.
update
({
option
:
value
})
self
.
cfgDict
.
update
({
option
:
value
})
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
@@ -71,17 +71,19 @@ class TDSimClient:
...
@@ -71,17 +71,19 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"rm -rf "
+
self
.
cfgDir
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -147,17 +149,20 @@ class TDDnode:
...
@@ -147,17 +149,20 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
dataDir
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.dataDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -318,7 +323,7 @@ class TDDnode:
...
@@ -318,7 +323,7 @@ class TDDnode:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
...
tests/pytest/util/dnodes.py
浏览文件 @
4ad2e236
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
import
sys
import
sys
import
os
import
os
import
os.path
import
os.path
import
platform
import
subprocess
import
subprocess
from
time
import
sleep
from
time
import
sleep
from
util.log
import
*
from
util.log
import
*
...
@@ -61,7 +62,7 @@ class TDSimClient:
...
@@ -61,7 +62,7 @@ class TDSimClient:
self
.
cfgDict
.
update
({
option
:
value
})
self
.
cfgDict
.
update
({
option
:
value
})
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
@@ -74,17 +75,19 @@ class TDSimClient:
...
@@ -74,17 +75,19 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"rm -rf "
+
self
.
cfgDir
cmd
=
"rm -rf "
+
self
.
cfgDir
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -185,17 +188,20 @@ class TDDnode:
...
@@ -185,17 +188,20 @@ class TDDnode:
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
cmd
=
"mkdir -p "
+
self
.
dataDir
os
.
makedirs
(
self
.
dataDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.dataDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
logDir
os
.
makedirs
(
self
.
logDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.logDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"mkdir -p "
+
self
.
cfgDir
os
.
makedirs
(
self
.
cfgDir
,
exist_ok
=
True
)
# like "mkdir -p"
if
os
.
system
(
cmd
)
!=
0
:
# cmd = "mkdir -p " + self.cfgDir
tdLog
.
exit
(
cmd
)
# if os.system(cmd) != 0:
# tdLog.exit(cmd)
cmd
=
"touch "
+
self
.
cfgPath
cmd
=
"touch "
+
self
.
cfgPath
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
...
@@ -246,7 +252,7 @@ class TDDnode:
...
@@ -246,7 +252,7 @@ class TDDnode:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
"taosd.exe"
)
in
files
)
or
((
"taosd"
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
@@ -267,7 +273,11 @@ class TDDnode:
...
@@ -267,7 +273,11 @@ class TDDnode:
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 %s -c %s > /dev/null 2>&1 & "
%
(
if
platform
.
system
()
==
"Windows"
:
cmd
=
"mintty %s -c %s"
%
(
binPath
,
self
.
cfgDir
)
else
:
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"
...
@@ -292,7 +302,7 @@ class TDDnode:
...
@@ -292,7 +302,7 @@ class TDDnode:
i
+=
1
i
+=
1
if
i
>
50
:
if
i
>
50
:
break
break
popen
=
subprocess
.
Popen
(
'tail -f '
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
popen
=
subprocess
.
Popen
(
'tail -f
-n +0
'
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
pid
=
popen
.
pid
pid
=
popen
.
pid
# print('Popen.pid:' + str(pid))
# print('Popen.pid:' + str(pid))
timeout
=
time
.
time
()
+
60
*
2
timeout
=
time
.
time
()
+
60
*
2
...
@@ -404,7 +414,7 @@ class TDDnode:
...
@@ -404,7 +414,7 @@ class TDDnode:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
def
cfg
(
self
,
option
,
value
):
def
cfg
(
self
,
option
,
value
):
cmd
=
"echo
'%s %s'
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
cmd
=
"echo
%s %s
>> %s"
%
(
option
,
value
,
self
.
cfgPath
)
if
os
.
system
(
cmd
)
!=
0
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
tdLog
.
exit
(
cmd
)
...
...
tests/pytest/wal/addOldWalTest.py
浏览文件 @
4ad2e236
...
@@ -31,7 +31,7 @@ class TDTestCase:
...
@@ -31,7 +31,7 @@ class TDTestCase:
def
createOldDirAndAddWal
(
self
):
def
createOldDirAndAddWal
(
self
):
oldDir
=
tdDnodes
.
getDnodesRootDir
()
+
"dnode1/data/vnode/vnode2/wal/old"
oldDir
=
tdDnodes
.
getDnodesRootDir
()
+
"dnode1/data/vnode/vnode2/wal/old"
os
.
system
(
"sudo echo
'test'
>> %s/wal"
%
oldDir
)
os
.
system
(
"sudo echo
test
>> %s/wal"
%
oldDir
)
def
run
(
self
):
def
run
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录