Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e0fd6cbe
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
e0fd6cbe
编写于
4月 06, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
auto_crash_gen_script.py update
上级
6dd05c12
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
0 deletion
+38
-0
tests/auto_crash_gen_script/auto_crash_gen_script.py
tests/auto_crash_gen_script/auto_crash_gen_script.py
+38
-0
未找到文件。
tests/auto_crash_gen_script/auto_crash_gen_script.py
浏览文件 @
e0fd6cbe
...
...
@@ -54,6 +54,7 @@ def get_path():
break
return
buildPath
def
random_args
(
args_list
):
nums_args_list
=
[
"--max-dbs"
,
"--num-replicas"
,
"--num-dnodes"
,
"--max-steps"
,
"--num-threads"
,]
# record int type arguments
bools_args_list
=
[
"--auto-start-service"
,
"--debug"
,
"--run-tdengine"
,
"--ignore-errors"
,
"--track-memory-leaks"
,
"--larger-data"
,
"--mix-oos-data"
,
"--dynamic-db-table-names"
,
...
...
@@ -76,6 +77,12 @@ def random_args(args_list):
args_list
[
"--debug"
]
=
False
args_list
[
"--per-thread-db-connection"
]
=
True
args_list
[
"--track-memory-leaks"
]
=
False
num
=
random
.
randint
(
1
,
10
)
# set --track-memory-leaks randomly
if
num
>
8
:
args_list
[
"--track-memory-leaks"
]
=
True
args_list
[
"--max-steps"
]
=
random
.
randint
(
300
,
500
)
threads
=
[
32
,
64
,
128
,
256
]
...
...
@@ -175,6 +182,9 @@ def run_crash_gen(crash_cmds,result_file):
def
check_status
(
result_file
):
run_code
=
subprocess
.
Popen
(
"tail -n 50 %s"
%
result_file
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
os
.
system
(
"tail -n 50 %s>>%s"
%
(
result_file
,
exit_status_logs
))
mem_status
=
check_memory
(
run_dir
)
if
mem_status
>
0
:
return
mem_status
if
"Crash_Gen is now exiting with status code: 1"
in
run_code
:
return
1
elif
"Crash_Gen is now exiting with status code: 0"
in
run_code
:
...
...
@@ -182,6 +192,31 @@ def check_status(result_file):
else
:
return
2
def
check_memory
(
run_dir
):
'''
invalid read, invalid write
'''
mem_report_path
=
os
.
path
.
join
(
run_dir
,
"reporter"
)
if
not
os
.
path
.
exists
(
mem_report_path
):
os
.
mkdir
(
mem_report_path
)
status
=
0
stderr_files
=
subprocess
.
Popen
(
"find %s -name
\"
stderr.log
\"
"
%
run_dir
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
stderr_list
=
stderr_files
.
split
(
"
\n
"
)[:
-
1
]
for
stderr_file
in
stderr_list
:
print
(
stderr_file
)
grep_res
=
subprocess
.
Popen
(
"grep -i 'Invalid read' %s "
%
stderr_file
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
if
grep_res
:
os
.
system
(
"cp %s %s"
%
(
stderr_file
,
mem_report_path
))
status
=
4
break
grep_res
=
subprocess
.
Popen
(
"grep -i 'Invalid write' %s "
%
stderr_file
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
).
stdout
.
read
().
decode
(
"utf-8"
)
if
grep_res
:
status
=
4
os
.
system
(
"cp %s %s"
%
(
stderr_file
,
mem_report_path
))
break
return
status
def
main
():
args_list
=
{
"--auto-start-service"
:
False
,
"--max-dbs"
:
0
,
"--connector-type"
:
"native"
,
"--debug"
:
False
,
"--run-tdengine"
:
False
,
"--ignore-errors"
:[],
"--num-replicas"
:
1
,
"--track-memory-leaks"
:
False
,
"--larger-data"
:
False
,
"--mix-oos-data"
:
False
,
"--dynamic-db-table-names"
:
False
,
"--num-dnodes"
:
1
,
...
...
@@ -215,7 +250,10 @@ def main():
print
(
crash_cmds
)
run_crash_gen
(
crash_cmds
,
run_log_file
)
status
=
check_status
(
run_log_file
)
print
(
"exit status : "
,
status
)
if
status
==
4
:
print
(
'======== crash_gen found memory bugs at reporter ========'
)
if
status
>
0
:
print
(
'======== crash_gen run failed and not exit as expected ========'
)
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录