Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9b68fc80
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9b68fc80
编写于
7月 06, 2021
作者:
O
openharmony_ci
提交者:
Gitee
7月 06, 2021
浏览文件
操作
浏览文件
下载
差异文件
!304 【轻内核】【master】修改semTest里面失败的用例
Merge pull request !304 from limeng/kernel_lite_20210703_01
上级
458fcc0c
b60b38d2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
6 addition
and
8 deletion
+6
-8
kernel_lite/ipc_posix/semaphore/SemTest.cpp
kernel_lite/ipc_posix/semaphore/SemTest.cpp
+6
-8
未找到文件。
kernel_lite/ipc_posix/semaphore/SemTest.cpp
浏览文件 @
9b68fc80
...
@@ -224,6 +224,7 @@ void *ThreadSemTryWait(void *arg)
...
@@ -224,6 +224,7 @@ void *ThreadSemTryWait(void *arg)
for
(
int
i
=
0
;
i
<
loop
;
i
++
)
{
for
(
int
i
=
0
;
i
<
loop
;
i
++
)
{
if
(
sem_trywait
(
sem
)
==
0
)
{
if
(
sem_trywait
(
sem
)
==
0
)
{
break
;
break
;
}
}
Msleep
(
10
);
Msleep
(
10
);
}
}
...
@@ -254,11 +255,9 @@ HWTEST_F(SemTest, testThreadSemTryWait, Function | MediumTest | Level3)
...
@@ -254,11 +255,9 @@ HWTEST_F(SemTest, testThreadSemTryWait, Function | MediumTest | Level3)
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"sem_post errno = "
<<
errno
;
Msleep
(
20
);
reInt
=
pthread_join
(
tid
,
nullptr
);
EXPECT_EQ
(
sem_getvalue
(
&
sem
,
&
semValue
),
0
)
<<
"> sem_getvalue errno = "
<<
errno
;
EXPECT_EQ
(
sem_getvalue
(
&
sem
,
&
semValue
),
0
)
<<
"> sem_getvalue errno = "
<<
errno
;
EXPECT_EQ
(
semValue
,
1
);
EXPECT_EQ
(
semValue
,
1
);
reInt
=
pthread_join
(
tid
,
nullptr
);
EXPECT_EQ
(
reInt
,
0
)
<<
"pthread_join failed, errno="
<<
reInt
;
EXPECT_EQ
(
reInt
,
0
)
<<
"pthread_join failed, errno="
<<
reInt
;
EXPECT_EQ
(
sem_destroy
(
&
sem
),
0
)
<<
"> sem_destroy errno = "
<<
errno
;
EXPECT_EQ
(
sem_destroy
(
&
sem
),
0
)
<<
"> sem_destroy errno = "
<<
errno
;
}
}
...
@@ -275,10 +274,11 @@ void *ThreadSemTimedWait(void *arg)
...
@@ -275,10 +274,11 @@ void *ThreadSemTimedWait(void *arg)
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
ts
.
tv_sec
=
ts
.
tv_sec
+
(
ts
.
tv_nsec
+
KERNEL_100MS_BY_NS
)
/
KERNEL_NS_PER_SECOND
;
ts
.
tv_sec
=
ts
.
tv_sec
+
(
ts
.
tv_nsec
+
KERNEL_100MS_BY_NS
)
/
KERNEL_NS_PER_SECOND
;
ts
.
tv_nsec
=
(
ts
.
tv_nsec
+
KERNEL_100MS_BY_NS
)
%
KERNEL_NS_PER_SECOND
;
ts
.
tv_nsec
=
(
ts
.
tv_nsec
+
KERNEL_100MS_BY_NS
)
%
KERNEL_NS_PER_SECOND
;
Msleep
(
50
);
EXPECT_EQ
(
sem_timedwait
(
sem
,
&
ts
),
0
)
<<
"sem_timedwait errno = "
<<
errno
;
EXPECT_EQ
(
sem_timedwait
(
sem
,
&
ts
),
0
)
<<
"sem_timedwait errno = "
<<
errno
;
EXPECT_EQ
(
sem_getvalue
(
sem
,
&
semValue
),
0
)
<<
"sem_getvalue errno = "
<<
errno
;
EXPECT_EQ
(
sem_getvalue
(
sem
,
&
semValue
),
0
)
<<
"sem_getvalue errno = "
<<
errno
;
Msleep
(
100
);
EXPECT_EQ
(
semValue
,
1
);
EXPECT_EQ
(
semValue
,
1
);
return
nullptr
;
return
nullptr
;
}
}
...
@@ -306,11 +306,9 @@ HWTEST_F(SemTest, testThreadSemTimedWait, Function | MediumTest | Level3)
...
@@ -306,11 +306,9 @@ HWTEST_F(SemTest, testThreadSemTimedWait, Function | MediumTest | Level3)
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"> sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"> sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"> sem_post errno = "
<<
errno
;
EXPECT_EQ
(
sem_post
(
&
sem
),
0
)
<<
"> sem_post errno = "
<<
errno
;
Msleep
(
100
);
reInt
=
pthread_join
(
tid
,
nullptr
);
EXPECT_EQ
(
sem_getvalue
(
&
sem
,
&
semValue
),
0
)
<<
"> sem_getvalue errno = "
<<
errno
;
EXPECT_EQ
(
sem_getvalue
(
&
sem
,
&
semValue
),
0
)
<<
"> sem_getvalue errno = "
<<
errno
;
EXPECT_EQ
(
semValue
,
1
);
EXPECT_EQ
(
semValue
,
1
);
reInt
=
pthread_join
(
tid
,
nullptr
);
EXPECT_EQ
(
reInt
,
0
)
<<
"pthread_join failed, errno="
<<
reInt
;
EXPECT_EQ
(
reInt
,
0
)
<<
"pthread_join failed, errno="
<<
reInt
;
EXPECT_EQ
(
sem_destroy
(
&
sem
),
0
)
<<
"> sem_destroy errno = "
<<
errno
;
EXPECT_EQ
(
sem_destroy
(
&
sem
),
0
)
<<
"> sem_destroy errno = "
<<
errno
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录