Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a8edc778
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看板
未验证
提交
a8edc778
编写于
3月 23, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2764 修改检视问题
Merge pull request !2764 from zhangpan2021/master
上级
0d775add
7a3b948b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
75 addition
and
96 deletion
+75
-96
communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
...tbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
+34
-55
communication_lite/lwip_hal/src/lwip_func_test.c
communication_lite/lwip_hal/src/lwip_func_test.c
+15
-15
communication_lite/lwip_posix/src/ActsLwipTest.cpp
communication_lite/lwip_posix/src/ActsLwipTest.cpp
+19
-19
communication_lite/wifiservice_hal/src/wifiservice_func_test.c
...nication_lite/wifiservice_hal/src/wifiservice_func_test.c
+7
-7
未找到文件。
communication/dsoftbus/rpc/src/main/js/default/test/RpcClientJsunit.test.js
浏览文件 @
a8edc778
...
@@ -1763,7 +1763,7 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -1763,7 +1763,7 @@ describe('ActsRpcClientJsTest', function(){
var
Capacity
=
data
.
getRawDataCapacity
()
var
Capacity
=
data
.
getRawDataCapacity
()
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300:run Capacity success, result is
"
+
Capacity
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300:run Capacity success, result is
"
+
Capacity
);
var
token
=
new
Int8Array
([
2
,
1
,
4
,
3
,
129
])
;
var
token
=
new
Int8Array
([
2
,
1
,
4
,
3
,
129
])
;
var
result
=
data
.
writeRawData
(
token
,
token
.
length
);
var
result
=
data
.
writeRawData
(
token
,
149000000
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300:run writeRawData success, result is
"
+
result
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7300:run writeRawData success, result is
"
+
result
);
expect
(
result
==
false
).
assertTrue
();
expect
(
result
==
false
).
assertTrue
();
data
.
reclaim
();
data
.
reclaim
();
...
@@ -1792,7 +1792,7 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -1792,7 +1792,7 @@ describe('ActsRpcClientJsTest', function(){
var
result
=
data
.
writeRemoteObject
(
testRemoteObject
);
var
result
=
data
.
writeRemoteObject
(
testRemoteObject
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7400: result is
"
+
result
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7400: result is
"
+
result
);
expect
(
result
==
true
).
assertTrue
();
expect
(
result
==
true
).
assertTrue
();
data
.
readRemoteObject
()
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7400:error =
"
+
error
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_7400:error =
"
+
error
);
}
}
...
@@ -2590,42 +2590,38 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -2590,42 +2590,38 @@ describe('ActsRpcClientJsTest', function(){
* @tc.level 0
* @tc.level 0
*/
*/
it
(
'
SUB_Softbus_IPC_MessageParcel_9300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_Softbus_IPC_MessageParcel_9300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9300
"
)
console
.
log
(
"
---------------------start SUB_Softbus_IPC_MessageParcel_9300---------------------------
"
);
function
checkResult
(
num
,
str
)
{
function
checkResult
(
num
,
str
)
{
expect
(
num
).
assertEqual
(
123
)
expect
(
num
).
assertEqual
(
123
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
expect
(
str
).
assertEqual
(
"
rpcListenerTest
"
)
done
()
done
()
}
}
try
{
let
option
=
new
rpc
.
MessageOption
()
let
option
=
new
rpc
.
MessageOption
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
expect
(
data
.
writeInterfaceToken
(
"
rpcTestAbility
"
)).
assertTrue
()
let
listener
=
new
TestListener
(
"
rpcListener
"
,
checkResult
)
let
listener
=
new
TestListener
(
"
rpcListener
"
,
checkResult
)
let
result
=
data
.
writeRemoteObject
(
listener
)
let
result
=
data
.
writeRemoteObject
(
listener
)
expect
(
result
==
true
).
assertTrue
()
expect
(
result
==
true
).
assertTrue
()
let
readresult
=
data
.
readRemoteObject
()
expect
(
readresult
==
null
).
assertFalse
()
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9300 result is:
"
+
result
)
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9300 result is:
"
+
result
)
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECT
,
data
,
reply
,
option
)
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECT
,
data
,
reply
,
option
)
.
then
(
function
(
result
)
{
.
then
(
(
result
)
=>
{
console
.
info
(
"
sendRequest done, error code:
"
+
result
.
errCode
)
console
.
info
(
"
sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
result
.
reply
.
readException
()
result
.
reply
.
readException
()
})
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
send request got exception:
"
+
e
)
expect
(
0
).
assertEqual
(
1
)
})
.
finally
(()
=>
{
data
.
reclaim
()
data
.
reclaim
()
reply
.
reclaim
()
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
console
.
log
(
"
test done
"
)
})
}
catch
(
error
)
{
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_9300: error =
"
+
error
);
}
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9300---------------------------
"
);
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9300---------------------------
"
);
})
})
/*
/*
...
@@ -2652,35 +2648,27 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -2652,35 +2648,27 @@ describe('ActsRpcClientJsTest', function(){
let
option
=
new
rpc
.
MessageOption
()
let
option
=
new
rpc
.
MessageOption
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
expect
(
data
.
writeInterfaceToken
(
"
rpcTestAbility
"
)).
assertTrue
()
let
listeners
=
[
new
TestListener
(
"
rpcListener
"
,
checkResult
),
let
listeners
=
[
new
TestListener
(
"
rpcListener4
"
,
checkResult
),
new
TestListener
(
"
rpcListener2
"
,
checkResult
),
new
TestListener
(
"
rpcListener5
"
,
checkResult
),
new
TestListener
(
"
rpcListener3
"
,
checkResult
)]
new
TestListener
(
"
rpcListener6
"
,
checkResult
)]
let
result
=
data
.
writeRemoteObjectArray
(
listeners
)
let
result
=
data
.
writeRemoteObjectArray
(
listeners
)
expect
(
result
==
true
).
assertTrue
()
expect
(
result
==
true
).
assertTrue
()
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9400 result is:
"
+
result
)
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9400 result is:
"
+
result
)
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY_1
,
data
,
reply
,
option
)
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY_1
,
data
,
reply
,
option
)
.
then
(
(
result
)
=>
{
.
then
(
(
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500:
sendRequest done, error code:
"
+
result
.
errCode
)
console
.
info
(
"
sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
result
.
reply
.
readException
()
})
})
.
catch
(
function
(
e
)
{
console
.
error
(
"
SUB_Softbus_IPC_MessageParcel_9400: send request got exception:
"
+
e
)
expect
(
0
).
assertEqual
(
1
)
})
.
finally
(()
=>
{
data
.
reclaim
()
data
.
reclaim
()
reply
.
reclaim
()
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
console
.
log
(
"
test done
"
)
})
}
catch
(
error
)
{
done
();
data
.
reclaim
();
reply
.
reclaim
();
}
catch
(
error
){
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_9400: error =
"
+
error
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_9400: error =
"
+
error
);
}
}
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9400---------------------------
"
);
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9400---------------------------
"
);
})
})
...
@@ -2708,37 +2696,28 @@ describe('ActsRpcClientJsTest', function(){
...
@@ -2708,37 +2696,28 @@ describe('ActsRpcClientJsTest', function(){
let
option
=
new
rpc
.
MessageOption
()
let
option
=
new
rpc
.
MessageOption
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
data
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
let
reply
=
rpc
.
MessageParcel
.
create
()
expect
(
data
.
writeInterfaceToken
(
"
rpcTestAbility
"
)).
assertTrue
()
let
listeners
=
[
new
TestListener
(
"
rpcListener
"
,
checkResult
),
let
listeners
=
[
new
TestListener
(
"
rpcListener4
"
,
checkResult
),
new
TestListener
(
"
rpcListener2
"
,
checkResult
),
new
TestListener
(
"
rpcListener5
"
,
checkResult
),
new
TestListener
(
"
rpcListener3
"
,
checkResult
)]
new
TestListener
(
"
rpcListener6
"
,
checkResult
)]
let
result
=
data
.
writeRemoteObjectArray
(
listeners
)
let
result
=
data
.
writeRemoteObjectArray
(
listeners
)
expect
(
result
==
true
).
assertTrue
()
expect
(
result
==
true
).
assertTrue
()
let
readresult
=
data
.
readRemoteObjectArray
()
data
.
readRemoteObjectArray
()
expect
(
readresult
==
null
).
assertFalse
()
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500 result is:
"
+
result
)
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500 result is:
"
+
result
)
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeInt
(
123
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
expect
(
data
.
writeString
(
"
rpcListenerTest
"
)).
assertTrue
()
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY_2
,
data
,
reply
,
option
)
await
gIRemoteObject
.
sendRequest
(
CODE_WRITE_REMOTEOBJECTARRAY_2
,
data
,
reply
,
option
)
.
then
(
(
result
)
=>
{
.
then
((
result
)
=>
{
console
.
info
(
"
SUB_Softbus_IPC_MessageParcel_9500:sendRequest done, error code:
"
+
result
.
errCode
)
console
.
info
(
"
sendRequest done, error code:
"
+
result
.
errCode
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
expect
(
result
.
errCode
).
assertEqual
(
0
)
})
result
.
reply
.
readException
()
.
catch
(
function
(
e
)
{
})
console
.
error
(
"
SUB_Softbus_IPC_MessageParcel_9500: send request got exception:
"
+
e
)
expect
(
0
).
assertEqual
(
1
)
data
.
reclaim
()
})
reply
.
reclaim
()
.
finally
(()
=>
{
console
.
log
(
"
test done
"
)
data
.
reclaim
()
}
catch
(
error
)
{
reply
.
reclaim
()
console
.
log
(
"
test done
"
)
})
done
();
data
.
reclaim
();
reply
.
reclaim
();
}
catch
(
error
){
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_9500: error =
"
+
error
);
console
.
log
(
"
SUB_Softbus_IPC_MessageParcel_9500: error =
"
+
error
);
}
}
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9500---------------------------
"
);
console
.
log
(
"
---------------------end SUB_Softbus_IPC_MessageParcel_9500---------------------------
"
);
})
})
...
...
communication_lite/lwip_hal/src/lwip_func_test.c
浏览文件 @
a8edc778
...
@@ -135,7 +135,7 @@ static void CommTcpClientTask(void)
...
@@ -135,7 +135,7 @@ static void CommTcpClientTask(void)
"client:!!@@##$$%%^^&&**(()),FD:[%d]"
,
"client:(((112233445566778899))),FD:[%d]"
,
"bye"
};
"client:!!@@##$$%%^^&&**(()),FD:[%d]"
,
"client:(((112233445566778899))),FD:[%d]"
,
"bye"
};
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
sleep
(
ONE_SECOND
);
sleep
(
ONE_SECOND
);
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
rst
=
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
sendMsgList
[
i
],
clnFd
);
rst
=
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
sendMsgList
[
i
],
clnFd
);
if
(
rst
<
0
)
{
if
(
rst
<
0
)
{
printf
(
"[comm client]sprintf_s error!
\n
"
);
printf
(
"[comm client]sprintf_s error!
\n
"
);
...
@@ -146,7 +146,7 @@ static void CommTcpClientTask(void)
...
@@ -146,7 +146,7 @@ static void CommTcpClientTask(void)
if
(
rst
<=
0
)
{
if
(
rst
<=
0
)
{
printf
(
"[comm client][%d]send fail
\n
"
,
clnFd
);
printf
(
"[comm client][%d]send fail
\n
"
,
clnFd
);
}
}
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
rst
=
recv
(
clnFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
rst
=
recv
(
clnFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
if
(
rst
>
0
)
{
if
(
rst
>
0
)
{
printf
(
"[comm client][%d]recv msg[%s]
\n
"
,
clnFd
,
dataBuf
);
printf
(
"[comm client][%d]recv msg[%s]
\n
"
,
clnFd
,
dataBuf
);
...
@@ -185,14 +185,14 @@ static void SampleTcpServerTask(void)
...
@@ -185,14 +185,14 @@ static void SampleTcpServerTask(void)
TEST_ASSERT_NOT_EQUAL
(
LWIP_TEST_FAIL
,
clientFd
);
TEST_ASSERT_NOT_EQUAL
(
LWIP_TEST_FAIL
,
clientFd
);
int
srvMsgLen
=
strlen
(
SRV_MSG
);
int
srvMsgLen
=
strlen
(
SRV_MSG
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
SRV_MSG
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
SRV_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
ret
=
send
(
clientFd
,
buf
,
srvMsgLen
,
0
);
ret
=
send
(
clientFd
,
buf
,
srvMsgLen
,
0
);
printf
(
"[tcp server]send, ret=%d
\n
"
,
ret
);
printf
(
"[tcp server]send, ret=%d
\n
"
,
ret
);
TEST_ASSERT_EQUAL_INT
(
srvMsgLen
,
ret
);
TEST_ASSERT_EQUAL_INT
(
srvMsgLen
,
ret
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recv
(
clientFd
,
buf
,
sizeof
(
buf
),
0
);
ret
=
recv
(
clientFd
,
buf
,
sizeof
(
buf
),
0
);
printf
(
"[tcp server]recv, ret=%d
\n
"
,
ret
);
printf
(
"[tcp server]recv, ret=%d
\n
"
,
ret
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
CLI_MSG
),
ret
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
CLI_MSG
),
ret
);
...
@@ -202,7 +202,7 @@ static void SampleTcpServerTask(void)
...
@@ -202,7 +202,7 @@ static void SampleTcpServerTask(void)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
SRV_MSG
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
SRV_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -218,7 +218,7 @@ static void SampleTcpServerTask(void)
...
@@ -218,7 +218,7 @@ static void SampleTcpServerTask(void)
TEST_ASSERT_EQUAL_INT
(
len
*
srvMsgLen
,
ret
);
TEST_ASSERT_EQUAL_INT
(
len
*
srvMsgLen
,
ret
);
WaitServer
();
WaitServer
();
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
int
recvSum
=
0
;
int
recvSum
=
0
;
int
recvTimes
=
50
;
int
recvTimes
=
50
;
while
(
recvTimes
>
0
)
{
while
(
recvTimes
>
0
)
{
...
@@ -282,14 +282,14 @@ static void SampleTcpClientTask(void)
...
@@ -282,14 +282,14 @@ static void SampleTcpClientTask(void)
TEST_ASSERT_EQUAL_INT
(
inet_addr
(
STACK_IP
),
((
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
);
TEST_ASSERT_EQUAL_INT
(
inet_addr
(
STACK_IP
),
((
struct
sockaddr_in
*
)
&
addr
)
->
sin_addr
.
s_addr
);
int
cliMsgLen
=
strlen
(
CLI_MSG
);
int
cliMsgLen
=
strlen
(
CLI_MSG
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
CLI_MSG
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
CLI_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
ret
=
send
(
clientFd
,
buf
,
cliMsgLen
,
0
);
ret
=
send
(
clientFd
,
buf
,
cliMsgLen
,
0
);
printf
(
"[tcp client]send, ret=%d
\n
"
,
ret
);
printf
(
"[tcp client]send, ret=%d
\n
"
,
ret
);
TEST_ASSERT_EQUAL_INT
(
cliMsgLen
,
ret
);
TEST_ASSERT_EQUAL_INT
(
cliMsgLen
,
ret
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recv
(
clientFd
,
buf
,
sizeof
(
buf
),
0
);
ret
=
recv
(
clientFd
,
buf
,
sizeof
(
buf
),
0
);
printf
(
"[tcp client]recv,ret=%d
\n
"
,
ret
);
printf
(
"[tcp client]recv,ret=%d
\n
"
,
ret
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
SRV_MSG
),
ret
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
SRV_MSG
),
ret
);
...
@@ -299,7 +299,7 @@ static void SampleTcpClientTask(void)
...
@@ -299,7 +299,7 @@ static void SampleTcpClientTask(void)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
CLI_MSG
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
CLI_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -315,7 +315,7 @@ static void SampleTcpClientTask(void)
...
@@ -315,7 +315,7 @@ static void SampleTcpClientTask(void)
TEST_ASSERT_EQUAL_INT
(
len
*
cliMsgLen
,
ret
);
TEST_ASSERT_EQUAL_INT
(
len
*
cliMsgLen
,
ret
);
WaitClient
();
WaitClient
();
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
int
recvSum
=
0
;
int
recvSum
=
0
;
int
recvTimes
=
50
;
int
recvTimes
=
50
;
while
(
recvTimes
>
0
)
{
while
(
recvTimes
>
0
)
{
...
@@ -405,7 +405,7 @@ static void SelectServerTask(void)
...
@@ -405,7 +405,7 @@ static void SelectServerTask(void)
continue
;
continue
;
}
}
if
(
FD_ISSET
(
fds
[
i
],
&
readSet
))
{
if
(
FD_ISSET
(
fds
[
i
],
&
readSet
))
{
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
int
len
=
recv
(
fds
[
i
],
dataBuf
,
sizeof
(
dataBuf
),
0
);
int
len
=
recv
(
fds
[
i
],
dataBuf
,
sizeof
(
dataBuf
),
0
);
if
(
len
>
0
)
{
if
(
len
>
0
)
{
printf
(
"[select process][%d]recv msg[%s]
\n
"
,
fds
[
i
],
dataBuf
);
printf
(
"[select process][%d]recv msg[%s]
\n
"
,
fds
[
i
],
dataBuf
);
...
@@ -588,20 +588,20 @@ LITE_TEST_CASE(LwipFuncTestSuite, testUdp, Function | MediumTest | Level2)
...
@@ -588,20 +588,20 @@ LITE_TEST_CASE(LwipFuncTestSuite, testUdp, Function | MediumTest | Level2)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
UDP_MSG
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
UDP_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
ret
=
sendto
(
fd
,
g_buf
,
strlen
(
UDP_MSG
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
(
socklen_t
)
sizeof
(
clnAddr
));
ret
=
sendto
(
fd
,
g_buf
,
strlen
(
UDP_MSG
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
(
socklen_t
)
sizeof
(
clnAddr
));
TEST_ASSERT_NOT_EQUAL
(
LWIP_TEST_FAIL
,
ret
);
TEST_ASSERT_NOT_EQUAL
(
LWIP_TEST_FAIL
,
ret
);
(
v
io
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recvfrom
(
fd
,
g_buf
,
sizeof
(
g_buf
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
ret
=
recvfrom
(
fd
,
g_buf
,
sizeof
(
g_buf
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
UDP_MSG
),
ret
);
TEST_ASSERT_EQUAL_INT
(
strlen
(
UDP_MSG
),
ret
);
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
PEER_IP
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
g_buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
UDP_MSG
);
ret
=
strcpy_s
(
g_buf
,
BUF_SIZE
,
UDP_MSG
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
TEST_ASSERT_EQUAL_INT
(
LWIP_TEST_SUCCESS
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -720,7 +720,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSocketOpt, Function | MediumTest | Level2)
...
@@ -720,7 +720,7 @@ LITE_TEST_CASE(LwipFuncTestSuite, testSocketOpt, Function | MediumTest | Level2)
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
len
);
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
len
);
TEST_ASSERT_EQUAL_INT
(
0
,
ret
);
TEST_ASSERT_EQUAL_INT
(
0
,
ret
);
(
v
io
d
)
memset_s
(
&
timeout
,
len
,
0
,
len
);
(
v
oi
d
)
memset_s
(
&
timeout
,
len
,
0
,
len
);
ret
=
getsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
&
len
);
ret
=
getsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
&
len
);
TEST_ASSERT_EQUAL_INT
(
0
,
ret
);
TEST_ASSERT_EQUAL_INT
(
0
,
ret
);
TEST_ASSERT_EQUAL_INT
(
1000
,
timeout
.
tv_sec
);
TEST_ASSERT_EQUAL_INT
(
1000
,
timeout
.
tv_sec
);
...
...
communication_lite/lwip_posix/src/ActsLwipTest.cpp
浏览文件 @
a8edc778
...
@@ -120,7 +120,7 @@ static void* CommTcpClientTask(void* param)
...
@@ -120,7 +120,7 @@ static void* CommTcpClientTask(void* param)
"client:!!@@##$$%%^^&&**(()),FD:[%d]"
,
"client:(((112233445566778899))),FD:[%d]"
,
"bye"
};
"client:!!@@##$$%%^^&&**(()),FD:[%d]"
,
"client:(((112233445566778899))),FD:[%d]"
,
"bye"
};
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
sleep
(
sleepSecond
);
sleep
(
sleepSecond
);
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
rst
=
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
sendMsgList
[
i
],
clnFd
);
rst
=
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
sendMsgList
[
i
],
clnFd
);
if
(
rst
<
0
)
{
if
(
rst
<
0
)
{
printf
(
"[comm client]sprintf_s error!
\n
"
);
printf
(
"[comm client]sprintf_s error!
\n
"
);
...
@@ -131,7 +131,7 @@ static void* CommTcpClientTask(void* param)
...
@@ -131,7 +131,7 @@ static void* CommTcpClientTask(void* param)
*
ret
=
-
1
;
*
ret
=
-
1
;
printf
(
"[comm client][%d]send fail
\n
"
,
clnFd
);
printf
(
"[comm client][%d]send fail
\n
"
,
clnFd
);
}
}
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
rst
=
recv
(
clnFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
rst
=
recv
(
clnFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
if
(
rst
>
0
)
{
if
(
rst
>
0
)
{
printf
(
"[comm client][%d]recv msg[%s]
\n
"
,
clnFd
,
dataBuf
);
printf
(
"[comm client][%d]recv msg[%s]
\n
"
,
clnFd
,
dataBuf
);
...
@@ -182,14 +182,14 @@ static void* SampleTcpServerTask(void* p)
...
@@ -182,14 +182,14 @@ static void* SampleTcpServerTask(void* p)
static
char
buf
[
BUF_SIZE
+
1
]
=
{
0
};
static
char
buf
[
BUF_SIZE
+
1
]
=
{
0
};
unsigned
int
srvMsgLen
=
strlen
(
g_srvMsg
);
unsigned
int
srvMsgLen
=
strlen
(
g_srvMsg
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_srvMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_srvMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
ret
=
send
(
clnFd
,
buf
,
srvMsgLen
,
0
);
ret
=
send
(
clnFd
,
buf
,
srvMsgLen
,
0
);
printf
(
"[tcp server]send, ret=%d
\n
"
,
ret
);
printf
(
"[tcp server]send, ret=%d
\n
"
,
ret
);
EXPECT_EQ
(
srvMsgLen
,
(
unsigned
int
)
ret
);
EXPECT_EQ
(
srvMsgLen
,
(
unsigned
int
)
ret
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recv
(
clnFd
,
buf
,
sizeof
(
buf
),
0
);
ret
=
recv
(
clnFd
,
buf
,
sizeof
(
buf
),
0
);
printf
(
"[tcp server]recv, ret=%d, msg[%s]
\n
"
,
ret
,
buf
);
printf
(
"[tcp server]recv, ret=%d, msg[%s]
\n
"
,
ret
,
buf
);
EXPECT_EQ
(
strlen
(
g_cliMsg
),
(
unsigned
int
)
ret
);
EXPECT_EQ
(
strlen
(
g_cliMsg
),
(
unsigned
int
)
ret
);
...
@@ -201,7 +201,7 @@ static void* SampleTcpServerTask(void* p)
...
@@ -201,7 +201,7 @@ static void* SampleTcpServerTask(void* p)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_srvMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_srvMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -217,8 +217,8 @@ static void* SampleTcpServerTask(void* p)
...
@@ -217,8 +217,8 @@ static void* SampleTcpServerTask(void* p)
EXPECT_EQ
(
len
*
srvMsgLen
,
(
unsigned
int
)
ret
);
EXPECT_EQ
(
len
*
srvMsgLen
,
(
unsigned
int
)
ret
);
WAIT
();
WAIT
();
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
io
d
)
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
(
v
oi
d
)
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_namelen
=
sizeof
(
clnAddr
);
msg
.
msg_namelen
=
sizeof
(
clnAddr
);
msg
.
msg_iov
=
iov
;
msg
.
msg_iov
=
iov
;
...
@@ -270,14 +270,14 @@ static void* SampleTcpClientTask(void* p)
...
@@ -270,14 +270,14 @@ static void* SampleTcpClientTask(void* p)
static
char
buf
[
BUF_SIZE
+
1
]
=
{
0
};
static
char
buf
[
BUF_SIZE
+
1
]
=
{
0
};
unsigned
int
cliMsgLen
=
strlen
(
g_cliMsg
);
unsigned
int
cliMsgLen
=
strlen
(
g_cliMsg
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_cliMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_cliMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
ret
=
send
(
clnFd
,
buf
,
cliMsgLen
,
0
);
ret
=
send
(
clnFd
,
buf
,
cliMsgLen
,
0
);
printf
(
"[tcp client]send, ret=%d
\n
"
,
ret
);
printf
(
"[tcp client]send, ret=%d
\n
"
,
ret
);
EXPECT_EQ
(
cliMsgLen
,
(
unsigned
int
)
ret
);
EXPECT_EQ
(
cliMsgLen
,
(
unsigned
int
)
ret
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recv
(
clnFd
,
buf
,
sizeof
(
buf
),
0
);
ret
=
recv
(
clnFd
,
buf
,
sizeof
(
buf
),
0
);
printf
(
"[tcp client]recv, ret=%d, msg[%s]
\n
"
,
ret
,
buf
);
printf
(
"[tcp client]recv, ret=%d, msg[%s]
\n
"
,
ret
,
buf
);
EXPECT_EQ
(
strlen
(
g_srvMsg
),
(
unsigned
int
)
ret
);
EXPECT_EQ
(
strlen
(
g_srvMsg
),
(
unsigned
int
)
ret
);
...
@@ -290,7 +290,7 @@ static void* SampleTcpClientTask(void* p)
...
@@ -290,7 +290,7 @@ static void* SampleTcpClientTask(void* p)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_cliMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_cliMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -306,8 +306,8 @@ static void* SampleTcpClientTask(void* p)
...
@@ -306,8 +306,8 @@ static void* SampleTcpClientTask(void* p)
EXPECT_EQ
(
len
*
cliMsgLen
,
(
unsigned
int
)
ret
);
EXPECT_EQ
(
len
*
cliMsgLen
,
(
unsigned
int
)
ret
);
WAIT
();
WAIT
();
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
io
d
)
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
(
v
oi
d
)
memset_s
(
&
msg
,
sizeof
(
msg
),
0
,
sizeof
(
msg
));
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_namelen
=
sizeof
(
clnAddr
);
msg
.
msg_namelen
=
sizeof
(
clnAddr
);
msg
.
msg_iov
=
iov
;
msg
.
msg_iov
=
iov
;
...
@@ -344,7 +344,7 @@ static int TcpServerForFork()
...
@@ -344,7 +344,7 @@ static int TcpServerForFork()
goto
FINALLY
;
goto
FINALLY
;
}
}
while
(
timeout
>
0
)
{
while
(
timeout
>
0
)
{
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
ret
=
recv
(
cliFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
ret
=
recv
(
cliFd
,
dataBuf
,
sizeof
(
dataBuf
),
0
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
printf
(
"[server process]recv msg[%s]
\n
"
,
dataBuf
);
printf
(
"[server process]recv msg[%s]
\n
"
,
dataBuf
);
...
@@ -355,7 +355,7 @@ static int TcpServerForFork()
...
@@ -355,7 +355,7 @@ static int TcpServerForFork()
}
else
{
}
else
{
printf
(
"[server process]recv no data
\n
"
);
printf
(
"[server process]recv no data
\n
"
);
}
}
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
"server timeout:%d"
,
timeout
);
sprintf_s
(
dataBuf
,
sizeof
(
dataBuf
),
"server timeout:%d"
,
timeout
);
ret
=
send
(
cliFd
,
dataBuf
,
strlen
(
dataBuf
),
0
);
ret
=
send
(
cliFd
,
dataBuf
,
strlen
(
dataBuf
),
0
);
if
(
ret
>
0
)
{
if
(
ret
>
0
)
{
...
@@ -466,7 +466,7 @@ static int SelectServerForFork(unsigned int timeoutSec)
...
@@ -466,7 +466,7 @@ static int SelectServerForFork(unsigned int timeoutSec)
continue
;
continue
;
}
}
if
(
FD_ISSET
(
fds
[
i
],
&
readSet
))
{
if
(
FD_ISSET
(
fds
[
i
],
&
readSet
))
{
(
v
io
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
(
v
oi
d
)
memset_s
(
dataBuf
,
sizeof
(
dataBuf
),
0
,
sizeof
(
dataBuf
));
int
len
=
recv
(
fds
[
i
],
dataBuf
,
sizeof
(
dataBuf
),
0
);
int
len
=
recv
(
fds
[
i
],
dataBuf
,
sizeof
(
dataBuf
),
0
);
if
(
len
>
0
)
{
if
(
len
>
0
)
{
printf
(
"[select process][%d]recv msg[%s]
\n
"
,
fds
[
i
],
dataBuf
);
printf
(
"[select process][%d]recv msg[%s]
\n
"
,
fds
[
i
],
dataBuf
);
...
@@ -550,20 +550,20 @@ HWTEST_F(ActsLwipTest, testUdpSample, Function | MediumTest | Level2)
...
@@ -550,20 +550,20 @@ HWTEST_F(ActsLwipTest, testUdpSample, Function | MediumTest | Level2)
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_udpMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_udpMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
ret
=
sendto
(
sfd
,
buf
,
strlen
(
g_udpMsg
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
(
socklen_t
)
sizeof
(
clnAddr
));
ret
=
sendto
(
sfd
,
buf
,
strlen
(
g_udpMsg
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
(
socklen_t
)
sizeof
(
clnAddr
));
EXPECT_NE
(
-
1
,
ret
);
EXPECT_NE
(
-
1
,
ret
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
recvfrom
(
sfd
,
buf
,
sizeof
(
buf
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
ret
=
recvfrom
(
sfd
,
buf
,
sizeof
(
buf
),
0
,
(
struct
sockaddr
*
)
&
clnAddr
,
&
clnAddrLen
);
EXPECT_EQ
(
strlen
(
g_udpMsg
),
(
unsigned
int
)
ret
);
EXPECT_EQ
(
strlen
(
g_udpMsg
),
(
unsigned
int
)
ret
);
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_family
=
AF_INET
;
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_addr
.
s_addr
=
inet_addr
(
g_localHost
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
clnAddr
.
sin_port
=
htons
(
PEER_PORT
);
(
v
io
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
(
v
oi
d
)
memset_s
(
buf
,
BUF_SIZE
,
0
,
BUF_SIZE
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_udpMsg
);
ret
=
strcpy_s
(
buf
,
BUF_SIZE
,
g_udpMsg
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
msg
.
msg_name
=
&
clnAddr
;
msg
.
msg_name
=
&
clnAddr
;
...
@@ -761,7 +761,7 @@ HWTEST_F(ActsLwipTest, testSocketOpt, Function | MediumTest | Level2)
...
@@ -761,7 +761,7 @@ HWTEST_F(ActsLwipTest, testSocketOpt, Function | MediumTest | Level2)
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
len
);
ret
=
setsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
len
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
(
v
io
d
)
memset_s
(
&
timeout
,
len
,
0
,
len
);
(
v
oi
d
)
memset_s
(
&
timeout
,
len
,
0
,
len
);
ret
=
getsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
&
len
);
ret
=
getsockopt
(
fd
,
SOL_SOCKET
,
SO_RCVTIMEO
,
&
timeout
,
&
len
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
0
,
ret
);
EXPECT_EQ
(
1000
,
timeout
.
tv_sec
);
EXPECT_EQ
(
1000
,
timeout
.
tv_sec
);
...
...
communication_lite/wifiservice_hal/src/wifiservice_func_test.c
浏览文件 @
a8edc778
...
@@ -595,10 +595,10 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanType, Function | MediumT
...
@@ -595,10 +595,10 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanType, Function | MediumT
int
freq
=
2460
;
int
freq
=
2460
;
WifiScanParams
scanParams
=
{
0
};
WifiScanParams
scanParams
=
{
0
};
char
bssid
[
WIFI_MAC_LEN
]
=
{
0xac
,
0x75
,
0x1d
,
0xd8
,
0x55
,
0xc1
};
char
bssid
[
WIFI_MAC_LEN
]
=
{
0xac
,
0x75
,
0x1d
,
0xd8
,
0x55
,
0xc1
};
(
v
io
d
)
strcpy_s
(
scanParams
.
ssid
,
sizeof
(
scanParams
.
ssid
),
"wifi_service_xts"
);
(
v
oi
d
)
strcpy_s
(
scanParams
.
ssid
,
sizeof
(
scanParams
.
ssid
),
"wifi_service_xts"
);
scanParams
.
ssidLen
=
strlen
(
scanParams
.
ssid
);
scanParams
.
ssidLen
=
strlen
(
scanParams
.
ssid
);
scanParams
.
freqs
=
freq
;
scanParams
.
freqs
=
freq
;
(
v
io
d
)
memcpy_s
(
scanParams
.
bssid
,
sizeof
(
scanParams
.
bssid
),
bssid
,
sizeof
(
bssid
));
(
v
oi
d
)
memcpy_s
(
scanParams
.
bssid
,
sizeof
(
scanParams
.
bssid
),
bssid
,
sizeof
(
bssid
));
scanParams
.
scanType
=
WIFI_SSID_SCAN
;
scanParams
.
scanType
=
WIFI_SSID_SCAN
;
g_staScanSuccess
=
0
;
g_staScanSuccess
=
0
;
...
@@ -676,7 +676,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam02, Function
...
@@ -676,7 +676,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam02, Function
WifiScanParams
*
scanParams
=
malloc
(
sizeof
(
WifiScanParams
));
WifiScanParams
*
scanParams
=
malloc
(
sizeof
(
WifiScanParams
));
TEST_ASSERT_NOT_NULL
(
scanParams
);
TEST_ASSERT_NOT_NULL
(
scanParams
);
(
v
io
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
(
v
oi
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
error
=
AdvanceScan
(
scanParams
);
error
=
AdvanceScan
(
scanParams
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
...
@@ -689,8 +689,8 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam02, Function
...
@@ -689,8 +689,8 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam02, Function
error
=
AdvanceScan
(
scanParams
);
error
=
AdvanceScan
(
scanParams
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
(
v
io
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
(
v
oi
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
(
v
io
d
)
strcpy_s
(
scanParams
->
ssid
,
sizeof
(
scanParams
->
ssid
),
"wifi_service_xts"
);
(
v
oi
d
)
strcpy_s
(
scanParams
->
ssid
,
sizeof
(
scanParams
->
ssid
),
"wifi_service_xts"
);
scanParams
->
scanType
=
WIFI_SSID_SCAN
;
scanParams
->
scanType
=
WIFI_SSID_SCAN
;
error
=
AdvanceScan
(
scanParams
);
error
=
AdvanceScan
(
scanParams
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
TEST_ASSERT_EQUAL_INT
(
ERROR_WIFI_UNKNOWN
,
error
);
...
@@ -721,7 +721,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam03, Function
...
@@ -721,7 +721,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam03, Function
WifiScanParams
*
scanParams
=
malloc
(
sizeof
(
WifiScanParams
));
WifiScanParams
*
scanParams
=
malloc
(
sizeof
(
WifiScanParams
));
TEST_ASSERT_NOT_NULL
(
scanParams
);
TEST_ASSERT_NOT_NULL
(
scanParams
);
(
v
io
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
(
v
oi
d
)
memset_s
(
scanParams
,
sizeof
(
WifiScanParams
),
0
,
sizeof
(
WifiScanParams
));
scanParams
->
scanType
=
WIFI_BAND_SCAN
;
scanParams
->
scanType
=
WIFI_BAND_SCAN
;
g_staScanSuccess
=
0
;
g_staScanSuccess
=
0
;
...
@@ -739,7 +739,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam03, Function
...
@@ -739,7 +739,7 @@ LITE_TEST_CASE(WifiServiceFuncTestSuite, testAdvanceScanInvalidParam03, Function
TEST_ASSERT_EQUAL_INT
(
1
,
g_staScanSuccess
);
TEST_ASSERT_EQUAL_INT
(
1
,
g_staScanSuccess
);
char
bssid
[
WIFI_MAC_LEN
]
=
{
0xac
,
0x75
,
0x1d
,
0xd8
,
0x55
,
0xc1
};
char
bssid
[
WIFI_MAC_LEN
]
=
{
0xac
,
0x75
,
0x1d
,
0xd8
,
0x55
,
0xc1
};
(
v
io
d
)
memcpy_s
(
scanParams
->
bssid
,
sizeof
(
scanParams
->
bssid
),
bssid
,
sizeof
(
bssid
));
(
v
oi
d
)
memcpy_s
(
scanParams
->
bssid
,
sizeof
(
scanParams
->
bssid
),
bssid
,
sizeof
(
bssid
));
scanParams
->
scanType
=
WIFI_BSSID_SCAN
;
scanParams
->
scanType
=
WIFI_BSSID_SCAN
;
g_staScanSuccess
=
0
;
g_staScanSuccess
=
0
;
error
=
AdvanceScan
(
scanParams
);
error
=
AdvanceScan
(
scanParams
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录