Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
aa45db22
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看板
提交
aa45db22
编写于
4月 29, 2021
作者:
N
nanxiansen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix failed testcase
Change-Id: I7dbdb8d0c1d3f819888d0d6dabe3b08b45f4e809
上级
21f2c4f9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
11 deletion
+21
-11
kernel_lite/io_posix/src/IoTestWchar.cpp
kernel_lite/io_posix/src/IoTestWchar.cpp
+2
-2
kernel_lite/process_posix/src/PidTest.cpp
kernel_lite/process_posix/src/PidTest.cpp
+19
-9
未找到文件。
kernel_lite/io_posix/src/IoTestWchar.cpp
浏览文件 @
aa45db22
...
@@ -246,11 +246,11 @@ HWTEST_F(IoTest, testWmemset, Function | MediumTest | Level1)
...
@@ -246,11 +246,11 @@ HWTEST_F(IoTest, testWmemset, Function | MediumTest | Level1)
HWTEST_F
(
IoTest
,
testWmemchr
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
IoTest
,
testWmemchr
,
Function
|
MediumTest
|
Level1
)
{
{
wchar_t
src
[]
=
L"hello world"
;
wchar_t
src
[]
=
L"hello world"
;
wchar_t
*
ret
=
wmemchr
(
src
,
L' '
,
sizeof
(
src
));
wchar_t
*
ret
=
wmemchr
(
src
,
L' '
,
sizeof
(
src
)
/
sizeof
(
src
[
0
])
-
1
);
EXPECT_STREQ
(
ret
,
L" world"
);
EXPECT_STREQ
(
ret
,
L" world"
);
wchar_t
srcT
[]
=
L"this is string"
;
wchar_t
srcT
[]
=
L"this is string"
;
ret
=
wmemchr
(
srcT
,
L'?'
,
sizeof
(
srcT
));
ret
=
wmemchr
(
srcT
,
L'?'
,
sizeof
(
srcT
)
/
sizeof
(
srcT
[
0
])
-
1
);
EXPECT_STREQ
(
ret
,
nullptr
);
EXPECT_STREQ
(
ret
,
nullptr
);
}
}
...
...
kernel_lite/process_posix/src/PidTest.cpp
浏览文件 @
aa45db22
...
@@ -67,8 +67,9 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
...
@@ -67,8 +67,9 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
ASSERT_NE
(
shmID
,
-
1
)
<<
"get share mem fail, errno = "
<<
errno
;
ASSERT_NE
(
shmID
,
-
1
)
<<
"get share mem fail, errno = "
<<
errno
;
int
*
shared
=
(
int
*
)(
shmat
(
shmID
,
nullptr
,
0
));
int
*
shared
=
(
int
*
)(
shmat
(
shmID
,
nullptr
,
0
));
ASSERT_NE
(
shared
,
reinterpret_cast
<
int
*>
(
-
1
))
<<
"shmat fail, errno = "
<<
errno
;
ASSERT_NE
(
shared
,
reinterpret_cast
<
int
*>
(
-
1
))
<<
"shmat fail, errno = "
<<
errno
;
*
shared
=
retPass
;
shared
[
0
]
=
retPass
;
shared
[
1
]
=
0
;
LOG
(
"parent process id:%d"
,
getpid
());
LOG
(
"parent process id:%d"
,
getpid
());
pid_t
pid
=
fork
();
pid_t
pid
=
fork
();
EXPECT_TRUE
(
pid
>=
0
)
<<
"======== Fork Error! ========="
;
EXPECT_TRUE
(
pid
>=
0
)
<<
"======== Fork Error! ========="
;
...
@@ -77,22 +78,26 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
...
@@ -77,22 +78,26 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
pid_t
pid2
=
fork
();
pid_t
pid2
=
fork
();
if
(
pid2
<
0
)
{
if
(
pid2
<
0
)
{
LOG
(
"======== Fork Error! ========="
);
LOG
(
"======== Fork Error! ========="
);
*
shared
=
1
;
exit
(
1
);
exit
(
1
);
}
}
if
(
pid2
==
0
)
{
// child
if
(
pid2
==
0
)
{
// child
LOG
(
"orphane process id:%d"
,
getpid
());
LOG
(
"orphane process id:%d"
,
getpid
());
Msleep
(
100
);
int
*
shmAddr
=
(
int
*
)(
shmat
(
shmID
,
nullptr
,
0
));
LOG
(
"before while child child %d"
,
shmAddr
[
1
]);
while
(
shmAddr
[
1
]
!=
1
)
{
Msleep
(
50
);
}
LOG
(
"after while child child %d"
,
shmAddr
[
1
]);
pid_t
pPid
=
getppid
();
pid_t
pPid
=
getppid
();
if
(
pPid
!=
1
)
{
if
(
pPid
!=
1
)
{
LOG
(
"getppid orphaned process fail, expect:1, but get:%d"
,
pPid
);
LOG
(
"getppid orphaned process fail, expect:1, but get:%d"
,
pPid
);
// transfer result to main process
// transfer result to main process
int
*
shmAddr
=
(
int
*
)(
shmat
(
shmID
,
nullptr
,
0
));
shmAddr
[
0
]
==
retFail
;
*
shmAddr
=
retFail
;
shmdt
(
shmAddr
);
exit
(
0
);
}
}
shmAddr
[
1
]
=
2
;
LOG
(
"child child exit %d"
,
shmAddr
[
1
]);
shmdt
(
shmAddr
);
exit
(
0
);
exit
(
0
);
}
else
{
// sub parent
}
else
{
// sub parent
exit
(
0
);
exit
(
0
);
...
@@ -100,8 +105,13 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
...
@@ -100,8 +105,13 @@ HWTEST_F(PidTest, testOrphanProcess, Function | MediumTest | Level1)
}
}
// parent
// parent
WaitProcExitedOK
(
pid
);
WaitProcExitedOK
(
pid
);
shared
[
1
]
=
1
;
Msleep
(
200
);
Msleep
(
200
);
EXPECT_EQ
(
*
shared
,
retPass
);
EXPECT_EQ
(
shared
[
0
],
retPass
);
LOG
(
"before while paret %d"
,
shared
[
1
]);
while
(
shared
[
1
]
!=
2
)
{
Msleep
(
50
);
}
shmdt
(
shared
);
shmdt
(
shared
);
shmctl
(
shmID
,
IPC_RMID
,
nullptr
);
shmctl
(
shmID
,
IPC_RMID
,
nullptr
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录