Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dfa88ea4
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看板
未验证
提交
dfa88ea4
编写于
11月 21, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18285 from taosdata/fix/TD-20530
test: python asan
上级
f26e00a5
c454f849
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
53 addition
and
22 deletion
+53
-22
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+12
-3
tests/pytest/util/log.py
tests/pytest/util/log.py
+1
-1
tests/script/sh/checkAsan.sh
tests/script/sh/checkAsan.sh
+7
-1
tests/script/sh/exec.sh
tests/script/sh/exec.sh
+1
-0
tests/script/sh/sigint_stop_dnodes.sh
tests/script/sh/sigint_stop_dnodes.sh
+1
-1
tests/script/sh/stop_dnodes.sh
tests/script/sh/stop_dnodes.sh
+1
-1
tests/system-test/pytest.sh
tests/system-test/pytest.sh
+27
-12
tests/system-test/test.py
tests/system-test/test.py
+1
-1
未找到文件。
tests/parallel_test/cases.task
浏览文件 @
dfa88ea4
...
...
@@ -438,11 +438,11 @@
,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py
,,,system-test,python3 ./test.py -f 1-insert/InsertFuturets.py
,,,system-test,python3 ./test.py -f 0-others/show.py
,,,system-test,python3 ./test.py -f 2-query/abs.py
,,,system-test,
./pytest.sh
python3 ./test.py -f 2-query/abs.py
,,,system-test,python3 ./test.py -f 2-query/abs.py -R
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py
,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py -R
,,,system-test,python3 ./test.py -f 2-query/apercentile.py
,,,system-test,
./pytest.sh
python3 ./test.py -f 2-query/apercentile.py
,,,system-test,python3 ./test.py -f 2-query/apercentile.py -R
,,,system-test,python3 ./test.py -f 2-query/arccos.py
,,,system-test,python3 ./test.py -f 2-query/arccos.py -R
...
...
tests/pytest/util/dnodes.py
浏览文件 @
dfa88ea4
...
...
@@ -162,7 +162,11 @@ class TDDnode:
def
setAsan
(
self
,
value
):
self
.
asan
=
value
if
value
:
self
.
execPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/exec.sh"
)
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
self
.
execPath
=
os
.
path
.
abspath
(
self
.
path
+
"/community/tests/script/sh/exec.sh"
)
else
:
self
.
execPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/exec.sh"
)
def
getDataSize
(
self
):
totalSize
=
0
...
...
@@ -670,8 +674,13 @@ class TDDnodes:
def
setAsan
(
self
,
value
):
self
.
asan
=
value
if
value
:
self
.
stopDnodesPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/stop_dnodes.sh"
)
self
.
stopDnodesSigintPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/sigint_stop_dnodes.sh"
)
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
self
.
stopDnodesPath
=
os
.
path
.
abspath
(
self
.
path
+
"/community/tests/script/sh/stop_dnodes.sh"
)
self
.
stopDnodesSigintPath
=
os
.
path
.
abspath
(
self
.
path
+
"/community/tests/script/sh/sigint_stop_dnodes.sh"
)
else
:
self
.
stopDnodesPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/stop_dnodes.sh"
)
self
.
stopDnodesSigintPath
=
os
.
path
.
abspath
(
self
.
path
+
"/tests/script/sh/sigint_stop_dnodes.sh"
)
tdLog
.
info
(
"run in address sanitizer mode"
)
def
setKillValgrind
(
self
,
value
):
...
...
tests/pytest/util/log.py
浏览文件 @
dfa88ea4
...
...
@@ -33,7 +33,7 @@ class TDLog:
print
(
"
\033
[1;36m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
err
))
def
success
(
self
,
info
):
print
(
"
\033
[1;32m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
info
))
print
f
(
"
\033
[1;32m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
info
))
def
notice
(
self
,
err
):
print
(
"
\033
[1;33m%s %s
\033
[0m"
%
(
datetime
.
datetime
.
now
(),
err
))
...
...
tests/script/sh/checkAsan.sh
浏览文件 @
dfa88ea4
...
...
@@ -3,6 +3,7 @@
set
+e
#set -x
unset
LD_PRELOAD
SCRIPT_DIR
=
`
dirname
$0
`
cd
$SCRIPT_DIR
/../
SCRIPT_DIR
=
`
pwd
`
...
...
@@ -21,19 +22,24 @@ error_num=`cat ${LOG_DIR}/*.asan | grep "ERROR" | wc -l`
memory_leak
=
`
cat
${
LOG_DIR
}
/
*
.asan |
grep
"Direct leak"
|
wc
-l
`
indirect_leak
=
`
cat
${
LOG_DIR
}
/
*
.asan |
grep
"Indirect leak"
|
wc
-l
`
runtime_error
=
`
cat
${
LOG_DIR
}
/
*
.asan |
grep
"runtime error"
|
grep
-v
"trees.c:873"
|
wc
-l
`
python_error
=
`
cat
${
LOG_DIR
}
/
*
.info |
grep
-w
"stack"
|
wc
-l
`
echo
-e
"
\0
33[44;32;1m"
asan error_num:
$error_num
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan memory_leak:
$memory_leak
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan indirect_leak:
$indirect_leak
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan runtime error:
$runtime_error
"
\0
33[0m"
echo
-e
"
\0
33[44;32;1m"
asan python error:
$python_error
"
\0
33[0m"
let
"errors=
$error_num
+
$memory_leak
+
$indirect_leak
+
$runtime_error
"
let
"errors=
$error_num
+
$memory_leak
+
$indirect_leak
+
$runtime_error
+
$python_error
"
if
[
$errors
-eq
0
]
;
then
echo
-e
"
\0
33[44;32;1m"
no asan errors
"
\0
33[0m"
exit
0
else
echo
-e
"
\0
33[44;31;1m"
asan total errors:
$errors
"
\0
33[0m"
if
[
$python_error
-ne
0
]
;
then
cat
${
LOG_DIR
}
/
*
.info
fi
cat
${
LOG_DIR
}
/
*
.asan
exit
1
fi
\ No newline at end of file
tests/script/sh/exec.sh
浏览文件 @
dfa88ea4
...
...
@@ -11,6 +11,7 @@
set
+e
#set -x
unset
LD_PRELOAD
UNAME_BIN
=
`
which
uname
`
OS_TYPE
=
`
$UNAME_BIN
`
...
...
tests/script/sh/sigint_stop_dnodes.sh
浏览文件 @
dfa88ea4
...
...
@@ -3,7 +3,7 @@
set
+e
#set -x
export
LD_PRELOAD
=
unset
LD_PRELOAD
UNAME_BIN
=
`
which
uname
`
OS_TYPE
=
`
$UNAME_BIN
`
...
...
tests/script/sh/stop_dnodes.sh
浏览文件 @
dfa88ea4
...
...
@@ -3,10 +3,10 @@
set
+e
#set -x
unset
LD_PRELOAD
UNAME_BIN
=
`
which
uname
`
OS_TYPE
=
`
$UNAME_BIN
`
export
LD_PRELOAD
=
PID
=
`
ps
-ef
|grep /usr/bin/taosd |
grep
-v
grep
|
awk
'{print $2}'
`
if
[
-n
"
$PID
"
]
;
then
echo
systemctl stop taosd
...
...
tests/system-test/test.sh
→
tests/system-test/
py
test.sh
浏览文件 @
dfa88ea4
...
...
@@ -45,13 +45,11 @@ declare -x SIM_DIR=$TOP_DIR/sim
PROGRAM
=
$BUILD_DIR
/build/bin/tsim
PRG_DIR
=
$SIM_DIR
/tsim
ASAN_DIR
=
$SIM_DIR
/asan
SYSTEM_TEST_DIR
=
$TOP_DIR
/tests/system-test
chmod
-R
777
$PRG_DIR
echo
"------------------------------------------------------------------------"
echo
"Start TDengine Testing Case ..."
echo
"BUILD_DIR:
$BUILD_DIR
"
echo
"SYSTEM_TEST_DIR :
$SYSTEM_TEST_DIR
"
echo
"SIM_DIR :
$SIM_DIR
"
echo
"CODE_DIR :
$CODE_DIR
"
echo
"ASAN_DIR :
$ASAN_DIR
"
...
...
@@ -61,23 +59,40 @@ rm -rf $SIM_DIR/*
mkdir
-p
$PRG_DIR
mkdir
-p
$ASAN_DIR
cd
$
SYSTEM_TEST
_DIR
cd
$
CODE
_DIR
ulimit
-n
600000
ulimit
-c
unlimited
#sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e
echo
"ExcuteCmd:"
$*
echo
"AsanDir:"
$ASAN_DIR
/psim.asan
export
LD_PRELOAD
=
libasan.so.5
$*
-a
2>
$ASAN_DIR
/psim.asan
result
=
$?
echo
"Execute result:"
$result
if
[
$result
-eq
0
]
;
then
$CODE_DIR
/sh/checkAsan.sh
AsanFile
=
$ASAN_DIR
/psim.info
echo
"AsanFile:"
$AsanFile
unset
LD_PRELOAD
#export LD_PRELOAD=libasan.so.5
export
LD_PRELOAD
=
`
gcc
-print-file-name
=
libasan.so
`
echo
"Preload AsanSo:"
$?
$*
-a
2>
$AsanFile
unset
LD_PRELOAD
AsanFileLen
=
`
cat
$AsanFile
|
wc
-l
`
while
[
$AsanFileLen
-lt
10
]
do
sleep
1
`
cat
$AsanFile
|
wc
-l
`
done
echo
"AsanFileLen:"
$AsanFileLen
AsanFileSuccessLen
=
`
grep
-w
successfully
$AsanFile
|
wc
-l
`
echo
"AsanFileSuccessLen:"
$AsanFileSuccessLen
if
[
$AsanFileSuccessLen
-gt
0
]
;
then
echo
"Execute script successfully and check asan"
$CODE_DIR
/../script/sh/checkAsan.sh
else
echo
"Execute script failure"
exit
1
fi
tests/system-test/test.py
浏览文件 @
dfa88ea4
...
...
@@ -555,5 +555,5 @@ if __name__ == "__main__":
conn
.
close
()
if
asan
:
tdDnodes
.
StopAllSigint
()
tdLog
.
info
(
"
a
ddress sanitizer mode finished"
)
tdLog
.
info
(
"
A
ddress sanitizer mode finished"
)
sys
.
exit
(
0
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录