Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
1e345f18
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
467
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看板
提交
1e345f18
编写于
6月 24, 2021
作者:
O
openharmony_ci
提交者:
Gitee
6月 24, 2021
浏览文件
操作
浏览文件
下载
差异文件
!338 修复rwlock门禁用例多次测试出现的超时不通过的问题
Merge pull request !338 from phchang/rwlock
上级
112cdebe
f793dc10
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
5 deletion
+10
-5
testsuites/unittest/process/rwlock/BUILD.gn
testsuites/unittest/process/rwlock/BUILD.gn
+1
-1
testsuites/unittest/process/rwlock/full/pthread_rwlock_test_002.cpp
.../unittest/process/rwlock/full/pthread_rwlock_test_002.cpp
+7
-4
testsuites/unittest/process/rwlock/process_rwlock_test.cpp
testsuites/unittest/process/rwlock/process_rwlock_test.cpp
+2
-0
未找到文件。
testsuites/unittest/process/rwlock/BUILD.gn
浏览文件 @
1e345f18
...
...
@@ -43,10 +43,10 @@ sources_entry = [
sources_smoke = [
"smoke/pthread_rwlock_test_001.cpp",
"smoke/pthread_rwlock_test_002.cpp",
]
sources_full = [
"full/pthread_rwlock_test_002.cpp",
]
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
...
...
testsuites/unittest/process/rwlock/
smoke
/pthread_rwlock_test_002.cpp
→
testsuites/unittest/process/rwlock/
full
/pthread_rwlock_test_002.cpp
浏览文件 @
1e345f18
...
...
@@ -100,6 +100,7 @@ static void *ThreadReadFunc(void *a)
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
while
(
loop
>
0
)
{
SLEEP_AND_YIELD
(
1
);
ret
=
pthread_rwlock_rdlock
(
&
g_rwlockLock
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
g_isReading
[
threadCount
]
=
1
;
...
...
@@ -139,6 +140,7 @@ static void *ThreadWriteFunc1(void *a)
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
while
(
CheckReadThreadExit
())
{
SLEEP_AND_YIELD
(
1
);
ret
=
pthread_rwlock_wrlock
(
&
g_rwlockLock
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
...
...
@@ -180,6 +182,7 @@ static void *ThreadWriteFunc(void *a)
int
threadCount
=
*
((
int
*
)
a
);
while
(
CheckReadThreadExit
()
||
CheckWriteThreadExit
())
{
SLEEP_AND_YIELD
(
1
);
ret
=
pthread_rwlock_wrlock
(
&
g_rwlockLock
);
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
...
...
@@ -247,20 +250,20 @@ static int PthreadRwlockTest(void)
count
=
1
;
while
(
count
<
WRITE_THREAD_COUNT
)
{
g_writePar
[
count
]
=
count
;
ret
=
pthread_create
(
&
newPthread
,
&
a
,
ThreadWriteFunc1
,
&
g_writePar
[
count
]);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
g_isWriting
[
count
]
=
0
;
g_isWriteExit
[
count
]
=
0
;
ret
=
pthread_create
(
&
newPthread
,
&
a
,
ThreadWriteFunc1
,
&
g_writePar
[
count
]);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
count
++
;
}
count
=
0
;
while
(
count
<
READ_THREAD_COUNT
)
{
g_readPar
[
count
]
=
count
;
ret
=
pthread_create
(
&
newPthread
,
&
a
,
ThreadReadFunc
,
&
g_readPar
[
count
]);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
g_isReading
[
count
]
=
0
;
g_isReadExit
[
count
]
=
0
;
ret
=
pthread_create
(
&
newPthread
,
&
a
,
ThreadReadFunc
,
&
g_readPar
[
count
]);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
count
++
;
}
...
...
testsuites/unittest/process/rwlock/process_rwlock_test.cpp
浏览文件 @
1e345f18
...
...
@@ -52,7 +52,9 @@ HWTEST_F(ProcessRwlockTest, ItTestPthreadRwlock001, TestSize.Level0)
{
ItTestPthreadRwlock001
();
}
#endif
#if defined(LOSCFG_USER_TEST_FULL)
/* *
* @tc.name: it_test_pthread_rwlock_002
* @tc.desc: function for ProcessRwlockTest
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录