Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
e1ee02e3
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e1ee02e3
编写于
5月 18, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ready to merge crash_gen into develop branch
上级
80d25528
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
899 addition
and
4 deletion
+899
-4
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+27
-4
tests/pytest/crash_gen_0519.py
tests/pytest/crash_gen_0519.py
+831
-0
tests/pytest/crash_gen_0519.sh
tests/pytest/crash_gen_0519.sh
+41
-0
未找到文件。
tests/pytest/crash_gen.py
浏览文件 @
e1ee02e3
...
...
@@ -26,6 +26,7 @@ import threading
import
random
import
logging
import
datetime
import
textwrap
from
typing
import
List
...
...
@@ -140,13 +141,13 @@ class WorkerThread:
if
(
gConfig
.
per_thread_db_connection
):
return
self
.
_dbConn
.
execute
(
sql
)
else
:
return
self
.
_tc
.
getDbState
.
getDbConn
().
execute
(
sql
)
return
self
.
_tc
.
getDbState
()
.
getDbConn
().
execute
(
sql
)
def
querySql
(
self
,
sql
):
# not "execute", since we are out side the DB context
if
(
gConfig
.
per_thread_db_connection
):
return
self
.
_dbConn
.
query
(
sql
)
else
:
return
self
.
_tc
.
getDbState
.
getDbConn
().
query
(
sql
)
return
self
.
_tc
.
getDbState
()
.
getDbConn
().
query
(
sql
)
class
ThreadCoordinator
:
def
__init__
(
self
,
pool
,
wd
:
WorkDispatcher
,
dbState
):
...
...
@@ -414,7 +415,18 @@ class DbState():
# self.openDbServerConnection()
self
.
_dbConn
=
DbConn
()
self
.
_dbConn
.
open
()
try
:
self
.
_dbConn
.
open
()
# may throw taos.error.ProgrammingError: disconnected
except
taos
.
error
.
ProgrammingError
as
err
:
# print("Error type: {}, msg: {}, value: {}".format(type(err), err.msg, err))
if
(
err
.
msg
==
'disconnected'
):
# cannot open DB connection
print
(
"Cannot establish DB connection, please re-run script without parameter, and follow the instructions."
)
sys
.
exit
()
else
:
raise
except
:
print
(
"[=]Unexpected exception"
)
raise
self
.
_dbConn
.
resetDb
()
# drop and recreate DB
self
.
_state
=
self
.
STATE_EMPTY
# initial state, the result of above
...
...
@@ -773,7 +785,15 @@ class WorkDispatcher():
def
main
():
# Super cool Python argument library: https://docs.python.org/3/library/argparse.html
parser
=
argparse
.
ArgumentParser
(
description
=
'TDengine Auto Crash Generator'
)
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
,
description
=
textwrap
.
dedent
(
'''
\
TDengine Auto Crash Generator (PLEASE NOTICE the Prerequisites Below)
---------------------------------------------------------------------
1. You build TDengine in the top level ./build directory, as described in offical docs
2. You run the server there before this script: ./build/bin/taosd -c test/cfg
'''
))
parser
.
add_argument
(
'-p'
,
'--per-thread-db-connection'
,
action
=
'store_true'
,
help
=
'Use a single shared db connection (default: false)'
)
parser
.
add_argument
(
'-d'
,
'--debug'
,
action
=
'store_true'
,
...
...
@@ -785,6 +805,9 @@ def main():
global
gConfig
gConfig
=
parser
.
parse_args
()
if
len
(
sys
.
argv
)
==
1
:
parser
.
print_help
()
sys
.
exit
()
global
logger
logger
=
logging
.
getLogger
(
'myApp'
)
...
...
tests/pytest/crash_gen_0519.py
0 → 100755
浏览文件 @
e1ee02e3
此差异已折叠。
点击以展开。
tests/pytest/crash_gen_0519.sh
0 → 100755
浏览文件 @
e1ee02e3
#!/bin/bash
# This is the script for us to try to cause the TDengine server or client to crash
#
# PREPARATION
#
# 1. Build an compile the TDengine source code that comes with this script, in the same directory tree
# 2. Please follow the direction in our README.md, and build TDengine in the build/ directory
# 3. Adjust the configuration file if needed under build/test/cfg/taos.cfg
# 4. Run the TDengine server instance: cd build; ./build/bin/taosd -c test/cfg
# 5. Make sure you have a working Python3 environment: run /usr/bin/python3 --version, and you should get 3.6 or above
# 6. Make sure you have the proper Python packages: # sudo apt install python3-setuptools python3-pip python3-distutils
#
# RUNNING THIS SCRIPT
#
# This script assumes the source code directory is intact, and that the binaries has been built in the
# build/ directory, as such, will will load the Python libraries in the directory tree, and also load
# the TDengine client shared library (so) file, in the build/directory, as evidenced in the env
# variables below.
#
# Running the script is simple, no parameter is needed (for now, but will change in the future).
#
# Happy Crashing...
# Due to the heavy path name assumptions/usage, let us require that the user be in the current directory
EXEC_DIR
=
`
dirname
"
$0
"
`
if
[[
$EXEC_DIR
!=
"."
]]
then
echo
"ERROR: Please execute
`
basename
"
$0
"
`
in its own directory (for now anyway, pardon the dust)"
exit
-1
fi
# First we need to set up a path for Python to find our own TAOS modules, so that "import" can work.
export
PYTHONPATH
=
$(
pwd
)
/../../src/connector/python/linux/python3
# Then let us set up the library path so that our compiled SO file can be loaded by Python
export
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:
$(
pwd
)
/../../build/build/lib
# Now we are all let, and let's see if we can find a crash. Note we pass all params
./crash_gen_0519.py
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录