Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ba6cf0dd
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看板
提交
ba6cf0dd
编写于
4月 21, 2020
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add valgrind test support. current threshold is 23.
[TD-138]
上级
26aabe94
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
120 addition
and
45 deletion
+120
-45
.travis.yml
.travis.yml
+30
-15
tests/pytest/simpletest.sh
tests/pytest/simpletest.sh
+3
-1
tests/pytest/test.py
tests/pytest/test.py
+38
-5
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+30
-6
tests/pytest/util/log.py
tests/pytest/util/log.py
+1
-1
tests/test-all.sh
tests/test-all.sh
+18
-17
未找到文件。
.travis.yml
浏览文件 @
ba6cf0dd
...
...
@@ -24,10 +24,11 @@ matrix:
-
python-setuptools
-
python3-pip
-
python3-setuptools
-
valgrind
before_install
:
-
sudo apt update -y -qq
-
sudo apt install -y net-tools python-pip python-setuptools python3-pip python3-setuptools
-
sudo apt install -y net-tools python-pip python-setuptools python3-pip python3-setuptools
valgrind
before_script
:
-
cd ${TRAVIS_BUILD_DIR}
...
...
@@ -43,16 +44,32 @@ matrix:
case $TRAVIS_OS_NAME in
linux)
cd ${TRAVIS_BUILD_DIR}/debug
sudo make install ||
exit
$?
sudo make install ||
travis_terminate
$?
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
cd ${TRAVIS_BUILD_DIR}/tests
bash ./test-all.sh
./test-all.sh || travis_terminate $?
if [ "$?" -ne "0" ]; then
exit $?
cd ${TRAVIS_BUILD_DIR}/tests/pytest
./simpletest.sh -g 2>&1 | tee mem-error-out.txt
sleep 1
# Color setting
RED='\033[0;31m'
GREEN='\033[1;32m'
GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m'
memError=`grep -m 1 'ERROR SUMMARY' mem-error-out.txt | awk '{print $4}'`
if [ -n "$memError" ]; then
if [ "$memError" -gt 23 ]; then
echo -e "${RED} ## Memory errors number valgrind reports is $memError. More than our threshold! ## ${NC} "
travis_terminate $memError
fi
fi
;;
...
...
@@ -74,12 +91,12 @@ matrix:
# GitHub project metadata
# ** specific to your project **
project
:
name
:
sangshuduo/
TDengine
name
:
TDengine
version
:
2.x
description
:
sangshuduo
/TDengine
description
:
taosdata
/TDengine
# Where email notification of build analysis results will be sent
notification_email
:
s
angshuduo@gmail
.com
notification_email
:
s
dsang@taosdata
.com
# Commands to prepare for build_command
# ** likely specific to your build **
...
...
@@ -87,7 +104,7 @@ matrix:
# The command that will be added as an argument to "cov-build" to compile your project for analysis,
# ** likely specific to your build **
build_command
:
cmake --build .
build_command
:
make
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
# Take care in resource usage, and consider the build frequency allowances per
...
...
@@ -132,17 +149,17 @@ matrix:
case $TRAVIS_OS_NAME in
linux)
cd ${TRAVIS_BUILD_DIR}/debug
sudo make install ||
exit
$?
sudo make install ||
travis_terminate
$?
pip install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python2/
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
cd ${TRAVIS_BUILD_DIR}/tests
bash
./test-all.sh
./test-all.sh
if [ "$?" -ne "0" ]; then
exit
$?
travis_terminate
$?
fi
sudo pkill taosd
...
...
@@ -150,7 +167,7 @@ matrix:
cd ${TRAVIS_BUILD_DIR}
lcov -d . --capture --rc lcov_branch_coverage=1 -o coverage.info
lcov -l --rc lcov_branch_coverage=1 coverage.info ||
exit
$?
lcov -l --rc lcov_branch_coverage=1 coverage.info ||
travis_terminate
$?
gem install coveralls-lcov
...
...
@@ -166,7 +183,6 @@ matrix:
echo -e "${GREEN} ## Uploaded to Coveralls.io! ## ${NC}"
else
echo -e "${RED} ## Coveralls.io not collect coverage report! ## ${NC} "
exit $?
fi
bash <(curl -s https://codecov.io/bash) -y .codecov.yml -f coverage.info
...
...
@@ -174,7 +190,6 @@ matrix:
echo -e "${GREEN} ## Uploaded to Codecov! ## ${NC} "
else
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
exit $?
fi
;;
...
...
tests/pytest/simpletest.sh
浏览文件 @
ba6cf0dd
sudo
python ./test.py
-f
insert/basic.py
#!/bin/bash
python2 ./test.py
-f
insert/basic.py
$1
python2 ./test.py
-s
$1
tests/pytest/test.py
浏览文件 @
ba6cf0dd
...
...
@@ -15,6 +15,9 @@
# -*- coding: utf-8 -*-
import
sys
import
getopt
import
subprocess
from
distutils.log
import
warn
as
printf
from
util.log
import
*
from
util.dnodes
import
*
from
util.cases
import
*
...
...
@@ -29,8 +32,10 @@ if __name__ == "__main__":
deployPath
=
""
masterIp
=
""
testCluster
=
False
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'f:p:m:sch'
,
[
'file='
,
'path='
,
'master'
,
'stop'
,
'cluster'
,
'help'
])
valgrind
=
0
stop
=
0
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:scgh'
,
[
'file='
,
'path='
,
'master'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
])
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
...
...
@@ -41,21 +46,49 @@ if __name__ == "__main__":
tdLog
.
printNoPrefix
(
'-c Test Cluster Flag'
)
tdLog
.
printNoPrefix
(
'-s stop All dnodes'
)
sys
.
exit
(
0
)
if
key
in
[
'-f'
,
'--file'
]:
fileName
=
value
if
key
in
[
'-p'
,
'--path'
]:
deployPath
=
value
if
key
in
[
'-m'
,
'--master'
]:
masterIp
=
value
if
key
in
[
'-c'
,
'--cluster'
]:
testCluster
=
True
if
key
in
[
'-g'
,
'--valgrind'
]:
valgrind
=
1
if
key
in
[
'-s'
,
'--stop'
]:
cmd
=
"ps -ef|grep -w taosd | grep 'taosd' | grep -v grep | awk '{print $2}' && pkill -9 taosd"
os
.
system
(
cmd
)
tdLog
.
exit
(
'stop All dnodes'
)
stop
=
1
if
(
stop
!=
0
):
if
(
valgrind
==
0
):
toBeKilled
=
"taosd"
else
:
toBeKilled
=
"valgrind.bin"
killCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -HUP "
%
toBeKilled
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
while
(
processID
):
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
tdLog
.
exit
(
'stop All dnodes'
)
if
masterIp
==
""
:
tdDnodes
.
init
(
deployPath
)
tdDnodes
.
setValgrind
(
valgrind
)
if
testCluster
:
tdLog
.
notice
(
"Procedures for testing cluster"
)
if
fileName
==
"all"
:
...
...
tests/pytest/util/dnodes.py
浏览文件 @
ba6cf0dd
...
...
@@ -14,6 +14,7 @@
import
sys
import
os
import
os.path
import
subprocess
from
util.log
import
*
...
...
@@ -29,6 +30,9 @@ class TDSimClient:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/psim/log"
%
(
self
.
path
,)
self
.
cfgDir
=
"%s/sim/psim/cfg"
%
(
self
.
path
)
...
...
@@ -78,10 +82,14 @@ class TDDnode:
self
.
index
=
index
self
.
running
=
0
self
.
deployed
=
0
self
.
valgrind
=
0
def
init
(
self
,
path
):
self
.
path
=
path
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
):
self
.
logDir
=
"%s/sim/dnode%d/log"
%
(
self
.
path
,
self
.
index
)
self
.
dataDir
=
"%s/sim/dnode%d/data"
%
(
self
.
path
,
self
.
index
)
...
...
@@ -164,9 +172,18 @@ class TDDnode:
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
cmd
=
"nohup %staosd -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
self
.
valgrind
==
0
:
cmd
=
"nohup %staosd -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
else
:
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 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
...
...
@@ -275,8 +292,12 @@ class TDDnodes:
self
.
sim
.
init
(
self
.
path
)
self
.
sim
.
deploy
()
def
setValgrind
(
self
,
value
):
self
.
valgrind
=
value
def
deploy
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
setValgrind
(
self
.
valgrind
)
self
.
dnodes
[
index
-
1
].
deploy
()
def
cfg
(
self
,
index
,
option
,
value
):
...
...
@@ -312,11 +333,14 @@ class TDDnodes:
for
i
in
range
(
len
(
self
.
dnodes
)):
self
.
dnodes
[
i
].
stop
()
cmd
=
"sudo systemctl stop taosd"
os
.
system
(
cmd
)
psCmd
=
"ps -ef | grep -w taosd | grep 'root' | grep -v grep | awk '{print $2}'"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
if
processID
:
cmd
=
"sudo systemctl stop taosd"
os
.
system
(
cmd
)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
cmd
=
"ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' &&
sudo
pkill -sigkill taosd"
cmd
=
"ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd"
os
.
system
(
cmd
)
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
...
...
tests/pytest/util/log.py
浏览文件 @
ba6cf0dd
...
...
@@ -42,7 +42,7 @@ class TDLog:
printf
(
"
\033
[1;31m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
err
))
sys
.
exit
(
1
)
def
print
f
NoPrefix
(
self
,
info
):
def
printNoPrefix
(
self
,
info
):
printf
(
"
\033
[1;36m%s
\033
[0m"
%
(
info
))
...
...
tests/test-all.sh
浏览文件 @
ba6cf0dd
...
...
@@ -8,32 +8,33 @@ GREEN_UNDERLINE='\033[4;32m'
NC
=
'\033[0m'
cd
script
sudo
./test.sh 2>&1 |
grep
'success\|failed
'
|
tee
out.txt
./test.sh
-f
basicSuite.sim 2>&1 |
grep
'success\|failed\|fault
'
|
tee
out.txt
total_success
=
`
grep
success out.txt |
wc
-l
`
totalSuccess
=
`
grep
success out.txt |
wc
-l
`
totalBasic
=
`
grep
success out.txt |
grep
Suite |
wc
-l
`
if
[
"
$total
_s
uccess
"
-gt
"0"
]
;
then
total
_success
=
`
expr
$total_success
- 1
`
echo
-e
"
${
GREEN
}
### Total
$total
_s
uccess
TSIM case(s) succeed! ###
${
NC
}
"
if
[
"
$total
S
uccess
"
-gt
"0"
]
;
then
total
Success
=
`
expr
$totalSuccess
-
$totalBasic
`
echo
-e
"
${
GREEN
}
### Total
$total
S
uccess
TSIM case(s) succeed! ###
${
NC
}
"
fi
total
_failed
=
`
grep
failed
out.txt |
wc
-l
`
if
[
"
$total
_f
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
_f
ailed
TSIM case(s) failed! ###
${
NC
}
"
exit
$total
_f
ailed
total
Failed
=
`
grep
'failed\|fault'
out.txt |
wc
-l
`
if
[
"
$total
F
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
F
ailed
TSIM case(s) failed! ###
${
NC
}
"
exit
$total
F
ailed
fi
cd
../pytest
sudo
./simpletest.sh 2>&1 |
grep
'successfully executed\|failed'
|
tee
pytest-out.txt
total
_py_s
uccess
=
`
grep
'successfully executed'
pytest-out.txt |
wc
-l
`
./simpletest.sh 2>&1 |
grep
'successfully executed\|failed'
|
tee
pytest-out.txt
total
PyS
uccess
=
`
grep
'successfully executed'
pytest-out.txt |
wc
-l
`
if
[
"
$total
_py_s
uccess
"
-gt
"0"
]
;
then
echo
-e
"
${
GREEN
}
### Total
$total
_py_s
uccess
python case(s) succeed! ###
${
NC
}
"
if
[
"
$total
PyS
uccess
"
-gt
"0"
]
;
then
echo
-e
"
${
GREEN
}
### Total
$total
PyS
uccess
python case(s) succeed! ###
${
NC
}
"
fi
total
_py_f
ailed
=
`
grep
'failed'
pytest-out.txt |
wc
-l
`
if
[
"
$total
_py_f
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
_py_f
ailed
python case(s) failed! ###
${
NC
}
"
exit
$total
_py_f
ailed
total
PyF
ailed
=
`
grep
'failed'
pytest-out.txt |
wc
-l
`
if
[
"
$total
PyF
ailed
"
-ne
"0"
]
;
then
echo
-e
"
${
RED
}
### Total
$total
PyF
ailed
python case(s) failed! ###
${
NC
}
"
exit
$total
PyF
ailed
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录