Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7d8a3e33
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7d8a3e33
编写于
5月 27, 2022
作者:
wafwerar
提交者:
GitHub
5月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13111 from taosdata/fix/ZhiqiangWang/TD-15849-windows-run-shell-case
fix(os): windows run shell case
上级
e435bcc6
f999132f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
92 addition
and
50 deletion
+92
-50
tests/pytest/test.py
tests/pytest/test.py
+6
-6
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+9
-9
tests/system-test/0-others/taosShellError.py
tests/system-test/0-others/taosShellError.py
+23
-9
tests/system-test/0-others/taosShellNetChk.py
tests/system-test/0-others/taosShellNetChk.py
+45
-16
tests/system-test/0-others/taosdMonitor.py
tests/system-test/0-others/taosdMonitor.py
+1
-1
tests/system-test/0-others/telemetry.py
tests/system-test/0-others/telemetry.py
+1
-1
tests/system-test/test.py
tests/system-test/test.py
+7
-8
未找到文件。
tests/pytest/test.py
浏览文件 @
7d8a3e33
...
...
@@ -18,6 +18,7 @@ import getopt
import
subprocess
import
time
from
distutils.log
import
warn
as
printf
import
platform
from
util.log
import
*
from
util.dnodes
import
*
...
...
@@ -36,8 +37,10 @@ if __name__ == "__main__":
stop
=
0
restart
=
False
windows
=
0
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrw'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'windows'
])
if
platform
.
system
().
lower
()
==
'windows'
:
windows
=
1
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghr'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'restart'
])
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
...
...
@@ -64,9 +67,6 @@ if __name__ == "__main__":
if
key
in
[
'-m'
,
'--master'
]:
masterIp
=
value
if
key
in
[
'-w'
,
'--windows'
]:
windows
=
1
if
key
in
[
'-l'
,
'--logSql'
]:
if
(
value
.
upper
()
==
"TRUE"
):
logSql
=
True
...
...
@@ -146,7 +146,7 @@ if __name__ == "__main__":
else
:
pass
tdDnodes
.
deploy
(
1
,{})
tdDnodes
.
start
Win
(
1
)
tdDnodes
.
start
(
1
)
else
:
remote_conn
=
Connection
(
"root@%s"
%
host
)
with
remote_conn
.
cd
(
'/var/lib/jenkins/workspace/TDinternal/community/tests/pytest'
):
...
...
tests/pytest/util/dnodes.py
浏览文件 @
7d8a3e33
...
...
@@ -333,7 +333,7 @@ class TDDnode:
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
cmd
=
"mintty -h never %s -c %s"
%
(
cmd
=
"mintty -h never
-w hide
%s -c %s"
%
(
binPath
,
self
.
cfgDir
)
if
(
taosadapterBinPath
!=
""
):
...
...
@@ -424,9 +424,10 @@ class TDDnode:
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
for
port
in
range
(
6030
,
6041
):
fuserCmd
=
"fuser -k -n tcp %d"
%
port
os
.
system
(
fuserCmd
)
if
not
platform
.
system
().
lower
()
==
'windows'
:
for
port
in
range
(
6030
,
6041
):
fuserCmd
=
"fuser -k -n tcp %d"
%
port
os
.
system
(
fuserCmd
)
if
self
.
valgrind
:
time
.
sleep
(
2
)
...
...
@@ -571,11 +572,10 @@ class TDDnodes:
def
start
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
start
()
def
startWin
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
startWin
()
if
platform
.
system
().
lower
()
==
'windows'
:
self
.
dnodes
[
index
-
1
].
startWin
()
else
:
self
.
dnodes
[
index
-
1
].
start
()
def
startWithoutSleep
(
self
,
index
):
self
.
check
(
index
)
...
...
tests/system-test/0-others/taosShellError.py
浏览文件 @
7d8a3e33
...
...
@@ -3,7 +3,11 @@ import taos
import
sys
import
time
import
socket
import
pexpect
import
platform
if
platform
.
system
().
lower
()
==
'windows'
:
import
wexpect
as
taosExpect
else
:
import
pexpect
as
taosExpect
import
os
from
util.log
import
*
...
...
@@ -15,7 +19,11 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
if
len
(
key
)
==
0
:
tdLog
.
exit
(
"taos test key is null!"
)
taosCmd
=
buildPath
+
'/build/bin/taos '
if
platform
.
system
().
lower
()
==
'windows'
:
taosCmd
=
buildPath
+
'
\\
build
\\
bin
\\
taos.exe '
taosCmd
=
taosCmd
.
replace
(
'
\\
'
,
'
\\\\
'
)
else
:
taosCmd
=
buildPath
+
'/build/bin/taos '
if
len
(
cfgDir
)
!=
0
:
taosCmd
=
taosCmd
+
'-c '
+
cfgDir
...
...
@@ -36,23 +44,29 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
tdLog
.
info
(
"taos cmd: %s"
%
taosCmd
)
child
=
pe
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
child
=
taosE
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
#output = child.readline()
#print (output.decode())
if
len
(
expectString
)
!=
0
:
i
=
child
.
expect
([
expectString
,
pexpect
.
TIMEOUT
,
pe
xpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
expectString
,
taosExpect
.
TIMEOUT
,
taosE
xpect
.
EOF
],
timeout
=
6
)
else
:
i
=
child
.
expect
([
pexpect
.
TIMEOUT
,
pe
xpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
taosExpect
.
TIMEOUT
,
taosE
xpect
.
EOF
],
timeout
=
6
)
retResult
=
child
.
before
.
decode
()
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
else
:
retResult
=
child
.
before
.
decode
()
print
(
"cmd return result:
\n
%s
\n
"
%
retResult
)
#print(child.after.decode())
if
i
==
0
:
print
(
'taos login success! Here can run sql, taos> '
)
if
len
(
sqlString
)
!=
0
:
child
.
sendline
(
sqlString
)
w
=
child
.
expect
([
"Query OK"
,
pexpect
.
TIMEOUT
,
pexpect
.
EOF
],
timeout
=
1
)
retResult
=
child
.
before
.
decode
()
w
=
child
.
expect
([
"Query OK"
,
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
1
)
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
else
:
retResult
=
child
.
before
.
decode
()
if
w
==
0
:
return
"TAOS_OK"
,
retResult
else
:
...
...
@@ -103,7 +117,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
tests/system-test/0-others/taosShellNetChk.py
浏览文件 @
7d8a3e33
...
...
@@ -3,7 +3,11 @@ import taos
import
sys
import
time
import
socket
import
pexpect
import
platform
if
platform
.
system
().
lower
()
==
'windows'
:
import
wexpect
as
taosExpect
else
:
import
pexpect
as
taosExpect
import
os
from
util.log
import
*
...
...
@@ -15,7 +19,11 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
if
len
(
key
)
==
0
:
tdLog
.
exit
(
"taos test key is null!"
)
taosCmd
=
buildPath
+
'/build/bin/taos '
if
platform
.
system
().
lower
()
==
'windows'
:
taosCmd
=
buildPath
+
'
\\
build
\\
bin
\\
taos.exe '
taosCmd
=
taosCmd
.
replace
(
'
\\
'
,
'
\\\\
'
)
else
:
taosCmd
=
buildPath
+
'/build/bin/taos '
if
len
(
cfgDir
)
!=
0
:
taosCmd
=
taosCmd
+
'-c '
+
cfgDir
...
...
@@ -36,23 +44,29 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
tdLog
.
info
(
"taos cmd: %s"
%
taosCmd
)
child
=
pe
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
child
=
taosE
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
#output = child.readline()
#print (output.decode())
if
len
(
expectString
)
!=
0
:
i
=
child
.
expect
([
expectString
,
pexpect
.
TIMEOUT
,
pe
xpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
expectString
,
taosExpect
.
TIMEOUT
,
taosE
xpect
.
EOF
],
timeout
=
6
)
else
:
i
=
child
.
expect
([
pexpect
.
TIMEOUT
,
pe
xpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
taosExpect
.
TIMEOUT
,
taosE
xpect
.
EOF
],
timeout
=
6
)
retResult
=
child
.
before
.
decode
()
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
else
:
retResult
=
child
.
before
.
decode
()
print
(
"expect() return code: %d, content:
\n
%s
\n
"
%
(
i
,
retResult
))
#print(child.after.decode())
if
i
==
0
:
print
(
'taos login success! Here can run sql, taos> '
)
if
len
(
sqlString
)
!=
0
:
child
.
sendline
(
sqlString
)
w
=
child
.
expect
([
"Query OK"
,
pexpect
.
TIMEOUT
,
pexpect
.
EOF
],
timeout
=
1
)
retResult
=
child
.
before
.
decode
()
w
=
child
.
expect
([
"Query OK"
,
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
1
)
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
else
:
retResult
=
child
.
before
.
decode
()
if
w
==
0
:
return
"TAOS_OK"
,
retResult
else
:
...
...
@@ -103,7 +117,7 @@ class TDTestCase:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
"taosd"
in
files
or
"taosd.exe"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
...
...
@@ -168,21 +182,33 @@ class TDTestCase:
tdDnodes
.
stop
(
1
)
role
=
'server'
taosCmd
=
'nohup '
+
buildPath
+
'/build/bin/taos -c '
+
keyDict
[
'c'
]
taosCmd
=
taosCmd
+
' -n '
+
role
+
' > /dev/null 2>&1 &'
if
platform
.
system
().
lower
()
==
'windows'
:
taosCmd
=
'mintty -h never -w hide '
+
buildPath
+
'
\\
build
\\
bin
\\
taos.exe -c '
+
keyDict
[
'c'
]
taosCmd
=
taosCmd
.
replace
(
'
\\
'
,
'
\\\\
'
)
taosCmd
=
taosCmd
+
' -n '
+
role
else
:
taosCmd
=
'nohup '
+
buildPath
+
'/build/bin/taos -c '
+
keyDict
[
'c'
]
taosCmd
=
taosCmd
+
' -n '
+
role
+
' > /dev/null 2>&1 &'
print
(
taosCmd
)
os
.
system
(
taosCmd
)
pktLen
=
'2000'
pktNum
=
'10'
role
=
'client'
taosCmd
=
buildPath
+
'/build/bin/taos -c '
+
keyDict
[
'c'
]
if
platform
.
system
().
lower
()
==
'windows'
:
taosCmd
=
buildPath
+
'
\\
build
\\
bin
\\
taos.exe -c '
+
keyDict
[
'c'
]
taosCmd
=
taosCmd
.
replace
(
'
\\
'
,
'
\\\\
'
)
else
:
taosCmd
=
buildPath
+
'/build/bin/taos -c '
+
keyDict
[
'c'
]
taosCmd
=
taosCmd
+
' -n '
+
role
+
' -l '
+
pktLen
+
' -N '
+
pktNum
print
(
taosCmd
)
child
=
pe
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
i
=
child
.
expect
([
pexpect
.
TIMEOUT
,
pe
xpect
.
EOF
],
timeout
=
6
)
child
=
taosE
xpect
.
spawn
(
taosCmd
,
timeout
=
3
)
i
=
child
.
expect
([
taosExpect
.
TIMEOUT
,
taosE
xpect
.
EOF
],
timeout
=
6
)
retResult
=
child
.
before
.
decode
()
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
else
:
retResult
=
child
.
before
.
decode
()
print
(
"expect() return code: %d, content:
\n
%s
\n
"
%
(
i
,
retResult
))
#print(child.after.decode())
if
i
==
0
:
...
...
@@ -195,7 +221,10 @@ class TDTestCase:
else
:
tdLog
.
exit
(
'taos -n client fail!'
)
os
.
system
(
'pkill taos'
)
if
platform
.
system
().
lower
()
==
'windows'
:
os
.
system
(
'ps -a | grep taos | awk
\'
{print $2}
\'
| xargs kill -9'
)
else
:
os
.
system
(
'pkill taos'
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/0-others/taosdMonitor.py
浏览文件 @
7d8a3e33
...
...
@@ -2,7 +2,7 @@ import taos
import
sys
import
time
import
socket
import
pexpect
#
import pexpect
import
os
import
http.server
import
gzip
...
...
tests/system-test/0-others/telemetry.py
浏览文件 @
7d8a3e33
...
...
@@ -2,7 +2,7 @@ import taos
import
sys
import
time
import
socket
import
pexpect
#
import pexpect
import
os
import
http.server
import
gzip
...
...
tests/system-test/test.py
浏览文件 @
7d8a3e33
...
...
@@ -19,6 +19,7 @@ import subprocess
import
time
import
base64
import
json
import
platform
from
distutils.log
import
warn
as
printf
from
fabric2
import
Connection
sys
.
path
.
append
(
"../pytest"
)
...
...
@@ -40,9 +41,11 @@ if __name__ == "__main__":
stop
=
0
restart
=
False
windows
=
0
if
platform
.
system
().
lower
()
==
'windows'
:
windows
=
1
updateCfgDict
=
{}
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghr
w
d:'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'
windows
'
,
'updateCfgDict'
])
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrd:'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'
restart
'
,
'updateCfgDict'
])
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
...
...
@@ -55,7 +58,6 @@ if __name__ == "__main__":
tdLog
.
printNoPrefix
(
'-c Test Cluster Flag'
)
tdLog
.
printNoPrefix
(
'-g valgrind Test Flag'
)
tdLog
.
printNoPrefix
(
'-r taosd restart test'
)
tdLog
.
printNoPrefix
(
'-w taos on windows'
)
tdLog
.
printNoPrefix
(
'-d update cfg dict, base64 json str'
)
sys
.
exit
(
0
)
...
...
@@ -89,9 +91,6 @@ if __name__ == "__main__":
if
key
in
[
'-s'
,
'--stop'
]:
stop
=
1
if
key
in
[
'-w'
,
'--windows'
]:
windows
=
1
if
key
in
[
'-d'
,
'--updateCfgDict'
]:
try
:
updateCfgDict
=
eval
(
base64
.
b64decode
(
value
.
encode
()).
decode
())
...
...
@@ -163,13 +162,13 @@ if __name__ == "__main__":
pass
tdDnodes
.
deploy
(
1
,
updateCfgDict
)
if
masterIp
==
""
or
masterIp
==
"localhost"
:
tdDnodes
.
start
Win
(
1
)
tdDnodes
.
start
(
1
)
else
:
remote_conn
=
Connection
(
"root@%s"
%
host
)
with
remote_conn
.
cd
(
'/var/lib/jenkins/workspace/TDinternal/community/tests/pytest'
):
remote_conn
.
run
(
"python3 ./test.py %s"
%
updateCfgDictStr
)
# print("docker exec -d cross_platform bash -c \"cd ~/test/community/tests/system-test && python3 ./test.py %s\""%updateCfgDictStr)
# os.system("docker exec -d cross_platform bash -c \"cd ~/test/community/tests/system-test && python3 ./test.py %s\""%updateCfgDictStr)
# os.system("docker exec -d cross_platform bash -c \"cd ~/test/community/tests/system-test &&
(ps -aux | grep taosd | head -n 1 | awk '{print $2}' | xargs kill -9) && rm -rf /root/test/sim/dnode1/data/ &&
python3 ./test.py %s\""%updateCfgDictStr)
# time.sleep(2)
conn
=
taos
.
connect
(
host
=
"%s"
%
(
host
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录