Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
ccdfa724
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
1 年多 前同步成功
通知
460
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看板
未验证
提交
ccdfa724
编写于
10月 12, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1016 修复执行测试用例执行时间过长等问题
Merge pull request !1016 from 夏不白/fix_unittest
上级
557a71c1
8c0b7d0f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
5 deletion
+17
-5
testsuites/unittest/basic/exc/smoke/it_test_exc_001.cpp
testsuites/unittest/basic/exc/smoke/it_test_exc_001.cpp
+3
-0
testsuites/unittest/basic/exc/smoke/it_test_exc_004.cpp
testsuites/unittest/basic/exc/smoke/it_test_exc_004.cpp
+3
-0
testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp
testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp
+11
-5
未找到文件。
testsuites/unittest/basic/exc/smoke/it_test_exc_001.cpp
浏览文件 @
ccdfa724
...
...
@@ -34,9 +34,11 @@ static int TestCase(void)
{
int
ret
;
int
status
=
0
;
int
*
test
=
NULL
;
// for trggering an exception
pid_t
pid
=
fork
();
ICUNIT_ASSERT_WITHIN_EQUAL
(
pid
,
0
,
INVALID_PROCESS_ID
,
pid
);
if
(
pid
==
0
)
{
*
test
=
0x1
;
// Deliberately trigger an exceptioin
exit
(
0
);
}
...
...
@@ -52,6 +54,7 @@ static int TestCase(void)
pid
=
fork
();
ICUNIT_ASSERT_WITHIN_EQUAL
(
pid
,
0
,
INVALID_PROCESS_ID
,
pid
);
if
(
pid
==
0
)
{
*
test
=
0x1
;
// Deliberately trigger an exceptioin
exit
(
0
);
}
...
...
testsuites/unittest/basic/exc/smoke/it_test_exc_004.cpp
浏览文件 @
ccdfa724
...
...
@@ -36,13 +36,16 @@
static
int
TestThread
(
void
)
{
int
ret
;
int
*
test
=
nullptr
;
// For triggering an exceptioin
pid_t
pid
=
fork
();
ICUNIT_ASSERT_WITHIN_EQUAL
(
pid
,
0
,
INVALID_PROCESS_ID
,
pid
);
if
(
pid
==
0
)
{
*
test
=
0x1
;
// Deliberately trigger an exceptioin
while
(
1
)
{
}
}
*
test
=
0x1
;
// Deliberately trigger an exceptioin
ret
=
waitpid
(
pid
,
NULL
,
0
);
ICUNIT_ASSERT_EQUAL
(
ret
,
pid
,
ret
);
...
...
testsuites/unittest/basic/mem/shm/full/shm_test_002.cpp
浏览文件 @
ccdfa724
...
...
@@ -37,6 +37,12 @@ static int Testcase(VOID)
int
shmid
[
SHMID_MAX
+
1
]
=
{
-
1
};
int
ret
;
int
i
;
struct
shm_info
shmInfo
;
int
leftShmIds
;
ret
=
shmctl
(
0
,
SHM_INFO
,
reinterpret_cast
<
struct
shmid_ds
*>
(
&
shmInfo
));
ICUNIT_ASSERT_EQUAL
(
ret
,
SHMID_MAX
,
ret
);
leftShmIds
=
SHMID_MAX
-
shmInfo
.
used_ids
;
shmid
[
0
]
=
shmget
((
key_t
)
0x1234
,
PAGE_SIZE
,
0777
|
IPC_CREAT
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
[
0
],
-
1
,
shmid
[
0
]);
...
...
@@ -50,20 +56,20 @@ static int Testcase(VOID)
ret
=
shmctl
(
shmid
[
0
],
IPC_RMID
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
for
(
i
=
0
;
i
<
SHMID_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
leftShmIds
;
i
++
)
{
shmid
[
i
]
=
shmget
(
IPC_PRIVATE
,
PAGE_SIZE
,
0777
|
IPC_CREAT
);
ICUNIT_ASSERT_NOT_EQUAL
(
shmid
[
i
],
-
1
,
shmid
[
i
]);
}
shmid
[
SHMID_MAX
]
=
shmget
(
IPC_PRIVATE
,
PAGE_SIZE
,
0777
|
IPC_CREAT
);
ICUNIT_ASSERT_EQUAL
(
shmid
[
SHMID_MAX
],
-
1
,
shmid
[
SHMID_MAX
]);
shmid
[
leftShmIds
]
=
shmget
(
IPC_PRIVATE
,
PAGE_SIZE
,
0777
|
IPC_CREAT
);
ICUNIT_ASSERT_EQUAL
(
shmid
[
leftShmIds
],
-
1
,
shmid
[
leftShmIds
]);
for
(
i
=
0
;
i
<
SHMID_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
leftShmIds
;
i
++
)
{
ret
=
shmctl
(
shmid
[
i
],
IPC_RMID
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
0
,
ret
);
}
for
(
i
=
0
;
i
<
SHMID_MAX
;
i
++
)
{
for
(
i
=
0
;
i
<
leftShmIds
;
i
++
)
{
ret
=
shmctl
(
shmid
[
i
],
IPC_RMID
,
NULL
);
ICUNIT_ASSERT_EQUAL
(
ret
,
-
1
,
ret
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录