Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
56433846
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,发现更多精彩内容 >>
未验证
提交
56433846
编写于
5月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!256 Codex alarm modification
Merge pull request !256 from 周礼亭/master
上级
e7a9a21d
2031ed58
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
80 addition
and
30 deletion
+80
-30
ipc/native/src/core/source/ipc_file_descriptor.cpp
ipc/native/src/core/source/ipc_file_descriptor.cpp
+1
-1
ipc/native/src/core/source/ipc_object_proxy.cpp
ipc/native/src/core/source/ipc_object_proxy.cpp
+5
-1
ipc/native/src/core/source/ipc_process_skeleton.cpp
ipc/native/src/core/source/ipc_process_skeleton.cpp
+10
-3
ipc/native/src/core/source/ipc_thread_pool.cpp
ipc/native/src/core/source/ipc_thread_pool.cpp
+7
-1
ipc/native/src/core/source/ipc_thread_skeleton.cpp
ipc/native/src/core/source/ipc_thread_skeleton.cpp
+1
-1
ipc/native/src/core/source/message_parcel.cpp
ipc/native/src/core/source/message_parcel.cpp
+11
-6
ipc/native/src/mock/include/dbinder_base_invoker.h
ipc/native/src/mock/include/dbinder_base_invoker.h
+10
-2
ipc/native/src/mock/include/invoker_factory.h
ipc/native/src/mock/include/invoker_factory.h
+8
-1
ipc/native/src/mock/source/binder_connector.cpp
ipc/native/src/mock/source/binder_connector.cpp
+5
-1
ipc/native/src/mock/source/binder_invoker.cpp
ipc/native/src/mock/source/binder_invoker.cpp
+11
-2
ipc/native/test/unittest/common/ipc_file_desc_unittest.cpp
ipc/native/test/unittest/common/ipc_file_desc_unittest.cpp
+1
-1
ipc/test/auxiliary/native/src/test_service.cpp
ipc/test/auxiliary/native/src/test_service.cpp
+1
-1
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
+2
-2
ipc/test/moduletest/native/common/ipc_core_module_test.cpp
ipc/test/moduletest/native/common/ipc_core_module_test.cpp
+1
-1
services/dbinder/test/distributedtest/src/dbinder_service_test_helper.cpp
.../test/distributedtest/src/dbinder_service_test_helper.cpp
+2
-2
test/resource/services/ohos_test.xml
test/resource/services/ohos_test.xml
+4
-4
未找到文件。
ipc/native/src/core/source/ipc_file_descriptor.cpp
浏览文件 @
56433846
...
@@ -85,6 +85,6 @@ IPCFileDescriptor *IPCFileDescriptor::Unmarshalling(Parcel &parcel)
...
@@ -85,6 +85,6 @@ IPCFileDescriptor *IPCFileDescriptor::Unmarshalling(Parcel &parcel)
return
nullptr
;
return
nullptr
;
}
}
return
new
IPCFileDescriptor
(
fd
);
return
new
(
std
::
nothrow
)
IPCFileDescriptor
(
fd
);
}
}
}
// namespace OHOS
}
// namespace OHOS
ipc/native/src/core/source/ipc_object_proxy.cpp
浏览文件 @
56433846
...
@@ -522,7 +522,11 @@ bool IPCObjectProxy::AddDbinderDeathRecipient()
...
@@ -522,7 +522,11 @@ bool IPCObjectProxy::AddDbinderDeathRecipient()
return
true
;
return
true
;
}
}
sptr
<
IPCObjectStub
>
callbackStub
=
new
IPCObjectStub
(
descriptor_
);
sptr
<
IPCObjectStub
>
callbackStub
=
new
(
std
::
nothrow
)
IPCObjectStub
(
descriptor_
);
if
(
callbackStub
==
nullptr
)
{
ZLOGE
(
LABEL
,
"create IPCObjectStub object failed"
);
return
false
;
}
if
(
!
current
->
AttachCallbackStub
(
this
,
callbackStub
))
{
if
(
!
current
->
AttachCallbackStub
(
this
,
callbackStub
))
{
ZLOGW
(
LABEL
,
"%s: already attach new callback stub"
,
__func__
);
ZLOGW
(
LABEL
,
"%s: already attach new callback stub"
,
__func__
);
return
false
;
return
false
;
...
...
ipc/native/src/core/source/ipc_process_skeleton.cpp
浏览文件 @
56433846
...
@@ -58,7 +58,11 @@ IPCProcessSkeleton *IPCProcessSkeleton::GetCurrent()
...
@@ -58,7 +58,11 @@ IPCProcessSkeleton *IPCProcessSkeleton::GetCurrent()
if
(
instance_
==
nullptr
)
{
if
(
instance_
==
nullptr
)
{
std
::
lock_guard
<
std
::
mutex
>
lockGuard
(
procMutex_
);
std
::
lock_guard
<
std
::
mutex
>
lockGuard
(
procMutex_
);
if
(
instance_
==
nullptr
)
{
if
(
instance_
==
nullptr
)
{
IPCProcessSkeleton
*
temp
=
new
IPCProcessSkeleton
();
IPCProcessSkeleton
*
temp
=
new
(
std
::
nothrow
)
IPCProcessSkeleton
();
if
(
temp
==
nullptr
)
{
DBINDER_LOGE
(
"create IPCProcessSkeleton object failed"
);
return
nullptr
;
}
if
(
temp
->
SetMaxWorkThread
(
DEFAULT_WORK_THREAD_NUM
))
{
if
(
temp
->
SetMaxWorkThread
(
DEFAULT_WORK_THREAD_NUM
))
{
temp
->
SpawnThread
(
IPCWorkThread
::
SPAWN_ACTIVE
);
temp
->
SpawnThread
(
IPCWorkThread
::
SPAWN_ACTIVE
);
}
}
...
@@ -176,9 +180,12 @@ bool IPCProcessSkeleton::SetMaxWorkThread(int maxThreadNum)
...
@@ -176,9 +180,12 @@ bool IPCProcessSkeleton::SetMaxWorkThread(int maxThreadNum)
}
}
if
(
threadPool_
==
nullptr
)
{
if
(
threadPool_
==
nullptr
)
{
threadPool_
=
new
IPCWorkThreadPool
(
maxThreadNum
);
threadPool_
=
new
(
std
::
nothrow
)
IPCWorkThreadPool
(
maxThreadNum
);
if
(
threadPool_
==
nullptr
)
{
DBINDER_LOGE
(
"create IPCWorkThreadPool object failed"
);
return
false
;
}
}
}
threadPool_
->
UpdateMaxThreadNum
(
maxThreadNum
);
threadPool_
->
UpdateMaxThreadNum
(
maxThreadNum
);
IRemoteInvoker
*
invoker
=
IPCThreadSkeleton
::
GetRemoteInvoker
(
IRemoteObject
::
IF_PROT_DEFAULT
);
IRemoteInvoker
*
invoker
=
IPCThreadSkeleton
::
GetRemoteInvoker
(
IRemoteObject
::
IF_PROT_DEFAULT
);
if
(
invoker
!=
nullptr
)
{
if
(
invoker
!=
nullptr
)
{
...
...
ipc/native/src/core/source/ipc_thread_pool.cpp
浏览文件 @
56433846
...
@@ -27,6 +27,7 @@ namespace IPC_SINGLE {
...
@@ -27,6 +27,7 @@ namespace IPC_SINGLE {
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LOG_LABEL
=
{
LOG_CORE
,
LOG_ID_IPC
,
"IPCWorkThreadPool"
};
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LOG_LABEL
=
{
LOG_CORE
,
LOG_ID_IPC
,
"IPCWorkThreadPool"
};
#define DBINDER_LOGI(fmt, args...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, "%{public}d: " fmt, __LINE__, ##args)
#define DBINDER_LOGI(fmt, args...) (void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, "%{public}d: " fmt, __LINE__, ##args)
#define DBINDER_LOGE(fmt, args...) (void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, "%{public}d: " fmt, __LINE__, ##args)
IPCWorkThreadPool
::
IPCWorkThreadPool
(
int
maxThreadNum
)
IPCWorkThreadPool
::
IPCWorkThreadPool
(
int
maxThreadNum
)
:
threadSequence_
(
0
),
:
threadSequence_
(
0
),
...
@@ -60,7 +61,12 @@ bool IPCWorkThreadPool::SpawnThread(int policy, int proto)
...
@@ -60,7 +61,12 @@ bool IPCWorkThreadPool::SpawnThread(int policy, int proto)
DBINDER_LOGI
(
"SpawnThread Name= %{public}s"
,
threadName
.
c_str
());
DBINDER_LOGI
(
"SpawnThread Name= %{public}s"
,
threadName
.
c_str
());
if
(
threads_
.
find
(
threadName
)
==
threads_
.
end
())
{
if
(
threads_
.
find
(
threadName
)
==
threads_
.
end
())
{
sptr
<
IPCWorkThread
>
newThread
=
sptr
<
IPCWorkThread
>
(
new
IPCWorkThread
(
threadName
));
auto
ipcThread
=
new
(
std
::
nothrow
)
IPCWorkThread
(
threadName
);
if
(
ipcThread
==
nullptr
)
{
DBINDER_LOGE
(
"create IPCWorkThread object failed"
);
return
false
;
}
sptr
<
IPCWorkThread
>
newThread
=
sptr
<
IPCWorkThread
>
(
ipcThread
);
threads_
[
threadName
]
=
newThread
;
threads_
[
threadName
]
=
newThread
;
if
(
proto
==
IRemoteObject
::
IF_PROT_DEFAULT
)
{
if
(
proto
==
IRemoteObject
::
IF_PROT_DEFAULT
)
{
idleThreadNum_
--
;
idleThreadNum_
--
;
...
...
ipc/native/src/core/source/ipc_thread_skeleton.cpp
浏览文件 @
56433846
...
@@ -57,7 +57,7 @@ IPCThreadSkeleton *IPCThreadSkeleton::GetCurrent()
...
@@ -57,7 +57,7 @@ IPCThreadSkeleton *IPCThreadSkeleton::GetCurrent()
if
(
curTLS
!=
nullptr
)
{
if
(
curTLS
!=
nullptr
)
{
current
=
reinterpret_cast
<
IPCThreadSkeleton
*>
(
curTLS
);
current
=
reinterpret_cast
<
IPCThreadSkeleton
*>
(
curTLS
);
}
else
{
}
else
{
current
=
new
IPCThreadSkeleton
();
current
=
new
(
std
::
nothrow
)
IPCThreadSkeleton
();
}
}
return
current
;
return
current
;
...
...
ipc/native/src/core/source/message_parcel.cpp
浏览文件 @
56433846
...
@@ -37,14 +37,11 @@ namespace OHOS {
...
@@ -37,14 +37,11 @@ namespace OHOS {
#define TITLE __PRETTY_FUNCTION__
#define TITLE __PRETTY_FUNCTION__
#endif
#endif
#ifndef CONFIG_IPC_SINGLE
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LOG_LABEL
=
{
LOG_CORE
,
LOG_ID_RPC
,
"MessageParcel"
};
static
constexpr
OHOS
::
HiviewDFX
::
HiLogLabel
LOG_LABEL
=
{
LOG_CORE
,
LOG_ID_RPC
,
"MessageParcel"
};
#define DBINDER_LOGE(fmt, args...) \
#define DBINDER_LOGE(fmt, args...) \
(void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, "%{public}s %{public}d: " fmt, TITLE, __LINE__, ##args)
(void)OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, "%{public}s %{public}d: " fmt, TITLE, __LINE__, ##args)
#define DBINDER_LOGI(fmt, args...) \
#define DBINDER_LOGI(fmt, args...) \
(void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, "%{public}s %{public}d: " fmt, TITLE, __LINE__, ##args)
(void)OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, "%{public}s %{public}d: " fmt, TITLE, __LINE__, ##args)
#endif
MessageParcel
::
MessageParcel
()
MessageParcel
::
MessageParcel
()
:
Parcel
(),
:
Parcel
(),
...
@@ -118,7 +115,11 @@ bool MessageParcel::WriteDBinderProxy(const sptr<IRemoteObject> &object, uint32_
...
@@ -118,7 +115,11 @@ bool MessageParcel::WriteDBinderProxy(const sptr<IRemoteObject> &object, uint32_
sptr
<
DBinderCallbackStub
>
fakeStub
=
current
->
QueryDBinderCallbackStub
(
object
);
sptr
<
DBinderCallbackStub
>
fakeStub
=
current
->
QueryDBinderCallbackStub
(
object
);
if
(
fakeStub
==
nullptr
)
{
if
(
fakeStub
==
nullptr
)
{
// note that cannot use this proxy's descriptor
// note that cannot use this proxy's descriptor
fakeStub
=
new
DBinderCallbackStub
(
peerName
,
peerId
,
localId
,
stubIndex
,
handle
,
feature
);
fakeStub
=
new
(
std
::
nothrow
)
DBinderCallbackStub
(
peerName
,
peerId
,
localId
,
stubIndex
,
handle
,
feature
);
if
(
fakeStub
==
nullptr
)
{
DBINDER_LOGE
(
"create DBinderCallbackStub object failed"
);
return
false
;
}
if
(
!
current
->
AttachDBinderCallbackStub
(
object
,
fakeStub
))
{
if
(
!
current
->
AttachDBinderCallbackStub
(
object
,
fakeStub
))
{
DBINDER_LOGE
(
"save callback of fake stub failed"
);
DBINDER_LOGE
(
"save callback of fake stub failed"
);
return
false
;
return
false
;
...
@@ -184,7 +185,11 @@ bool MessageParcel::WriteFileDescriptor(int fd)
...
@@ -184,7 +185,11 @@ bool MessageParcel::WriteFileDescriptor(int fd)
if
(
dupFd
<
0
)
{
if
(
dupFd
<
0
)
{
return
false
;
return
false
;
}
}
sptr
<
IPCFileDescriptor
>
descriptor
=
new
IPCFileDescriptor
(
dupFd
);
sptr
<
IPCFileDescriptor
>
descriptor
=
new
(
std
::
nothrow
)
IPCFileDescriptor
(
dupFd
);
if
(
descriptor
==
nullptr
)
{
DBINDER_LOGE
(
"create IPCFileDescriptor object failed"
);
return
false
;
}
return
WriteObject
<
IPCFileDescriptor
>
(
descriptor
);
return
WriteObject
<
IPCFileDescriptor
>
(
descriptor
);
}
}
...
@@ -415,6 +420,6 @@ sptr<Ashmem> MessageParcel::ReadAshmem()
...
@@ -415,6 +420,6 @@ sptr<Ashmem> MessageParcel::ReadAshmem()
::
close
(
fd
);
::
close
(
fd
);
return
nullptr
;
return
nullptr
;
}
}
return
new
Ashmem
(
fd
,
size
);
return
new
(
std
::
nothrow
)
Ashmem
(
fd
,
size
);
}
}
}
// namespace OHOS
}
// namespace OHOS
ipc/native/src/mock/include/dbinder_base_invoker.h
浏览文件 @
56433846
...
@@ -595,7 +595,11 @@ template <class T> int DBinderBaseInvoker<T>::HandleReply(uint64_t seqNumber, Me
...
@@ -595,7 +595,11 @@ template <class T> int DBinderBaseInvoker<T>::HandleReply(uint64_t seqNumber, Me
DBINDER_BASE_LOGE
(
"need reply message, but buffer is nullptr"
);
DBINDER_BASE_LOGE
(
"need reply message, but buffer is nullptr"
);
return
RPC_BASE_INVOKER_INVALID_REPLY_ERR
;
return
RPC_BASE_INVOKER_INVALID_REPLY_ERR
;
}
}
auto
allocator
=
new
DBinderRecvAllocator
();
auto
allocator
=
new
(
std
::
nothrow
)
DBinderRecvAllocator
();
if
(
allocator
==
nullptr
)
{
DBINDER_BASE_LOGE
(
"create DBinderRecvAllocator object failed"
);
return
RPC_BASE_INVOKER_INVALID_REPLY_ERR
;
}
if
(
!
reply
->
SetAllocator
(
allocator
))
{
if
(
!
reply
->
SetAllocator
(
allocator
))
{
DBINDER_BASE_LOGE
(
"SetAllocator failed"
);
DBINDER_BASE_LOGE
(
"SetAllocator failed"
);
delete
allocator
;
delete
allocator
;
...
@@ -847,7 +851,11 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
...
@@ -847,7 +851,11 @@ template <class T> void DBinderBaseInvoker<T>::ProcessTransaction(dbinder_transa
return
;
return
;
}
}
auto
allocator
=
new
DBinderSendAllocator
();
auto
allocator
=
new
(
std
::
nothrow
)
DBinderSendAllocator
();
if
(
allocator
==
nullptr
)
{
DBINDER_BASE_LOGE
(
"DBinderSendAllocator Creation failed"
);
return
;
}
if
(
!
data
.
SetAllocator
(
allocator
))
{
if
(
!
data
.
SetAllocator
(
allocator
))
{
DBINDER_BASE_LOGE
(
"SetAllocator failed"
);
DBINDER_BASE_LOGE
(
"SetAllocator failed"
);
delete
allocator
;
delete
allocator
;
...
...
ipc/native/src/mock/include/invoker_factory.h
浏览文件 @
56433846
...
@@ -56,7 +56,14 @@ private:
...
@@ -56,7 +56,14 @@ private:
template
<
typename
T
>
InvokerDelegator
<
T
>::
InvokerDelegator
(
int
prot
)
template
<
typename
T
>
InvokerDelegator
<
T
>::
InvokerDelegator
(
int
prot
)
{
{
prot_
=
prot
;
prot_
=
prot
;
InvokerFactory
::
Get
().
Register
(
prot
,
[]()
{
return
static_cast
<
IRemoteInvoker
*>
(
new
T
());
});
auto
invokerObject
=
[]()
->
IRemoteInvoker
*
{
auto
data
=
new
(
std
::
nothrow
)
T
();
if
(
data
==
nullptr
)
{
return
nullptr
;
}
return
static_cast
<
IRemoteInvoker
*>
(
data
);
};
InvokerFactory
::
Get
().
Register
(
prot
,
invokerObject
);
}
}
template
<
typename
T
>
InvokerDelegator
<
T
>::~
InvokerDelegator
()
template
<
typename
T
>
InvokerDelegator
<
T
>::~
InvokerDelegator
()
...
...
ipc/native/src/mock/source/binder_connector.cpp
浏览文件 @
56433846
...
@@ -154,7 +154,11 @@ BinderConnector *BinderConnector::GetInstance()
...
@@ -154,7 +154,11 @@ BinderConnector *BinderConnector::GetInstance()
if
(
instance_
==
nullptr
)
{
if
(
instance_
==
nullptr
)
{
std
::
lock_guard
<
std
::
mutex
>
lockGuard
(
skeletonMutex
);
std
::
lock_guard
<
std
::
mutex
>
lockGuard
(
skeletonMutex
);
if
(
instance_
==
nullptr
)
{
if
(
instance_
==
nullptr
)
{
BinderConnector
*
temp
=
new
BinderConnector
(
DRIVER_NAME
);
auto
temp
=
new
(
std
::
nothrow
)
BinderConnector
(
DRIVER_NAME
);
if
(
temp
==
nullptr
)
{
ZLOGE
(
LABEL
,
"create BinderConnector object failed"
);
return
nullptr
;
}
if
(
!
temp
->
OpenDriver
())
{
if
(
!
temp
->
OpenDriver
())
{
delete
temp
;
delete
temp
;
temp
=
nullptr
;
temp
=
nullptr
;
...
...
ipc/native/src/mock/source/binder_invoker.cpp
浏览文件 @
56433846
...
@@ -411,7 +411,12 @@ void BinderInvoker::OnReleaseObject(uint32_t cmd)
...
@@ -411,7 +411,12 @@ void BinderInvoker::OnReleaseObject(uint32_t cmd)
void
BinderInvoker
::
OnTransaction
(
const
uint8_t
*
buffer
)
void
BinderInvoker
::
OnTransaction
(
const
uint8_t
*
buffer
)
{
{
const
binder_transaction_data
*
tr
=
reinterpret_cast
<
const
binder_transaction_data
*>
(
buffer
);
const
binder_transaction_data
*
tr
=
reinterpret_cast
<
const
binder_transaction_data
*>
(
buffer
);
auto
data
=
std
::
make_unique
<
MessageParcel
>
(
new
BinderAllocator
());
auto
binderAllocator
=
new
(
std
::
nothrow
)
BinderAllocator
();
if
(
binderAllocator
==
nullptr
)
{
ZLOGE
(
LABEL
,
"BinderAllocator Creation failed"
);
return
;
}
auto
data
=
std
::
make_unique
<
MessageParcel
>
(
binderAllocator
);
data
->
ParseFrom
(
tr
->
data
.
ptr
.
buffer
,
tr
->
data_size
);
data
->
ParseFrom
(
tr
->
data
.
ptr
.
buffer
,
tr
->
data_size
);
if
(
tr
->
offsets_size
>
0
)
{
if
(
tr
->
offsets_size
>
0
)
{
data
->
InjectOffsets
(
tr
->
data
.
ptr
.
offsets
,
tr
->
offsets_size
/
sizeof
(
binder_size_t
));
data
->
InjectOffsets
(
tr
->
data
.
ptr
.
offsets
,
tr
->
offsets_size
/
sizeof
(
binder_size_t
));
...
@@ -532,7 +537,11 @@ int BinderInvoker::HandleReply(MessageParcel *reply)
...
@@ -532,7 +537,11 @@ int BinderInvoker::HandleReply(MessageParcel *reply)
}
}
if
(
tr
->
data_size
>
0
)
{
if
(
tr
->
data_size
>
0
)
{
auto
allocator
=
new
BinderAllocator
();
auto
allocator
=
new
(
std
::
nothrow
)
BinderAllocator
();
if
(
allocator
==
nullptr
)
{
ZLOGE
(
LABEL
,
"create BinderAllocator object failed"
);
return
IPC_INVOKER_INVALID_DATA_ERR
;
}
if
(
!
reply
->
SetAllocator
(
allocator
))
{
if
(
!
reply
->
SetAllocator
(
allocator
))
{
ZLOGI
(
LABEL
,
"SetAllocator failed"
);
ZLOGI
(
LABEL
,
"SetAllocator failed"
);
delete
allocator
;
delete
allocator
;
...
...
ipc/native/test/unittest/common/ipc_file_desc_unittest.cpp
浏览文件 @
56433846
...
@@ -49,7 +49,7 @@ void IPCFileDescOpsTest::TearDownTestCase() {}
...
@@ -49,7 +49,7 @@ void IPCFileDescOpsTest::TearDownTestCase() {}
HWTEST_F
(
IPCFileDescOpsTest
,
fd_parcelable_001
,
TestSize
.
Level1
)
HWTEST_F
(
IPCFileDescOpsTest
,
fd_parcelable_001
,
TestSize
.
Level1
)
{
{
int
testFdNum
;
int
testFdNum
;
testFdNum
=
open
(
"/data/
test/
fd_unit_test.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
testFdNum
=
open
(
"/data/fd_unit_test.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
testFdNum
==
-
1
)
{
if
(
testFdNum
==
-
1
)
{
ZLOGI
(
LABEL
,
"%s(%d):open failed."
,
__func__
,
__LINE__
);
ZLOGI
(
LABEL
,
"%s(%d):open failed."
,
__func__
,
__LINE__
);
...
...
ipc/test/auxiliary/native/src/test_service.cpp
浏览文件 @
56433846
...
@@ -134,7 +134,7 @@ int TestService::TestGetFileDescriptor()
...
@@ -134,7 +134,7 @@ int TestService::TestGetFileDescriptor()
close
(
testFd_
);
close
(
testFd_
);
}
}
testFd_
=
open
(
"/data/test
/test
.txt"
,
testFd_
=
open
(
"/data/test.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
testFd_
==
INVALID_FD
)
{
if
(
testFd_
==
INVALID_FD
)
{
...
...
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
浏览文件 @
56433846
...
@@ -153,7 +153,7 @@ int TestServiceProxy::TestStringTransaction(const std::string &data)
...
@@ -153,7 +153,7 @@ int TestServiceProxy::TestStringTransaction(const std::string &data)
void
TestServiceProxy
::
TestDumpService
()
void
TestServiceProxy
::
TestDumpService
()
{
{
ZLOGI
(
LABEL
,
"call StartDumpService"
);
ZLOGI
(
LABEL
,
"call StartDumpService"
);
int
fd
=
open
(
"/data/
test/
dump.txt"
,
int
fd
=
open
(
"/data/dump.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
fd
!=
INVALID_FD
)
{
if
(
fd
!=
INVALID_FD
)
{
ZLOGI
(
LABEL
,
"Start Dump Service"
);
ZLOGI
(
LABEL
,
"Start Dump Service"
);
...
@@ -166,7 +166,7 @@ void TestServiceProxy::TestDumpService()
...
@@ -166,7 +166,7 @@ void TestServiceProxy::TestDumpService()
void
TestServiceProxy
::
TestAsyncDumpService
()
void
TestServiceProxy
::
TestAsyncDumpService
()
{
{
int
fd
=
open
(
"/data/
test/
nonblockingDump.txt"
,
int
fd
=
open
(
"/data/nonblockingDump.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
fd
==
INVALID_FD
)
{
if
(
fd
==
INVALID_FD
)
{
return
;
return
;
...
...
ipc/test/moduletest/native/common/ipc_core_module_test.cpp
浏览文件 @
56433846
...
@@ -348,7 +348,7 @@ HWTEST_F(IPCNativeFrameworkTest, function_test_008, TestSize.Level1)
...
@@ -348,7 +348,7 @@ HWTEST_F(IPCNativeFrameworkTest, function_test_008, TestSize.Level1)
ASSERT_TRUE
(
object
!=
nullptr
);
ASSERT_TRUE
(
object
!=
nullptr
);
ZLOGI
(
LABEL
,
"get test.service OK"
);
ZLOGI
(
LABEL
,
"get test.service OK"
);
int
fd
=
open
(
"/data/
test/
dump.txt"
,
int
fd
=
open
(
"/data/dump.txt"
,
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
O_RDWR
|
O_APPEND
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
ASSERT_TRUE
(
fd
>
0
);
ASSERT_TRUE
(
fd
>
0
);
...
...
services/dbinder/test/distributedtest/src/dbinder_service_test_helper.cpp
浏览文件 @
56433846
...
@@ -132,11 +132,11 @@ pid_t StartExecutable(std::string name, std::string args)
...
@@ -132,11 +132,11 @@ pid_t StartExecutable(std::string name, std::string args)
return
pid
;
return
pid
;
}
}
std
::
string
cmd1
=
"chmod +x /data/
test/
"
+
name
;
std
::
string
cmd1
=
"chmod +x /data/"
+
name
;
int
res
=
system
(
cmd1
.
c_str
());
int
res
=
system
(
cmd1
.
c_str
());
DBINDER_LOGI
(
"%{public}s res = %d, errno = %{public}d %{public}s"
,
cmd1
.
c_str
(),
res
,
errno
,
strerror
(
errno
));
DBINDER_LOGI
(
"%{public}s res = %d, errno = %{public}d %{public}s"
,
cmd1
.
c_str
(),
res
,
errno
,
strerror
(
errno
));
std
::
string
cmd2
=
"/data/
test/
"
+
name
+
" "
+
args
+
"&"
;
std
::
string
cmd2
=
"/data/"
+
name
+
" "
+
args
+
"&"
;
res
=
system
(
cmd2
.
c_str
());
res
=
system
(
cmd2
.
c_str
());
DBINDER_LOGI
(
"%{public}s res = %{public}d"
,
cmd2
.
c_str
(),
res
);
DBINDER_LOGI
(
"%{public}s res = %{public}d"
,
cmd2
.
c_str
(),
res
);
...
...
test/resource/services/ohos_test.xml
浏览文件 @
56433846
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
<configuration
ver=
"2.0"
>
<configuration
ver=
"2.0"
>
<target
name=
"DbinderTest"
>
<target
name=
"DbinderTest"
>
<preparer>
<preparer>
<option
name=
"push"
value=
"communication/ipc/dbinder_test -> /data
/test
"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_test -> /data"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_send -> /data
/test
"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_send -> /data"
src=
"out"
/>
</preparer>
</preparer>
</target>
</target>
<target
name=
"DbinderTestAgent"
>
<target
name=
"DbinderTestAgent"
>
<preparer>
<preparer>
<option
name=
"push"
value=
"communication/ipc/dbinder_test -> /data
/test
"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_test -> /data"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_send -> /data
/test
"
src=
"out"
/>
<option
name=
"push"
value=
"communication/ipc/dbinder_send -> /data"
src=
"out"
/>
</preparer>
</preparer>
</target>
</target>
</configuration>
</configuration>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录