Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
c014b4e1
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
大约 1 年 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c014b4e1
编写于
1月 04, 2022
作者:
L
liubb_0516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ipc test case
Signed-off-by:
N
liubb_0516
<
liubeibei8@huawei.com
>
上级
f40c9a9c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
35 deletion
+38
-35
ipc/test/ipc/client/BUILD.gn
ipc/test/ipc/client/BUILD.gn
+2
-2
ipc/test/ipc/client/client.c
ipc/test/ipc/client/client.c
+14
-14
ipc/test/ipc/samgr/BUILD.gn
ipc/test/ipc/samgr/BUILD.gn
+2
-2
ipc/test/ipc/samgr/samgr.c
ipc/test/ipc/samgr/samgr.c
+6
-3
ipc/test/ipc/server/BUILD.gn
ipc/test/ipc/server/BUILD.gn
+2
-2
ipc/test/ipc/server/server.c
ipc/test/ipc/server/server.c
+12
-12
未找到文件。
ipc/test/ipc/client/BUILD.gn
浏览文件 @
c014b4e1
# Copyright (c) 202
0
Huawei Device Co., Ltd.
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# 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
...
...
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import("//build/lite/config/component/lite_component.gni")
...
...
ipc/test/ipc/client/client.c
浏览文件 @
c014b4e1
...
...
@@ -15,11 +15,12 @@
#include <stdlib.h>
#include "rpc_log.h"
#include "rpc_errno.h"
#include "ipc_proxy.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "serializer.h"
#include "ipc_proxy.h"
static
SvcIdentity
g_serverSid
;
...
...
@@ -55,17 +56,17 @@ int32_t RemoteRequest(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption op
return
result
;
}
void
ServerDead1
()
void
ServerDead1
(
void
)
{
RPC_LOG_INFO
(
"#### server dead callback11 called ... "
);
}
void
ServerDead2
()
void
ServerDead2
(
void
)
{
RPC_LOG_INFO
(
"#### server dead callback22 called ... "
);
}
void
ServerDead3
()
void
ServerDead3
(
void
)
{
RPC_LOG_INFO
(
"#### server dead callback33 called ... "
);
}
...
...
@@ -76,7 +77,7 @@ static SvcIdentity g_samgr = {
MessageOption
g_option
=
TF_OP_SYNC
;
static
void
GetServerOne
()
static
void
GetServerOne
(
void
)
{
IpcIo
data1
;
uint8_t
tmpData1
[
IPC_MAX_SIZE
];
...
...
@@ -90,7 +91,7 @@ static void GetServerOne()
EXPECT_EQ
(
ret
,
ERR_NONE
);
}
static
void
CallServerAdd
()
static
void
CallServerAdd
(
void
)
{
IpcIo
data2
;
uint8_t
tmpData2
[
IPC_MAX_SIZE
];
...
...
@@ -110,7 +111,7 @@ static void CallServerAdd()
EXPECT_EQ
(
res
,
tmpSum
);
}
static
void
AnonymousTest
()
static
void
AnonymousTest
(
void
)
{
IpcObjectStub
objectStub
=
{
.
func
=
RemoteRequest
,
...
...
@@ -139,7 +140,7 @@ static void AnonymousTest()
EXPECT_EQ
(
res
,
ERR_NONE
);
}
static
void
DeathCallbackTest
()
static
void
DeathCallbackTest
(
void
)
{
uint32_t
cbId1
=
-
1
;
uint32_t
cbId2
=
-
1
;
...
...
@@ -167,14 +168,13 @@ static void DeathCallbackTest()
EXPECT_EQ
(
ret
,
ERR_NONE
);
ret
=
RemoveDeathRecipient
(
g_serverSid
,
cbId3
);
EXPECT_EQ
(
ret
,
ERR_NONE
);
int
handleOld
=
g_serverSid
.
handle
;
g_serverSid
.
handle
=
17
;
++
g_serverSid
.
handle
;
ret
=
AddDeathRecipient
(
g_serverSid
,
ServerDead3
,
NULL
,
&
cbId5
);
// failed
EXPECT_EQ
(
ret
,
ERR_INVALID_PARAM
);
ret
=
RemoveDeathRecipient
(
g_serverSid
,
cbId3
);
// failed
EXPECT_EQ
(
ret
,
ERR_INVALID_PARAM
);
g_serverSid
.
handle
=
handleOld
;
--
g_serverSid
.
handle
;
ret
=
AddDeathRecipient
(
g_serverSid
,
ServerDead1
,
NULL
,
&
cbId1
);
EXPECT_EQ
(
ret
,
ERR_NONE
);
...
...
@@ -182,7 +182,7 @@ static void DeathCallbackTest()
EXPECT_EQ
(
ret
,
ERR_NONE
);
}
int
main
()
int
main
(
int
argc
,
char
*
argv
[]
)
{
RPC_LOG_INFO
(
"Enter System Ability Client .... "
);
GetServerOne
();
...
...
ipc/test/ipc/samgr/BUILD.gn
浏览文件 @
c014b4e1
# Copyright (c) 202
0
Huawei Device Co., Ltd.
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# 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
...
...
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import("//build/lite/config/component/lite_component.gni")
...
...
ipc/test/ipc/samgr/samgr.c
浏览文件 @
c014b4e1
...
...
@@ -16,10 +16,10 @@
#include <stdlib.h>
#include <string.h>
#include "rpc_log.h"
#include "rpc_errno.h"
#include "ipc_skeleton.h"
#include "ipc_proxy.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "serializer.h"
#include "utils_list.h"
...
...
@@ -38,6 +38,9 @@ int32_t AddSystemAbility(int32_t saId, SvcIdentity *sid)
}
SvcInfo
*
node
=
(
SvcInfo
*
)
calloc
(
1
,
sizeof
(
SvcInfo
));
if
(
node
==
NULL
)
{
return
ERR_FAILED
;
}
node
->
saId
=
saId
;
node
->
sid
=
sid
;
UtilsListAdd
(
g_saList
,
&
node
->
list
);
...
...
ipc/test/ipc/server/BUILD.gn
浏览文件 @
c014b4e1
# Copyright (c) 202
0
Huawei Device Co., Ltd.
# Copyright (c) 202
1
Huawei Device Co., Ltd.
# 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
...
...
@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import("//build/lite/config/component/lite_component.gni")
...
...
ipc/test/ipc/server/server.c
浏览文件 @
c014b4e1
...
...
@@ -13,15 +13,15 @@
* limitations under the License.
*/
#include <stdlib.h>
#include <pthread.h>
#include "rpc_log.h"
#include "rpc_errno.h"
#include "ipc_skeleton.h"
#include "serializer.h"
#include <stdlib.h>
#include <unistd.h>
#include "ipc_proxy.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "serializer.h"
static
SvcIdentity
*
sid
=
NULL
;
...
...
@@ -117,7 +117,7 @@ int32_t RemoteRequestTwo(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption
return
result
;
}
static
void
*
ThreadHandler
()
static
void
*
ThreadHandler
(
void
*
args
)
{
sleep
(
IPC_TEST_TIME_INTERVAL
);
// sleep 2 min
const
char
*
str
=
"server call anonymos service new thread."
;
...
...
@@ -149,7 +149,7 @@ static SvcIdentity svcTwo = {
.
cookie
=
(
uintptr_t
)
&
objectStubTwo
};
static
void
AddSaOne
()
static
void
AddSaOne
(
void
)
{
IpcIo
data
;
uint8_t
tmpData1
[
IPC_MAX_SIZE
];
...
...
@@ -165,10 +165,10 @@ static void AddSaOne()
FreeBuffer
((
void
*
)
ptr
);
EXPECT_EQ
(
ret
,
ERR_NONE
);
EXPECT_EQ
(
res
,
ERR_NONE
);
sleep
(
2
);
sleep
(
1
);
}
static
void
AddSaTwo
()
static
void
AddSaTwo
(
void
)
{
IpcIo
dataTwo
;
uint8_t
tmpData2
[
IPC_MAX_SIZE
];
...
...
@@ -184,10 +184,10 @@ static void AddSaTwo()
FreeBuffer
((
void
*
)
ptr
);
EXPECT_EQ
(
ret
,
ERR_NONE
);
EXPECT_EQ
(
res
,
ERR_NONE
);
sleep
(
2
);
sleep
(
1
);
}
int
main
()
int
main
(
int
argc
,
char
*
argv
[]
)
{
RPC_LOG_INFO
(
"Enter System Ability Server .... "
);
AddSaOne
();
...
...
@@ -205,7 +205,7 @@ int main()
ReadRemoteObject
(
&
reply
,
&
sidOne
);
FreeBuffer
((
void
*
)
ptr
);
EXPECT_EQ
(
ret
,
ERR_NONE
);
sleep
(
2
);
sleep
(
1
);
RPC_LOG_INFO
(
"====== call serverone OP_MULTI ======"
);
IpcIo
data2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录