Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5bf5eeeb
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看板
提交
5bf5eeeb
编写于
4月 10, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 10, 2021
浏览文件
操作
浏览文件
下载
差异文件
!121 Resolve failed test cases:ActsIpcPipeTest:PipeTest.cpp
Merge pull request !121 from jiyong/master
上级
f1f94aad
ea9a3905
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
10 deletion
+12
-10
kernel_lite/ipc_posix/pipe_fifo/PipeTest.cpp
kernel_lite/ipc_posix/pipe_fifo/PipeTest.cpp
+12
-10
未找到文件。
kernel_lite/ipc_posix/pipe_fifo/PipeTest.cpp
浏览文件 @
5bf5eeeb
...
@@ -68,7 +68,7 @@ HWTEST_F(PipeTest, testHelloWorld, Function | MediumTest | Level0)
...
@@ -68,7 +68,7 @@ HWTEST_F(PipeTest, testHelloWorld, Function | MediumTest | Level0)
close
(
fd
[
1
]);
close
(
fd
[
1
]);
Msleep
(
100
);
Msleep
(
100
);
Asser
tProcExitedOK
(
pid
);
Wai
tProcExitedOK
(
pid
);
}
}
/**
/**
...
@@ -81,7 +81,7 @@ HWTEST_F(PipeTest, tesPipeNonblack, Function | MediumTest | Level1)
...
@@ -81,7 +81,7 @@ HWTEST_F(PipeTest, tesPipeNonblack, Function | MediumTest | Level1)
int
fd
[
2
];
int
fd
[
2
];
int
ret
=
pipe
(
fd
);
int
ret
=
pipe
(
fd
);
ASSERT_EQ
(
ret
,
0
)
<<
"> parent: pipe error ret = %d"
<<
ret
;
ASSERT_EQ
(
ret
,
0
)
<<
"> parent: pipe error ret = %d"
<<
ret
;
printf
(
"fd %d, %d
\n
"
,
fd
[
0
],
fd
[
1
]);
pid_t
pid
=
fork
();
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: fork errno = "
<<
errno
;
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: fork errno = "
<<
errno
;
if
(
pid
==
0
)
{
// child --- O_NONBLOCK R test, should be failed
if
(
pid
==
0
)
{
// child --- O_NONBLOCK R test, should be failed
...
@@ -98,17 +98,17 @@ HWTEST_F(PipeTest, tesPipeNonblack, Function | MediumTest | Level1)
...
@@ -98,17 +98,17 @@ HWTEST_F(PipeTest, tesPipeNonblack, Function | MediumTest | Level1)
}
}
Msleep
(
100
);
Msleep
(
100
);
close
(
fd
[
0
]);
close
(
fd
[
0
]);
printf
(
"1234
\n
"
);
exit
(
0
);
exit
(
0
);
}
}
// parent --- use O_NONBLOCK W test
// parent --- use O_NONBLOCK W test
close
(
fd
[
0
]);
close
(
fd
[
0
]);
Msleep
(
50
);
Msleep
(
50
);
ret
=
write
(
fd
[
1
],
"O_NONBLOCK R test"
,
sizeof
(
"O_NONBLOCK R test"
));
ASSERT_NE
(
ret
,
-
1
)
<<
"> parent : O_NONBLOCK write error"
;
close
(
fd
[
1
]);
close
(
fd
[
1
]);
Msleep
(
150
);
Msleep
(
150
);
AssertProcExitedOK
(
pid
);
WaitProcExitedOK
(
pid
);
printf
(
"5678
\n
"
);
}
}
/**
/**
...
@@ -123,9 +123,10 @@ HWTEST_F(PipeTest, testPipeBuf, Function | MediumTest | Level3)
...
@@ -123,9 +123,10 @@ HWTEST_F(PipeTest, testPipeBuf, Function | MediumTest | Level3)
int
tmpInt
;
int
tmpInt
;
char
testBuffer
[
arrSize
];
char
testBuffer
[
arrSize
];
memset_s
(
testBuffer
,
sizeof
(
testBuffer
),
'1'
,
sizeof
(
testBuffer
));
memset_s
(
testBuffer
,
sizeof
(
testBuffer
),
'1'
,
sizeof
(
testBuffer
));
printf
(
"abcd
\n
"
);
tmpInt
=
pipe
(
fd
);
tmpInt
=
pipe
(
fd
);
ASSERT_EQ
(
tmpInt
,
0
)
<<
"> parent: Create Pipe Error! "
;
ASSERT_EQ
(
tmpInt
,
0
)
<<
"> parent: Create Pipe Error! "
;
printf
(
"fd %d, %d
\n
"
,
fd
[
0
],
fd
[
1
]);
pid_t
pid
=
fork
();
pid_t
pid
=
fork
();
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: error : fork"
;
ASSERT_TRUE
(
pid
>=
0
)
<<
"> parent: error : fork"
;
...
@@ -159,13 +160,14 @@ HWTEST_F(PipeTest, testPipeBuf, Function | MediumTest | Level3)
...
@@ -159,13 +160,14 @@ HWTEST_F(PipeTest, testPipeBuf, Function | MediumTest | Level3)
Msleep
(
30
);
Msleep
(
30
);
EXPECT_NE
(
fcntl
(
fd
[
1
],
F_SETFL
,
O_NONBLOCK
),
-
1
)
<<
"> fcntl errno = "
<<
errno
;
EXPECT_NE
(
fcntl
(
fd
[
1
],
F_SETFL
,
O_NONBLOCK
),
-
1
)
<<
"> fcntl errno = "
<<
errno
;
printf
(
"efg
\n
"
);
tmpInt
=
write
(
fd
[
1
],
writeBuffer
,
arrSize
);
tmpInt
=
write
(
fd
[
1
],
writeBuffer
,
arrSize
);
LOG
(
"> parent: write num = %d"
,
tmpInt
);
LOG
(
"> parent: write num = %d"
,
tmpInt
);
EXPECT_NE
(
tmpInt
,
-
1
)
<<
"> parent: error : write num = "
<<
tmpInt
;
EXPECT_NE
(
tmpInt
,
-
1
)
<<
"> parent: error : write num = "
<<
tmpInt
;
close
(
fd
[
1
]);
close
(
fd
[
1
]);
Msleep
(
100
);
Msleep
(
100
);
Asser
tProcExitedOK
(
pid
);
Wai
tProcExitedOK
(
pid
);
}
}
/**
/**
...
@@ -218,7 +220,7 @@ HWTEST_F(PipeTest, testPipeBlock, Function | MediumTest | Level2)
...
@@ -218,7 +220,7 @@ HWTEST_F(PipeTest, testPipeBlock, Function | MediumTest | Level2)
close
(
fd
[
1
]);
close
(
fd
[
1
]);
Msleep
(
100
);
Msleep
(
100
);
Asser
tProcExitedOK
(
pid
);
Wai
tProcExitedOK
(
pid
);
}
}
/**
/**
...
@@ -267,6 +269,6 @@ HWTEST_F(PipeTest, testBrotherHelloWorld, Function | MediumTest | Level1)
...
@@ -267,6 +269,6 @@ HWTEST_F(PipeTest, testBrotherHelloWorld, Function | MediumTest | Level1)
close
(
fd
[
1
]);
close
(
fd
[
1
]);
Msleep
(
100
);
Msleep
(
100
);
Asser
tProcExitedOK
(
pidChild1
);
Wai
tProcExitedOK
(
pidChild1
);
Asser
tProcExitedOK
(
pidChild2
);
Wai
tProcExitedOK
(
pidChild2
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录