Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5382648b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
5382648b
编写于
4月 06, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc test
上级
f84c1fd0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
19 deletion
+55
-19
source/dnode/mgmt/test/sut/inc/sut.h
source/dnode/mgmt/test/sut/inc/sut.h
+1
-3
source/util/src/tprocess.c
source/util/src/tprocess.c
+3
-2
source/util/test/CMakeLists.txt
source/util/test/CMakeLists.txt
+4
-4
source/util/test/procTest.cpp
source/util/test/procTest.cpp
+47
-10
未找到文件。
source/dnode/mgmt/test/sut/inc/sut.h
浏览文件 @
5382648b
...
...
@@ -40,9 +40,7 @@ class Testbase {
void
ServerStart
();
void
ClientRestart
();
SRpcMsg
*
SendReq
(
tmsg_t
msgType
,
void
*
pCont
,
int32_t
contLen
);
private:
void
InitLog
(
const
char
*
path
);
void
InitLog
(
const
char
*
path
);
private:
TestServer
server
;
...
...
source/util/src/tprocess.c
浏览文件 @
5382648b
...
...
@@ -80,7 +80,7 @@ static int32_t taosProcInitMutex(SProcQueue *pQueue) {
}
if
(
taosThreadMutexInit
(
&
pQueue
->
mutex
,
&
mattr
)
!=
0
)
{
taosThreadMutex
Destroy
(
&
pQueue
->
mutex
);
taosThreadMutex
AttrDestroy
(
&
mattr
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to init mutex since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -472,7 +472,8 @@ void taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, c
ProcFuncType
ftype
)
{
int32_t
retry
=
0
;
while
(
taosProcQueuePush
(
pProc
,
pProc
->
pParentQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
0
,
ftype
)
!=
0
)
{
uInfo
(
"proc:%s, failed to put msg to queue:%p since %s, retry:%d"
,
pProc
->
name
,
pProc
->
pParentQueue
,
terrstr
(),
retry
);
uInfo
(
"proc:%s, failed to put msg to queue:%p since %s, retry:%d"
,
pProc
->
name
,
pProc
->
pParentQueue
,
terrstr
(),
retry
);
retry
++
;
taosMsleep
(
retry
);
}
...
...
source/util/test/CMakeLists.txt
浏览文件 @
5382648b
...
...
@@ -46,11 +46,11 @@ add_executable(encodeTest "encodeTest.cpp")
target_link_libraries
(
encodeTest os util gtest gtest_main
)
# queueTest
add_executable
(
proc
_t
est
"procTest.cpp"
)
target_link_libraries
(
proc
_test os util
gtest_main
)
add_executable
(
proc
T
est
"procTest.cpp"
)
target_link_libraries
(
proc
Test os util transport sut
gtest_main
)
add_test
(
NAME proc
_t
est
COMMAND proc
_t
est
NAME proc
T
est
COMMAND proc
T
est
)
# cfgTest
...
...
source/util/test/procTest.cpp
浏览文件 @
5382648b
...
...
@@ -10,19 +10,56 @@
*/
#include <gtest/gtest.h>
#include "os.h"
#include "tprocess.h"
#include "tqueue.h"
#include "trpc.h"
#include "sut.h"
#include <sys/shm.h>
#include <sys/wait.h>
class
UtilTestQueue
:
public
::
testing
::
Test
{
class
UtilTesProc
:
public
::
testing
::
Test
{
public:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
void
SetUp
()
override
{
test
.
InitLog
(
"/tmp/td"
);
uDebugFlag
=
207
;
shm
.
id
=
-
1
;
}
void
TearDown
()
override
{
taosDropShm
(
&
shm
);
}
public:
static
void
SetUpTestSuite
()
{}
static
void
TearDownTestSuite
()
{}
static
Testbase
test
;
static
SShm
shm
;
static
void
SetUpTestSuite
()
{}
static
void
TearDownTestSuite
()
{}
};
Testbase
UtilTesProc
::
test
;
SShm
UtilTesProc
::
shm
;
TEST_F
(
UtilTesProc
,
01
_Create_Drop_Proc
)
{
ASSERT_EQ
(
taosCreateShm
(
&
shm
,
1234
,
1024
*
1024
*
2
),
0
);
shm
.
size
=
1023
;
SProcCfg
cfg
=
{.
childConsumeFp
=
(
ProcConsumeFp
)
NULL
,
.
childMallocHeadFp
=
(
ProcMallocFp
)
taosAllocateQitem
,
.
childFreeHeadFp
=
(
ProcFreeFp
)
taosFreeQitem
,
.
childMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
childFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
parentConsumeFp
=
(
ProcConsumeFp
)
NULL
,
.
parentMallocHeadFp
=
(
ProcMallocFp
)
taosMemoryMalloc
,
.
parentFreeHeadFp
=
(
ProcFreeFp
)
taosMemoryFree
,
.
parentMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
parentFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
shm
=
shm
,
.
parent
=
&
shm
,
.
name
=
"1234"
};
SProcObj
*
proc
=
taosProcInit
(
&
cfg
);
ASSERT_EQ
(
proc
,
nullptr
);
shm
.
size
=
2468
;
cfg
.
shm
=
shm
;
proc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
proc
,
nullptr
);
taosDropShm
(
&
shm
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录