Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
92ee0d32
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看板
提交
92ee0d32
编写于
4月 06, 2021
作者:
A
alex
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve failed test cases:ActsTimeApiTest#AlarmTest#testSetItTimeOneshot
Change-Id: If61683f8fd4fe2a6236008c9fb8b27a4e7c272e9
上级
78dc699c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
10 deletion
+12
-10
kernel_lite/time_posix/src/AlarmTest.cpp
kernel_lite/time_posix/src/AlarmTest.cpp
+10
-10
kernel_lite/time_posix/src/AlarmTest.h
kernel_lite/time_posix/src/AlarmTest.h
+2
-0
未找到文件。
kernel_lite/time_posix/src/AlarmTest.cpp
浏览文件 @
92ee0d32
...
...
@@ -93,7 +93,7 @@ HWTEST_F(AlarmTest, testAlarmFork, Function | MediumTest | Level2)
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"======== Fork Error! ========="
;
if
(
pid
==
0
)
{
// child
Msleep
(
1100
);
Msleep
(
MSLEEP_TIME
);
if
(
mReceivedSignal
!=
0
)
{
if
(
mReceivedSignal
==
SIGALRM
)
{
LOG
(
"child received SIGALRM!"
);
...
...
@@ -105,7 +105,7 @@ HWTEST_F(AlarmTest, testAlarmFork, Function | MediumTest | Level2)
exit
(
0
);
}
}
else
{
// parent
Msleep
(
1100
);
Msleep
(
MSLEEP_TIME
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
);
WaitProcExitedOK
(
pid
);
}
...
...
@@ -229,7 +229,7 @@ HWTEST_F(AlarmTest, testTimerCreateEventSignal, Function | MediumTest | Level3)
EXPECT_EQ
(
timer_settime
(
tid
,
0
,
&
its
,
NULL
),
0
)
<<
"ERROR: timer_settime() != 0"
;
uint32_t
setMillisec
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_nsec
/
1000000
;
Msleep
(
setMillisec
+
10
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
EXPECT_EQ
(
mReceivedSignal
,
ev
.
sigev_signo
)
<<
"mReceivedSignal != ev.sigev_signo"
;
EXPECT_EQ
(
timer_delete
(
tid
),
0
)
<<
"ERROR: timer_delete() != 0"
;
...
...
@@ -259,7 +259,7 @@ HWTEST_F(AlarmTest, testTimerCreateEventDefault, Function | MediumTest | Level3)
setMillisec
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_nsec
/
1000000
;
LOG
(
"setMillisec = %u"
,
setMillisec
);
Msleep
(
setMillisec
+
11
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
)
<<
"mReceivedSignal != SIGALRM"
;
mReceivedSignal
=
0
;
...
...
@@ -272,7 +272,7 @@ HWTEST_F(AlarmTest, testTimerCreateEventDefault, Function | MediumTest | Level3)
setMillisec
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_nsec
/
1000000
;
LOG
(
"setMillisec = %u"
,
setMillisec
);
Msleep
(
setMillisec
+
11
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
)
<<
"mReceivedSignal != SIGALRM"
;
EXPECT_EQ
(
timer_delete
(
tid
),
0
)
<<
"ERROR: timer_delete() != 0"
;
...
...
@@ -357,7 +357,7 @@ HWTEST_F(AlarmTest, testTimerCreateFork, Function | MediumTest | Level2)
exit
(
1
);
}
}
else
{
// parent
Msleep
(
setMillisec
+
10
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
);
WaitProcExitedOK
(
pid
);
}
...
...
@@ -492,7 +492,7 @@ HWTEST_F(AlarmTest, testSetItTimerOneshot, Function | MediumTest | Level3)
EXPECT_EQ
(
setitimer
(
ITIMER_REAL
,
&
setItv
,
NULL
),
0
)
<<
"ERROR: setitimer() != 0"
;
setMillisec
=
setItv
.
it_value
.
tv_sec
*
1000
+
setItv
.
it_value
.
tv_usec
/
1000
;
Msleep
(
setMillisec
+
11
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
LOG
(
"mReceivedSignal = %d, SIGALRM = %d"
,
mReceivedSignal
,
SIGALRM
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
)
<<
"ERROR: mReceivedSignal != SIGALRM"
;
...
...
@@ -504,7 +504,7 @@ HWTEST_F(AlarmTest, testSetItTimerOneshot, Function | MediumTest | Level3)
setItv
.
it_interval
.
tv_usec
=
0
;
EXPECT_EQ
(
setitimer
(
ITIMER_REAL
,
&
setItv
,
NULL
),
0
)
<<
"ERROR: setitimer() != 0"
;
setMillisec
=
setItv
.
it_value
.
tv_sec
*
1000
+
setItv
.
it_value
.
tv_usec
/
1000
;
Msleep
(
setMillisec
+
1
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
LOG
(
"mReceivedSignal = %d, SIGALRM = %d"
,
mReceivedSignal
,
SIGALRM
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
)
<<
"ERROR: mReceivedSignal != SIGALRM"
;
}
...
...
@@ -529,7 +529,7 @@ HWTEST_F(AlarmTest, testSetItTimerRepeate, Function | MediumTest | Level3)
uint32_t
setMillisec
=
setItv
.
it_value
.
tv_sec
*
1000
+
setItv
.
it_value
.
tv_usec
/
1000
;
while
(
true
)
{
count
++
;
Msleep
(
setMillisec
+
1
);
Msleep
(
setMillisec
+
ACCURACY_ERROR
);
if
(
mReceivedSignal
==
SIGALRM
)
{
count
++
;
if
(
count
>
3
)
{
...
...
@@ -586,7 +586,7 @@ HWTEST_F(AlarmTest, testSetItTimerOldvalue, Function | MediumTest | Level3)
setItv
.
it_interval
.
tv_usec
=
100000
;
EXPECT_EQ
(
setitimer
(
ITIMER_REAL
,
&
setItv
,
NULL
),
0
)
<<
"ERROR: setitimer() != 0"
;
setMillisec
=
setItv
.
it_value
.
tv_sec
*
1000
+
setItv
.
it_value
.
tv_usec
/
1000
;
usleep
((
setMillisec
+
11
)
*
1000
);
usleep
((
setMillisec
+
ACCURACY_ERROR
)
*
1000
);
LOG
(
"mReceivedSignal = %d, SIGALRM = %d"
,
mReceivedSignal
,
SIGALRM
);
EXPECT_EQ
(
mReceivedSignal
,
SIGALRM
)
<<
"ERROR: mReceivedSignal != SIGALRM"
;
...
...
kernel_lite/time_posix/src/AlarmTest.h
浏览文件 @
92ee0d32
...
...
@@ -19,6 +19,8 @@
#include <signal.h>
#include <gtest/gtest.h>
const
int
ACCURACY_ERROR
=
8
;
const
int
MSLEEP_TIME
=
1200
;
class
AlarmTest
:
public
testing
::
Test
{
public:
void
SetUp
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录