Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
719f9941
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看板
未验证
提交
719f9941
编写于
3月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7796 feat:修复使用不规范的测试用例
Merge pull request !7796 from zhangdengyu/muslUpdate0303
上级
8e61dd7b
5ae18cf3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
20 deletion
+20
-20
kernel_lite/ipc_posix/message_queue/IpcMqExceptionTest.cpp
kernel_lite/ipc_posix/message_queue/IpcMqExceptionTest.cpp
+9
-9
kernel_lite/net_posix/src/ActsNetTest.cpp
kernel_lite/net_posix/src/ActsNetTest.cpp
+11
-11
未找到文件。
kernel_lite/ipc_posix/message_queue/IpcMqExceptionTest.cpp
浏览文件 @
719f9941
...
...
@@ -237,7 +237,7 @@ HWTEST_F(IpcMqTest, testMqOpenENOSPC, Function | MediumTest | Level3)
*/
HWTEST_F
(
IpcMqTest
,
testMqCloseEBADF
,
Function
|
MediumTest
|
Level2
)
{
ASSERT_TRUE
(
mq_close
(
NULL
)
==
-
1
)
<<
"ERROR: mq_close() != -1"
;
ASSERT_TRUE
(
mq_close
(
0
)
==
-
1
)
<<
"ERROR: mq_close() != -1"
;
ASSERT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
}
...
...
@@ -283,7 +283,7 @@ HWTEST_F(IpcMqTest, testMqSendEBADFEMSGSIZE, Function | MediumTest | Level2)
queue
=
mq_open
(
qName
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ASSERT_TRUE
(
queue
!=
(
mqd_t
)
-
1
)
<<
"ERROR: mq_open() == (mqd_t)-1"
;
EXPECT_TRUE
(
mq_send
(
NULL
,
MQ_MSG
,
1
,
MQ_MSG_PRIO
)
==
-
1
)
<<
"ERROR: mq_send() != -1"
;
EXPECT_TRUE
(
mq_send
(
0
,
MQ_MSG
,
1
,
MQ_MSG_PRIO
)
==
-
1
)
<<
"ERROR: mq_send() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_send
(
queue
,
MQ_MSG
,
MQ_MSG_LEN
,
MQ_MSG_PRIO
)
==
-
1
)
<<
"ERROR: mq_send() != -1"
;
...
...
@@ -390,7 +390,7 @@ HWTEST_F(IpcMqTest, testMqReceiveEBADFEMSGSIZE, Function | MediumTest | Level2)
EXPECT_TRUE
(
strncmp
(
MQ_MSG
,
rMsg
,
MQ_MSG_LEN
)
==
0
)
<<
"ERROR: strncmp() != 0, sent != received: sent = "
<<
MQ_MSG
<<
", received = "
<<
rMsg
;
EXPECT_TRUE
(
mq_receive
(
NULL
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
)
==
-
1
)
<<
"ERROR: mq_receive() != -1"
;
EXPECT_TRUE
(
mq_receive
(
0
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
)
==
-
1
)
<<
"ERROR: mq_receive() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_send
(
queue
,
MQ_MSG
,
MQ_MSG_LEN
,
MQ_MSG_PRIO
)
==
0
)
<<
"ERROR: mq_send() != 0"
;
...
...
@@ -469,7 +469,7 @@ HWTEST_F(IpcMqTest, testMqTimedSendEAGAINEBADF, Function | MediumTest | Level2)
EXPECT_TRUE
(
mq_timedsend
(
queue
,
MQ_MSG
,
MQ_MSG_LEN
,
MQ_MSG_PRIO
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedsend() != 0"
;
EXPECT_TRUE
(
errno
==
EAGAIN
)
<<
"ERROR: errno != EAGAIN, errno = "
<<
errno
<<
" EAGAIN = "
<<
EAGAIN
;
EXPECT_TRUE
(
mq_timedsend
(
NULL
,
MQ_MSG
,
MQ_MSG_LEN
,
MQ_MSG_PRIO
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedsend() != -1"
;
EXPECT_TRUE
(
mq_timedsend
(
0
,
MQ_MSG
,
MQ_MSG_LEN
,
MQ_MSG_PRIO
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedsend() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_close
(
queue
)
==
0
)
<<
"ERROR: mq_close() != 0"
;
...
...
@@ -624,7 +624,7 @@ HWTEST_F(IpcMqTest, testMqTimedReceiveEAGAINEBADF, Function | MediumTest | Level
EXPECT_TRUE
(
mq_timedreceive
(
queue
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
errno
==
EAGAIN
)
<<
"ERROR: errno != EAGAIN, errno = "
<<
errno
<<
" EAGAIN = "
<<
EAGAIN
;
EXPECT_TRUE
(
mq_timedreceive
(
NULL
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
mq_timedreceive
(
0
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_close
(
queue
)
==
0
)
<<
"ERROR: mq_close() != 0"
;
...
...
@@ -635,12 +635,12 @@ HWTEST_F(IpcMqTest, testMqTimedReceiveEAGAINEBADF, Function | MediumTest | Level
queue
=
mq_open
(
qName
,
O_CREAT
|
O_WRONLY
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
&
attr
);
ASSERT_TRUE
(
queue
!=
(
mqd_t
)
-
1
)
<<
"ERROR: mq_open() == (mqd_t)-1"
;
EXPECT_TRUE
(
mq_timedreceive
(
NULL
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
mq_timedreceive
(
0
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
attr
.
mq_flags
|=
O_NONBLOCK
;
EXPECT_TRUE
(
mq_setattr
(
queue
,
&
attr
,
NULL
)
==
0
)
<<
"ERROR: mq_setattr() != 0"
;
EXPECT_TRUE
(
mq_timedreceive
(
NULL
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
mq_timedreceive
(
0
,
rMsg
,
getAttr
.
mq_msgsize
,
&
prio
,
&
ts
)
==
-
1
)
<<
"ERROR: mq_timedreceive() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_close
(
queue
)
==
0
)
<<
"ERROR: mq_close() != 0"
;
...
...
@@ -819,7 +819,7 @@ HWTEST_F(IpcMqTest, testMqGetAttrEBADFEINVAL, Function | MediumTest | Level2)
sprintf
(
qName
,
"testMqSendEINVAL_%d"
,
GetRandom
(
10000
));
queue
=
mq_open
(
qName
,
O_CREAT
|
O_RDWR
|
O_NONBLOCK
,
S_IRUSR
|
S_IWUSR
,
NULL
);
ret
=
mq_getattr
(
NULL
,
&
mqstat
);
ret
=
mq_getattr
(
0
,
&
mqstat
);
EXPECT_TRUE
(
ret
==
-
1
)
<<
"ERROR: mq_getattr() != -1, ret = "
<<
ret
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
...
...
@@ -859,7 +859,7 @@ HWTEST_F(IpcMqTest, testMqSetAttrEBADFEINVAL, Function | MediumTest | Level2)
EXPECT_TRUE
(
gMqstat
.
mq_flags
!=
sMqstat
.
mq_flags
)
<<
"ERROR: gMqstat != sMqstat, gMqstat.mq_flags = "
<<
gMqstat
.
mq_flags
<<
"sMqstat.mq_flags = "
<<
sMqstat
.
mq_flags
;
EXPECT_TRUE
(
mq_setattr
(
NULL
,
&
sMqstat
,
NULL
)
==
-
1
)
<<
"ERROR: mq_setattr() != -1"
;
EXPECT_TRUE
(
mq_setattr
(
0
,
&
sMqstat
,
NULL
)
==
-
1
)
<<
"ERROR: mq_setattr() != -1"
;
EXPECT_TRUE
(
errno
==
EBADF
)
<<
"ERROR: errno != EBADF, errno = "
<<
errno
<<
" EBADF = "
<<
EBADF
;
EXPECT_TRUE
(
mq_setattr
(
queue
,
NULL
,
NULL
)
==
-
1
)
<<
"ERROR: mq_setattr() != -1"
;
...
...
kernel_lite/net_posix/src/ActsNetTest.cpp
浏览文件 @
719f9941
...
...
@@ -3,9 +3,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
...
@@ -116,7 +116,7 @@ static void* CommTcpClientTask(void *param)
*
ret
=
0
;
int
clnFd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
clnFd
==
-
1
)
{
printf
(
"[@@@][comm client]socket fail
\n
"
);
printf
(
"[@@@][comm client]socket fail
\n
"
);
*
ret
=
-
1
;
return
ret
;
}
...
...
@@ -930,7 +930,7 @@ HWTEST_F(ActsNetTest, testSelectMultiClients, Function | MediumTest | Level2)
sleep
(
2
);
int
ret
;
pthread_t
pCli
[
4
];
int
pEroId
[
4
]
=
{
0
};
int
pEroId
[
4
]
=
{
0
};
int
interval
[
4
]
=
{
2
,
1
,
3
,
1
};
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
ret
=
pthread_create
(
&
pCli
[
i
],
nullptr
,
CommTcpClientTask
,
&
interval
[
i
]);
...
...
@@ -1044,7 +1044,7 @@ HWTEST_F(ActsNetTest, testPollMultiClients, Function | MediumTest | Level2)
sleep
(
2
);
int
ret
;
pthread_t
pCli
[
6
];
int
pEroId
[
6
]
=
{
0
};
int
pEroId
[
6
]
=
{
0
};
int
interval
[
6
]
=
{
2
,
1
,
3
,
1
,
2
,
1
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
...
...
@@ -1648,9 +1648,9 @@ HWTEST_F(ActsNetTest, testHerror, Function | MediumTest | Level2)
fclose
(
stderr
);
char
buffer
[
256
];
const
char
*
expectStr
=
"herror msg: Unknown error
herror msg: Host not found
herror msg: \
Try again
herror msg: Non-recoverable errorherror msg: Address not available
herror msg: \
Address not available
herror msg: Unknown errorherror msg: Unknown errorherror msg: Unknown error
"
;
const
char
*
expectStr
=
"herror msg: Unknown error
\n
herror msg: Host not found
\n
herror msg: \
Try again
\n
herror msg: Non-recoverable error
\n
herror msg: Address not available
\n
herror msg: \
Address not available
\n
herror msg: Unknown error
\n
herror msg: Unknown error
\n
herror msg: Unknown error
\n
"
;
FILE
*
fpRead
=
fopen
(
fileName
,
"rb"
);
size_t
bytes
=
fread
(
buffer
,
1
,
sizeof
(
buffer
),
fpRead
);
buffer
[
bytes
]
=
0
;
...
...
@@ -1809,7 +1809,7 @@ HWTEST_F(ActsNetTest, testInetPtonIpv6Normal, Function | MediumTest | Level2)
{
int
ret
;
struct
in6_addr
rst
=
{
0
};
char
cpAddrs
[
6
][
40
]
=
{
"0101:0101:0101:0101:1010:1010:1010:1010"
,
"0:0:0:0:0:0:0:0"
,
char
cpAddrs
[
6
][
40
]
=
{
"0101:0101:0101:0101:1010:1010:1010:1010"
,
"0:0:0:0:0:0:0:0"
,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"
,
"::"
,
"1::"
,
"0011:0011:0011:0011:11:11:11:11"
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
ret
=
inet_pton
(
AF_INET6
,
cpAddrs
[
i
],
&
rst
);
...
...
@@ -1913,9 +1913,9 @@ HWTEST_F(ActsNetTest, testInetNtopIpv6Normal, Function | MediumTest | Level2)
const
char
*
ret
=
nullptr
;
struct
in6_addr
inputAddr
=
{
0
};
char
rstBuff
[
INET6_ADDRSTRLEN
];
char
inputAddrs
[
6
][
40
]
=
{
"0101:0101:0101:0101:1010:1010:1010:1010"
,
"0:0:0:0:0:0:0:0"
,
char
inputAddrs
[
6
][
40
]
=
{
"0101:0101:0101:0101:1010:1010:1010:1010"
,
"0:0:0:0:0:0:0:0"
,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"
,
"::"
,
"1::"
,
"0011:0011:0011:0011:11:11:11:11"
};
char
expectAddrs
[
6
][
40
]
=
{
"101:101:101:101:1010:1010:1010:1010"
,
"::"
,
char
expectAddrs
[
6
][
40
]
=
{
"101:101:101:101:1010:1010:1010:1010"
,
"::"
,
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
,
"::"
,
"1::"
,
"11:11:11:11:11:11:11:11"
};
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
iret
=
inet_pton
(
AF_INET6
,
inputAddrs
[
i
],
&
inputAddr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录