Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
7240fe3b
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
464
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7240fe3b
编写于
7月 13, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
!405 修复mqueue_unittest用例存在偶尔无法通过的问题
Merge pull request !405 from phchang/fix_mq
上级
390159f5
e7c4b196
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
13 deletion
+19
-13
testsuites/unittest/common/include/osTest.h
testsuites/unittest/common/include/osTest.h
+1
-0
testsuites/unittest/common/osTest.cpp
testsuites/unittest/common/osTest.cpp
+7
-0
testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp
testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp
+7
-2
testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp
testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp
+1
-4
testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp
...suites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp
+3
-7
未找到文件。
testsuites/unittest/common/include/osTest.h
浏览文件 @
7240fe3b
...
...
@@ -132,6 +132,7 @@ extern void TestBusyTaskDelay(UINT32 tick);
extern
void
*
malloc
(
size_t
size
);
extern
void
TEST_DumpCpuid
(
void
);
extern
u_long
T_random
(
void
);
extern
VOID
TestAssertWaitDelay
(
UINT32
*
testCount
,
UINT32
flag
);
UINT32
LosTaskDelay
(
UINT32
tick
);
#define TEST_HwiDelete(ID) TEST_TEST_HwiDelete(ID, NULL)
...
...
testsuites/unittest/common/osTest.cpp
浏览文件 @
7240fe3b
...
...
@@ -215,6 +215,13 @@ VOID TestAssertBusyTaskDelay(UINT32 timeout, UINT32 flag)
}
}
VOID
TestAssertWaitDelay
(
UINT32
*
testCount
,
UINT32
flag
)
{
while
(
*
testCount
!=
flag
)
{
usleep
(
1
);
}
}
UINT32
PosixPthreadInit
(
pthread_attr_t
*
attr
,
int
pri
)
{
UINT32
uwRet
=
0
;
...
...
testsuites/unittest/posix/mqueue/full/It_posix_queue_075.cpp
浏览文件 @
7240fe3b
...
...
@@ -29,6 +29,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "It_posix_queue.h"
static
int
g_testFlag
=
0
;
static
VOID
*
PthreadF01
(
VOID
*
arg
)
{
...
...
@@ -37,12 +38,12 @@ static VOID *PthreadF01(VOID *arg)
CHAR
msgrcd
[
MQUEUE_STANDARD_NAME_LENGTH
]
=
{
0
};
struct
timespec
ts
=
{
0
};
ts
.
tv_sec
=
0xffff
;
for
(
i
=
0
;
i
<
MQUEUE_STANDARD_NAME_LENGTH
*
2
;
i
++
)
{
// 2, The loop frequency name length.
ret
=
mq_timedreceive
(
g_gqueue
,
msgrcd
,
MQUEUE_STANDARD_NAME_LENGTH
,
NULL
,
&
ts
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_SHORT_ARRAY_LENGTH
,
ret
,
EXIT
);
ICUNIT_GOTO_STRING_EQUAL
(
msgrcd
,
MQUEUE_SEND_STRING_TEST
,
msgrcd
,
EXIT
);
}
g_testFlag
=
0
;
// 0 means the sub thread has executed
return
NULL
;
EXIT:
return
NULL
;
...
...
@@ -62,6 +63,7 @@ static UINT32 Testcase(VOID)
attr
.
mq_msgsize
=
MQUEUE_STANDARD_NAME_LENGTH
;
attr
.
mq_maxmsg
=
MQUEUE_STANDARD_NAME_LENGTH
;
g_testFlag
=
1
;
// 1 initialize the flag
LOS_TaskLock
();
snprintf
(
mqname
,
MQUEUE_STANDARD_NAME_LENGTH
,
"/mq075_%d"
,
LosCurTaskIDGet
());
...
...
@@ -85,7 +87,10 @@ static UINT32 Testcase(VOID)
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
}
TestExtraTaskDelay
(
10
);
// 10, Set delay time.
// waitting for the flag is 0, means the sub thread has executed
while
(
g_testFlag
)
{
usleep
(
1
);
}
ret
=
mq_close
(
g_gqueue
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
...
...
testsuites/unittest/posix/mqueue/full/It_posix_queue_097.cpp
浏览文件 @
7240fe3b
...
...
@@ -107,9 +107,6 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh
,
&
attr1
,
PthreadF01
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
LosTaskDelay
(
1
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT1
);
ret
=
PosixPthreadInit
(
&
attr1
,
MQUEUE_PTHREAD_PRIORITY_TEST2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
...
...
@@ -119,7 +116,7 @@ static UINT32 Testcase(VOID)
ret
=
LosTaskDelay
(
10
);
// 10, Set delay time.
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT2
);
// 4, Here, assert the g_testCount.
TestAssertWaitDelay
(
&
g_testCount
,
4
);
// 4, Here, assert the g_testCount.
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
...
...
testsuites/unittest/posix/mqueue/smoke/It_posix_queue_053.cpp
浏览文件 @
7240fe3b
...
...
@@ -37,10 +37,7 @@ static VOID *PthreadF01(VOID *argument)
g_testCount
=
1
;
ret
=
LosTaskDelay
(
5
);
// 5, Set the timeout of task delay;
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
3
,
g_testCount
,
EXIT
);
// 3, Here, assert the g_testCount.
TestAssertWaitDelay
(
&
g_testCount
,
3
);
// 3, Here, assert the g_testCount.
ret
=
mq_send
(
g_gqueue
,
msgptr
,
strlen
(
msgptr
),
0
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT
);
...
...
@@ -105,8 +102,7 @@ static UINT32 Testcase(VOID)
ret
=
pthread_create
(
&
newTh1
,
&
attr1
,
PthreadF01
,
NULL
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT1
);
LosTaskDelay
(
1
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
1
,
g_testCount
,
EXIT1
);
TestAssertWaitDelay
(
&
g_testCount
,
1
);
ret
=
PosixPthreadInit
(
&
attr1
,
MQUEUE_PTHREAD_PRIORITY_TEST2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
...
...
@@ -121,7 +117,7 @@ static UINT32 Testcase(VOID)
#endif
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
ICUNIT_GOTO_EQUAL
(
g_testCount
,
4
,
g_testCount
,
EXIT2
);
// 4, Here, assert the g_testCount.
TestAssertWaitDelay
(
&
g_testCount
,
4
);
// 4, Here, assert the g_testCount.
ret
=
PosixPthreadDestroy
(
&
attr1
,
newTh2
);
ICUNIT_GOTO_EQUAL
(
ret
,
MQUEUE_NO_ERROR
,
ret
,
EXIT2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录