Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
b6ef25b4
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
大约 1 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b6ef25b4
编写于
10月 16, 2021
作者:
4
411148299@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code style
Signed-off-by:
N
411148299@qq.com
<
411148299@qq.com
>
上级
c4880939
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
183 addition
and
189 deletion
+183
-189
services/init/standard/init.c
services/init/standard/init.c
+2
-1
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+3
-3
services/param/cmd/param_cmd.c
services/param/cmd/param_cmd.c
+2
-2
services/param/include/param_utils.h
services/param/include/param_utils.h
+1
-1
services/param/service/param_persist.c
services/param/service/param_persist.c
+7
-7
services/test/unittest/param/client_unittest.cpp
services/test/unittest/param/client_unittest.cpp
+13
-14
services/test/unittest/param/dac_unittest.cpp
services/test/unittest/param/dac_unittest.cpp
+8
-8
services/test/unittest/param/param_stub.h
services/test/unittest/param/param_stub.h
+0
-6
services/test/unittest/param/param_unittest.cpp
services/test/unittest/param/param_unittest.cpp
+64
-64
services/test/unittest/param/selinux_unittest.cpp
services/test/unittest/param/selinux_unittest.cpp
+17
-17
services/test/unittest/param/trigger_unittest.cpp
services/test/unittest/param/trigger_unittest.cpp
+37
-37
services/test/unittest/param/watcher_agent_unittest.cpp
services/test/unittest/param/watcher_agent_unittest.cpp
+11
-11
services/test/unittest/param/watcher_proxy_unittest.cpp
services/test/unittest/param/watcher_proxy_unittest.cpp
+17
-17
services/utils/init_utils.c
services/utils/init_utils.c
+1
-1
未找到文件。
services/init/standard/init.c
浏览文件 @
b6ef25b4
...
@@ -127,7 +127,8 @@ void SystemConfig(void)
...
@@ -127,7 +127,8 @@ void SystemConfig(void)
LoadDefaultParams
(
"/system/etc/param/ohos_const"
,
LOAD_PARAM_NORMAL
);
LoadDefaultParams
(
"/system/etc/param/ohos_const"
,
LOAD_PARAM_NORMAL
);
LoadDefaultParams
(
"/vendor/etc/param"
,
LOAD_PARAM_NORMAL
);
LoadDefaultParams
(
"/vendor/etc/param"
,
LOAD_PARAM_NORMAL
);
LoadDefaultParams
(
"/system/etc/param"
,
LOAD_PARAM_ONLY_ADD
);
LoadDefaultParams
(
"/system/etc/param"
,
LOAD_PARAM_ONLY_ADD
);
// load persist params
LoadPersistParams
();
// read config
// read config
ReadConfig
();
ReadConfig
();
INIT_LOGI
(
"Parse init config file done."
);
INIT_LOGI
(
"Parse init config file done."
);
...
...
services/init/standard/init_cmds.c
浏览文件 @
b6ef25b4
...
@@ -300,7 +300,7 @@ static void DoUmountFstabFile(const struct CmdArgs *ctx, const char *cmdContent)
...
@@ -300,7 +300,7 @@ static void DoUmountFstabFile(const struct CmdArgs *ctx, const char *cmdContent)
}
}
}
}
static
const
struct
CmdTable
CMD_TABLE
[]
=
{
static
const
struct
CmdTable
g_cmdTable
[]
=
{
{
"exec "
,
1
,
10
,
DoExec
},
{
"exec "
,
1
,
10
,
DoExec
},
{
"mknode "
,
1
,
5
,
DoMakeNode
},
{
"mknode "
,
1
,
5
,
DoMakeNode
},
{
"makedev "
,
2
,
2
,
DoMakeDevice
},
{
"makedev "
,
2
,
2
,
DoMakeDevice
},
...
@@ -317,6 +317,6 @@ static const struct CmdTable CMD_TABLE[] = {
...
@@ -317,6 +317,6 @@ static const struct CmdTable CMD_TABLE[] = {
const
struct
CmdTable
*
GetCmdTable
(
int
*
number
)
const
struct
CmdTable
*
GetCmdTable
(
int
*
number
)
{
{
*
number
=
(
int
)
ARRAY_LENGTH
(
CMD_TABLE
);
*
number
=
(
int
)
ARRAY_LENGTH
(
g_cmdTable
);
return
CMD_TABLE
;
return
g_cmdTable
;
}
}
services/param/cmd/param_cmd.c
浏览文件 @
b6ef25b4
...
@@ -100,9 +100,9 @@ static void ExeuteCmdParamWait(int argc, char *argv[], int start)
...
@@ -100,9 +100,9 @@ static void ExeuteCmdParamWait(int argc, char *argv[], int start)
}
}
int
ret
=
SystemWaitParameter
(
argv
[
start
],
value
,
timeout
);
int
ret
=
SystemWaitParameter
(
argv
[
start
],
value
,
timeout
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
printf
(
"Param wait success "
);
printf
(
"Param wait success
\n
"
);
}
else
{
}
else
{
printf
(
"Param wait fail"
);
printf
(
"Param wait fail
\n
"
);
}
}
}
}
...
...
services/param/include/param_utils.h
浏览文件 @
b6ef25b4
...
@@ -40,7 +40,7 @@ typedef enum {
...
@@ -40,7 +40,7 @@ typedef enum {
#define IS_READY_ONLY(name) \
#define IS_READY_ONLY(name) \
((
strncmp
((
name
),
"const."
,
strlen
(
"const."
))
==
0
)
||
(
strncmp
((
name
),
"ro."
,
strlen
(
"ro."
))
==
0
))
((
strncmp
((
name
),
"const."
,
strlen
(
"const."
))
==
0
)
||
(
strncmp
((
name
),
"ro."
,
strlen
(
"ro."
))
==
0
))
#define PARAM_
CON
ST_PREFIX "persist."
#define PARAM_
PERSI
ST_PREFIX "persist."
#define SYS_POWER_CTRL "sys.powerctrl="
#define SYS_POWER_CTRL "sys.powerctrl="
#define OHOS_CTRL_START "ohos.ctl.start="
#define OHOS_CTRL_START "ohos.ctl.start="
...
...
services/param/service/param_persist.c
浏览文件 @
b6ef25b4
...
@@ -47,7 +47,7 @@ static int SavePersistParam(const WorkSpace *workSpace, const ParamTrieNode *nod
...
@@ -47,7 +47,7 @@ static int SavePersistParam(const WorkSpace *workSpace, const ParamTrieNode *nod
if
(
entry
==
NULL
)
{
if
(
entry
==
NULL
)
{
return
0
;
return
0
;
}
}
if
(
strncmp
(
entry
->
data
,
PARAM_
CONST_PREFIX
,
strlen
(
PARAM_CON
ST_PREFIX
))
!=
0
)
{
if
(
strncmp
(
entry
->
data
,
PARAM_
PERSIST_PREFIX
,
strlen
(
PARAM_PERSI
ST_PREFIX
))
!=
0
)
{
return
0
;
return
0
;
}
}
static
char
name
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
static
char
name
[
PARAM_NAME_LEN_MAX
]
=
{
0
};
...
@@ -71,7 +71,7 @@ static int BatchSavePersistParam(const WorkSpace *workSpace)
...
@@ -71,7 +71,7 @@ static int BatchSavePersistParam(const WorkSpace *workSpace)
PERSIST_SAVE_HANDLE
handle
;
PERSIST_SAVE_HANDLE
handle
;
int
ret
=
g_persistWorkSpace
.
persistParamOps
.
batchSaveBegin
(
&
handle
);
int
ret
=
g_persistWorkSpace
.
persistParamOps
.
batchSaveBegin
(
&
handle
);
PARAM_CHECK
(
ret
==
0
,
return
PARAM_CODE_INVALID_NAME
,
"Failed to save persist"
);
PARAM_CHECK
(
ret
==
0
,
return
PARAM_CODE_INVALID_NAME
,
"Failed to save persist"
);
ParamTrieNode
*
root
=
FindTrieNode
(
workSpace
,
PARAM_
CONST_PREFIX
,
strlen
(
PARAM_CON
ST_PREFIX
),
NULL
);
ParamTrieNode
*
root
=
FindTrieNode
(
workSpace
,
PARAM_
PERSIST_PREFIX
,
strlen
(
PARAM_PERSI
ST_PREFIX
),
NULL
);
ret
=
TraversalTrieNode
(
workSpace
,
root
,
SavePersistParam
,
handle
);
ret
=
TraversalTrieNode
(
workSpace
,
root
,
SavePersistParam
,
handle
);
g_persistWorkSpace
.
persistParamOps
.
batchSaveEnd
(
handle
);
g_persistWorkSpace
.
persistParamOps
.
batchSaveEnd
(
handle
);
PARAM_CHECK
(
ret
==
0
,
return
PARAM_CODE_INVALID_NAME
,
"Save persist param fail"
);
PARAM_CHECK
(
ret
==
0
,
return
PARAM_CODE_INVALID_NAME
,
"Save persist param fail"
);
...
@@ -117,10 +117,10 @@ int LoadPersistParam(ParamWorkSpace *workSpace)
...
@@ -117,10 +117,10 @@ int LoadPersistParam(ParamWorkSpace *workSpace)
if
(
g_persistWorkSpace
.
persistParamOps
.
load
!=
NULL
)
{
if
(
g_persistWorkSpace
.
persistParamOps
.
load
!=
NULL
)
{
ret
=
g_persistWorkSpace
.
persistParamOps
.
load
(
AddPersistParam
,
&
workSpace
->
paramSpace
);
ret
=
g_persistWorkSpace
.
persistParamOps
.
load
(
AddPersistParam
,
&
workSpace
->
paramSpace
);
PARAM_SET_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_LOADED
);
PARAM_SET_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_LOADED
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Failed to load persist param"
);
}
}
// 刷新新增的常量到persist
// save new persist param
BatchSavePersistParam
(
&
workSpace
->
paramSpace
);
ret
=
BatchSavePersistParam
(
&
workSpace
->
paramSpace
);
PARAM_CHECK
(
ret
==
0
,
return
ret
,
"Failed to load persist param"
);
return
0
;
return
0
;
}
}
...
@@ -133,14 +133,14 @@ PARAM_STATIC void TimerCallbackForSave(ParamTaskPtr timer, void *context)
...
@@ -133,14 +133,14 @@ PARAM_STATIC void TimerCallbackForSave(ParamTaskPtr timer, void *context)
if
(
!
PARAM_TEST_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_UPDATE
))
{
if
(
!
PARAM_TEST_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_UPDATE
))
{
return
;
return
;
}
}
BatchSavePersistParam
((
WorkSpace
*
)
context
);
(
void
)
BatchSavePersistParam
((
WorkSpace
*
)
context
);
}
}
int
WritePersistParam
(
ParamWorkSpace
*
workSpace
,
const
char
*
name
,
const
char
*
value
)
int
WritePersistParam
(
ParamWorkSpace
*
workSpace
,
const
char
*
name
,
const
char
*
value
)
{
{
PARAM_CHECK
(
workSpace
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid workSpace"
);
PARAM_CHECK
(
workSpace
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid workSpace"
);
PARAM_CHECK
(
value
!=
NULL
&&
name
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param"
);
PARAM_CHECK
(
value
!=
NULL
&&
name
!=
NULL
,
return
PARAM_CODE_INVALID_PARAM
,
"Invalid param"
);
if
(
strncmp
(
name
,
PARAM_
CONST_PREFIX
,
strlen
(
PARAM_CON
ST_PREFIX
))
!=
0
)
{
if
(
strncmp
(
name
,
PARAM_
PERSIST_PREFIX
,
strlen
(
PARAM_PERSI
ST_PREFIX
))
!=
0
)
{
return
0
;
return
0
;
}
}
if
(
!
PARAM_TEST_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_LOADED
))
{
if
(
!
PARAM_TEST_FLAG
(
g_persistWorkSpace
.
flags
,
WORKSPACE_FLAGS_LOADED
))
{
...
...
services/test/unittest/param/client_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -21,9 +21,7 @@
...
@@ -21,9 +21,7 @@
using
namespace
std
;
using
namespace
std
;
int
g_testPermissionResult
=
DAC_RESULT_PERMISSION
;
static
int
g_testPermissionResult
=
DAC_RESULT_PERMISSION
;
static
const
int
THREAD_NUM_TEST
=
2
;
static
void
ClientCheckParamValue
(
const
char
*
name
,
const
char
*
expectValue
)
static
void
ClientCheckParamValue
(
const
char
*
name
,
const
char
*
expectValue
)
{
{
char
tmp
[
PARAM_BUFFER_SIZE
]
=
{
0
};
char
tmp
[
PARAM_BUFFER_SIZE
]
=
{
0
};
...
@@ -61,8 +59,9 @@ static void *TestSendParamWaitMsg(void *args)
...
@@ -61,8 +59,9 @@ static void *TestSendParamWaitMsg(void *args)
static
void
TestForMultiThread
()
static
void
TestForMultiThread
()
{
{
static
const
int
threadMaxNumer
=
2
;
printf
(
"TestForMultiThread
\n
"
);
printf
(
"TestForMultiThread
\n
"
);
pthread_t
tids
[
THREAD_NUM_TEST
+
THREAD_NUM_TEST
];
pthread_t
tids
[
threadMaxNumer
+
threadMaxNumer
];
const
char
*
names
[]
=
{
const
char
*
names
[]
=
{
"thread.1111.2222.3333.4444.5555"
,
"thread.1111.2222.3333.4444.5555"
,
"thread.2222.1111.2222.3333.4444"
,
"thread.2222.1111.2222.3333.4444"
,
...
@@ -70,13 +69,13 @@ static void TestForMultiThread()
...
@@ -70,13 +69,13 @@ static void TestForMultiThread()
"thread.4444.5555.1111.2222.3333"
,
"thread.4444.5555.1111.2222.3333"
,
"thread.5555.1111.2222.3333.4444"
"thread.5555.1111.2222.3333.4444"
};
};
for
(
size_t
i
=
0
;
i
<
THREAD_NUM_TEST
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
threadMaxNumer
;
i
++
)
{
pthread_create
(
&
tids
[
i
],
nullptr
,
TestSendParamSetMsg
,
(
void
*
)
names
[
i
%
ARRAY_LENGTH
(
names
)]);
pthread_create
(
&
tids
[
i
],
nullptr
,
TestSendParamSetMsg
,
(
void
*
)
names
[
i
%
ARRAY_LENGTH
(
names
)]);
}
}
for
(
size_t
i
=
THREAD_NUM_TEST
;
i
<
THREAD_NUM_TEST
+
THREAD_NUM_TEST
;
i
++
)
{
for
(
size_t
i
=
threadMaxNumer
;
i
<
threadMaxNumer
+
threadMaxNumer
;
i
++
)
{
pthread_create
(
&
tids
[
i
],
nullptr
,
TestSendParamWaitMsg
,
(
void
*
)
names
[
i
%
ARRAY_LENGTH
(
names
)]);
pthread_create
(
&
tids
[
i
],
nullptr
,
TestSendParamWaitMsg
,
(
void
*
)
names
[
i
%
ARRAY_LENGTH
(
names
)]);
}
}
for
(
size_t
i
=
0
;
i
<
THREAD_NUM_TEST
+
THREAD_NUM_TEST
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
threadMaxNumer
+
threadMaxNumer
;
i
++
)
{
pthread_join
(
tids
[
i
],
nullptr
);
pthread_join
(
tids
[
i
],
nullptr
);
}
}
}
}
...
@@ -199,11 +198,11 @@ void TestClient(int index)
...
@@ -199,11 +198,11 @@ void TestClient(int index)
case
0
:
{
case
0
:
{
ParamWorkSpace
*
space
=
GetClientParamWorkSpace
();
ParamWorkSpace
*
space
=
GetClientParamWorkSpace
();
if
(
space
!=
nullptr
&&
space
->
securityLabel
!=
nullptr
)
{
if
(
space
!=
nullptr
&&
space
->
securityLabel
!=
nullptr
)
{
space
->
securityLabel
->
cred
.
uid
=
TEST_UID
;
space
->
securityLabel
->
cred
.
uid
=
1000
;
// 1000 test uid
space
->
securityLabel
->
cred
.
gid
=
TEST_UID
;
space
->
securityLabel
->
cred
.
gid
=
1000
;
// 1000 test gid
}
}
}
}
case
1
:
{
//
se
t
case
1
:
{
//
1 set tes
t
SystemSetParameter
(
name
.
c_str
(),
value
.
c_str
());
SystemSetParameter
(
name
.
c_str
(),
value
.
c_str
());
ClientCheckParamValue
(
name
.
c_str
(),
value
.
c_str
());
ClientCheckParamValue
(
name
.
c_str
(),
value
.
c_str
());
SystemWaitParameter
(
name
.
c_str
(),
value
.
c_str
(),
1
);
SystemWaitParameter
(
name
.
c_str
(),
value
.
c_str
(),
1
);
...
@@ -213,7 +212,7 @@ void TestClient(int index)
...
@@ -213,7 +212,7 @@ void TestClient(int index)
SystemWaitParameter
(
name
.
c_str
(),
nullptr
,
0
);
SystemWaitParameter
(
name
.
c_str
(),
nullptr
,
0
);
break
;
break
;
}
}
case
2
:
{
//
find
case
2
:
{
//
3 api test
ParamHandle
handle
;
ParamHandle
handle
;
uint32_t
size
=
PARAM_BUFFER_SIZE
;
uint32_t
size
=
PARAM_BUFFER_SIZE
;
int
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
int
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
...
@@ -231,11 +230,11 @@ void TestClient(int index)
...
@@ -231,11 +230,11 @@ void TestClient(int index)
EXPECT_EQ
(
strcmp
(
testBuffer
,
value
.
c_str
()),
0
);
EXPECT_EQ
(
strcmp
(
testBuffer
,
value
.
c_str
()),
0
);
break
;
break
;
}
}
case
3
:
//
Traversal
case
3
:
//
3 Traversal test
TestParamTraversal
();
TestParamTraversal
();
SystemDumpParameters
(
1
);
SystemDumpParameters
(
1
);
break
;
break
;
case
4
:
{
//
watcher
case
4
:
{
//
4 watcher test
int
ret
=
WatchParamCheck
(
name
.
c_str
());
int
ret
=
WatchParamCheck
(
name
.
c_str
());
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
ret
=
WatchParamCheck
(
"&&&&&.test.tttt"
);
ret
=
WatchParamCheck
(
"&&&&&.test.tttt"
);
...
@@ -246,7 +245,7 @@ void TestClient(int index)
...
@@ -246,7 +245,7 @@ void TestClient(int index)
TestCmd
();
TestCmd
();
break
;
break
;
}
}
case
5
:
//
multi
case
5
:
//
5 multi thread test
TestForMultiThread
();
TestForMultiThread
();
break
;
break
;
default:
default:
...
...
services/test/unittest/param/dac_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -182,19 +182,19 @@ private:
...
@@ -182,19 +182,19 @@ private:
ParamSecurityOps
clientParamSercurityOps
;
ParamSecurityOps
clientParamSercurityOps
;
};
};
HWTEST_F
(
ParamDacTest
,
TestDacGetLabel
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacGetLabel
,
TestSize
.
Level
0
)
{
{
ParamDacTest
test
;
ParamDacTest
test
;
test
.
TestDacGetLabel
();
test
.
TestDacGetLabel
();
}
}
HWTEST_F
(
ParamDacTest
,
TestDacInitLocalLabel
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacInitLocalLabel
,
TestSize
.
Level
0
)
{
{
ParamDacTest
test
;
ParamDacTest
test
;
test
.
TestDacInitLocalLabel
();
test
.
TestDacInitLocalLabel
();
}
}
HWTEST_F
(
ParamDacTest
,
TestDacLabelEncode
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacLabelEncode
,
TestSize
.
Level
0
)
{
{
ParamDacTest
test
;
ParamDacTest
test
;
std
::
vector
<
char
>
buffer
;
std
::
vector
<
char
>
buffer
;
...
@@ -203,13 +203,13 @@ HWTEST_F(ParamDacTest, TestDacLabelEncode, TestSize.Level1)
...
@@ -203,13 +203,13 @@ HWTEST_F(ParamDacTest, TestDacLabelEncode, TestSize.Level1)
test
.
TestDecode
(
&
label
,
buffer
);
test
.
TestDecode
(
&
label
,
buffer
);
}
}
HWTEST_F
(
ParamDacTest
,
TestDacCheckFilePermission
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacCheckFilePermission
,
TestSize
.
Level
0
)
{
{
ParamDacTest
test
;
ParamDacTest
test
;
test
.
TestDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
test
.
TestDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
}
}
HWTEST_F
(
ParamDacTest
,
TestDacCheckUserParaPermission
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacCheckUserParaPermission
,
TestSize
.
Level
0
)
{
{
// 相同用户
// 相同用户
ParamDacTest
test
;
ParamDacTest
test
;
...
@@ -250,7 +250,7 @@ HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level1)
...
@@ -250,7 +250,7 @@ HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level1)
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
HWTEST_F
(
ParamDacTest
,
TestDacCheckGroupParaPermission
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacCheckGroupParaPermission
,
TestSize
.
Level
0
)
{
{
// 相同组
// 相同组
ParamDacTest
test
;
ParamDacTest
test
;
...
@@ -291,7 +291,7 @@ HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level1)
...
@@ -291,7 +291,7 @@ HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level1)
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
HWTEST_F
(
ParamDacTest
,
TestDacCheckOtherParaPermission
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestDacCheckOtherParaPermission
,
TestSize
.
Level
0
)
{
{
// 其他用户
// 其他用户
ParamDacTest
test
;
ParamDacTest
test
;
...
@@ -332,7 +332,7 @@ HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level1)
...
@@ -332,7 +332,7 @@ HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level1)
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
HWTEST_F
(
ParamDacTest
,
TestClientDacCheckFilePermission
,
TestSize
.
Level
1
)
HWTEST_F
(
ParamDacTest
,
TestClientDacCheckFilePermission
,
TestSize
.
Level
0
)
{
{
ParamDacTest
test
;
ParamDacTest
test
;
test
.
TestClientDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
test
.
TestClientDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
...
...
services/test/unittest/param/param_stub.h
浏览文件 @
b6ef25b4
...
@@ -32,12 +32,6 @@ extern int RunParamCommand(int argc, char *argv[]);
...
@@ -32,12 +32,6 @@ extern int RunParamCommand(int argc, char *argv[]);
#endif
#endif
#endif
#endif
static
const
int
TEST_UID
=
1000
;
static
const
int
TEST_GID
=
9999
;
static
const
int
TEST_DAC_GID
=
2002
;
static
const
int
TEST_DAC_GID2
=
2003
;
static
const
int
TEST_READ_AND_WRITE
=
0666
;
void
TestClient
(
int
index
);
void
TestClient
(
int
index
);
int
TestEncodeSecurityLabel
(
const
ParamSecurityLabel
*
srcLabel
,
char
*
buffer
,
uint32_t
*
bufferSize
);
int
TestEncodeSecurityLabel
(
const
ParamSecurityLabel
*
srcLabel
,
char
*
buffer
,
uint32_t
*
bufferSize
);
int
TestDecodeSecurityLabel
(
ParamSecurityLabel
**
srcLabel
,
const
char
*
buffer
,
uint32_t
bufferSize
);
int
TestDecodeSecurityLabel
(
ParamSecurityLabel
**
srcLabel
,
const
char
*
buffer
,
uint32_t
bufferSize
);
...
...
services/test/unittest/param/param_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -40,10 +40,10 @@ extern void TimerCallbackForSave(ParamTaskPtr timer, void *context);
...
@@ -40,10 +40,10 @@ extern void TimerCallbackForSave(ParamTaskPtr timer, void *context);
}
}
static
ParamTask
*
g_worker
=
nullptr
;
static
ParamTask
*
g_worker
=
nullptr
;
class
Param
Service
Test
:
public
::
testing
::
Test
{
class
Param
Unit
Test
:
public
::
testing
::
Test
{
public:
public:
Param
Service
Test
()
{}
Param
Unit
Test
()
{}
virtual
~
Param
Service
Test
()
{}
virtual
~
Param
Unit
Test
()
{}
void
SetUp
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
void
TearDown
()
{}
...
@@ -81,7 +81,7 @@ public:
...
@@ -81,7 +81,7 @@ public:
int
TestAddSecurityLabel1
()
int
TestAddSecurityLabel1
()
{
{
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
TEST_GID
;
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
9999
;
// 9999 test gid
const
char
*
name
=
"label1.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
name
=
"label1.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
value
=
"2001"
;
const
char
*
value
=
"2001"
;
uint32_t
labelIndex
=
0
;
uint32_t
labelIndex
=
0
;
...
@@ -100,15 +100,15 @@ public:
...
@@ -100,15 +100,15 @@ public:
// 添加一个label,最长匹配到这个节点
// 添加一个label,最长匹配到这个节点
int
TestAddSecurityLabel2
()
int
TestAddSecurityLabel2
()
{
{
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
TEST_GID
;
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
9999
;
// 9999 test gid
const
char
*
name
=
"label2.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
name
=
"label2.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
value
=
"2001"
;
const
char
*
value
=
"2001"
;
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"label2.test.aaa"
;
auditData
.
name
=
"label2.test.aaa"
;
auditData
.
label
=
"label2.test.aaa"
;
auditData
.
label
=
"label2.test.aaa"
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
mode
=
TEST_READ_AND_WRITE
;
auditData
.
dacData
.
mode
=
0666
;
// 0666 test mode
SystemWriteParam
(
name
,
value
);
SystemWriteParam
(
name
,
value
);
uint32_t
labelIndex
=
0
;
uint32_t
labelIndex
=
0
;
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
...
@@ -124,23 +124,23 @@ public:
...
@@ -124,23 +124,23 @@ public:
// 添加一个label,最长匹配到最后一个相同节点
// 添加一个label,最长匹配到最后一个相同节点
int
TestAddSecurityLabel3
()
int
TestAddSecurityLabel3
()
{
{
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
TEST_GID
;
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
9999
;
// 9999 test gid
const
char
*
name
=
"label3.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
name
=
"label3.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
value
=
"2001"
;
const
char
*
value
=
"2001"
;
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"label3.test.aaa"
;
auditData
.
name
=
"label3.test.aaa"
;
auditData
.
label
=
"label3.test.aaa"
;
auditData
.
label
=
"label3.test.aaa"
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID2
;
auditData
.
dacData
.
gid
=
203
;
// 203 test gid
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
mode
=
TEST_READ_AND_WRITE
;
auditData
.
dacData
.
mode
=
0666
;
// 0666 test mode
SystemWriteParam
(
name
,
value
);
SystemWriteParam
(
name
,
value
);
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
auditData
.
name
=
"label3.test.aaa.bbb.ccc.dddd.eee.dddd"
;
auditData
.
name
=
"label3.test.aaa.bbb.ccc.dddd.eee.dddd"
;
auditData
.
label
=
"label3.test.aaa.bbb.ccc.dddd.eee.dddd"
;
auditData
.
label
=
"label3.test.aaa.bbb.ccc.dddd.eee.dddd"
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
mode
=
TEST_READ_AND_WRITE
;
auditData
.
dacData
.
mode
=
0666
;
// 0666 test mode
SystemWriteParam
(
name
,
value
);
SystemWriteParam
(
name
,
value
);
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
...
@@ -150,22 +150,22 @@ public:
...
@@ -150,22 +150,22 @@ public:
if
(
paramNode
==
nullptr
||
node
==
nullptr
)
{
if
(
paramNode
==
nullptr
||
node
==
nullptr
)
{
EXPECT_EQ
(
1
,
0
);
EXPECT_EQ
(
1
,
0
);
}
}
EXPECT_EQ
((
int
)
node
->
gid
,
TEST_DAC_GID2
);
EXPECT_EQ
((
int
)
node
->
gid
,
203
);
// 203 test gid
return
0
;
return
0
;
}
}
// 添加一个label,完全匹配
// 添加一个label,完全匹配
int
TestAddSecurityLabel4
()
int
TestAddSecurityLabel4
()
{
{
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
TEST_GID
;
GetParamWorkSpace
()
->
securityLabel
->
cred
.
gid
=
9999
;
// 9999 test gid
const
char
*
name
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
name
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
const
char
*
value
=
"2001"
;
const
char
*
value
=
"2001"
;
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
auditData
.
name
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
auditData
.
label
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
auditData
.
label
=
"label4.test.aaa.bbb.ccc.dddd.eee"
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID2
;
auditData
.
dacData
.
gid
=
203
;
// 203 test gid
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
uid
=
geteuid
();
auditData
.
dacData
.
mode
=
TEST_READ_AND_WRITE
;
auditData
.
dacData
.
mode
=
0666
;
// 0666 test mode
SystemWriteParam
(
name
,
value
);
SystemWriteParam
(
name
,
value
);
uint32_t
labelIndex
=
0
;
uint32_t
labelIndex
=
0
;
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
...
@@ -461,8 +461,8 @@ public:
...
@@ -461,8 +461,8 @@ public:
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
label
=
""
;
auditData
.
label
=
""
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
uid
=
TEST_DAC_GID
;
auditData
.
dacData
.
uid
=
202
;
// 202 test dac uid
auditData
.
dacData
.
mode
=
mode
;
auditData
.
dacData
.
mode
=
mode
;
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
return
SystemWriteParam
(
"ohos.ctl.start"
,
serviceName
);
return
SystemWriteParam
(
"ohos.ctl.start"
,
serviceName
);
...
@@ -474,29 +474,29 @@ public:
...
@@ -474,29 +474,29 @@ public:
ParamAuditData
auditData
=
{};
ParamAuditData
auditData
=
{};
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
name
=
"ohos.servicectrl."
;
auditData
.
label
=
""
;
auditData
.
label
=
""
;
auditData
.
dacData
.
gid
=
TEST_DAC_GID
;
auditData
.
dacData
.
gid
=
202
;
// 202 test dac gid
auditData
.
dacData
.
uid
=
TEST_DAC_GID
;
auditData
.
dacData
.
uid
=
202
;
// 202 test dac uid
auditData
.
dacData
.
mode
=
mode
;
auditData
.
dacData
.
mode
=
mode
;
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
AddSecurityLabel
(
&
auditData
,
GetParamWorkSpace
());
return
SystemWriteParam
(
"sys.powerctrl"
,
reboot
);
return
SystemWriteParam
(
"sys.powerctrl"
,
reboot
);
}
}
};
};
HWTEST_F
(
Param
ServiceTest
,
TestParamServiceInit
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestParamServiceInit
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestParamServiceInit
();
test
.
TestParamServiceInit
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestPersistParam
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestPersistParam
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestPersistParam
();
test
.
TestPersistParam
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestSetParam_1
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestSetParam_1
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
const
char
*
params
[][
2
]
=
{
{
"111.2222"
,
"1"
},
const
char
*
params
[][
2
]
=
{
{
"111.2222"
,
"1"
},
{
"111.2222.3333"
,
"2"
},
{
"111.2222.3333"
,
"2"
},
{
"111.2222.3333.4444"
,
"3"
},
{
"111.2222.3333.4444"
,
"3"
},
...
@@ -505,9 +505,9 @@ HWTEST_F(ParamServiceTest, TestSetParam_1, TestSize.Level1)
...
@@ -505,9 +505,9 @@ HWTEST_F(ParamServiceTest, TestSetParam_1, TestSize.Level1)
test
.
TestSetParams
(
params
,
5
);
test
.
TestSetParams
(
params
,
5
);
}
}
HWTEST_F
(
Param
ServiceTest
,
TestSetParam_2
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestSetParam_2
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
const
char
*
params
[][
2
]
=
{
{
"111.2222.xxxx.xxx.xxx"
,
"1_1"
},
const
char
*
params
[][
2
]
=
{
{
"111.2222.xxxx.xxx.xxx"
,
"1_1"
},
{
"111.2222.3333.xxx"
,
"1_2"
},
{
"111.2222.3333.xxx"
,
"1_2"
},
{
"111.2222.xxxx.3333.4444"
,
"1_3"
},
{
"111.2222.xxxx.3333.4444"
,
"1_3"
},
...
@@ -530,39 +530,39 @@ HWTEST_F(ParamServiceTest, TestSetParam_2, TestSize.Level1)
...
@@ -530,39 +530,39 @@ HWTEST_F(ParamServiceTest, TestSetParam_2, TestSize.Level1)
test
.
TestSetParams
(
sysParams
,
5
);
test
.
TestSetParams
(
sysParams
,
5
);
}
}
HWTEST_F
(
Param
ServiceTest
,
TestNameIsValid
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestNameIsValid
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestNameIsValid
();
test
.
TestNameIsValid
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddSecurityLabel1
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddSecurityLabel1
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddSecurityLabel1
();
test
.
TestAddSecurityLabel1
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddSecurityLabel2
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddSecurityLabel2
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddSecurityLabel2
();
test
.
TestAddSecurityLabel2
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddSecurityLabel3
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddSecurityLabel3
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddSecurityLabel3
();
test
.
TestAddSecurityLabel3
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddSecurityLabel4
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddSecurityLabel4
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddSecurityLabel4
();
test
.
TestAddSecurityLabel4
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestUpdateParam
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestUpdateParam
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"100"
);
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"100"
);
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"101"
);
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"101"
);
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"102"
);
test
.
TestUpdateParam
(
"test.aaa.bbb.ccc.ddd"
,
"102"
);
...
@@ -570,79 +570,79 @@ HWTEST_F(ParamServiceTest, TestUpdateParam, TestSize.Level1)
...
@@ -570,79 +570,79 @@ HWTEST_F(ParamServiceTest, TestUpdateParam, TestSize.Level1)
test
.
TestUpdateParam
(
"net.tcp.default_init_rwnd"
,
"60"
);
test
.
TestUpdateParam
(
"net.tcp.default_init_rwnd"
,
"60"
);
}
}
HWTEST_F
(
Param
ServiceTest
,
TestServiceProcessMessage
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestServiceProcessMessage
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestServiceProcessMessage
(
"wertt.qqqq.wwww.rrrr"
,
"wwww.eeeee"
,
1
);
test
.
TestServiceProcessMessage
(
"wertt.qqqq.wwww.rrrr"
,
"wwww.eeeee"
,
1
);
test
.
TestServiceProcessMessage
(
"wertt.2222.wwww.3333"
,
"wwww.eeeee"
,
0
);
test
.
TestServiceProcessMessage
(
"wertt.2222.wwww.3333"
,
"wwww.eeeee"
,
0
);
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWait1
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWait1
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWait1
();
test
.
TestAddParamWait1
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWait2
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWait2
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWait2
();
test
.
TestAddParamWait2
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWait3
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWait3
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWait3
();
test
.
TestAddParamWait3
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWatch1
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWatch1
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWatch1
();
test
.
TestAddParamWatch1
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWatch2
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWatch2
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWatch2
();
test
.
TestAddParamWatch2
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestAddParamWatch3
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestAddParamWatch3
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestAddParamWatch3
();
test
.
TestAddParamWatch3
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestCloseTriggerWatch
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestCloseTriggerWatch
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestCloseTriggerWatch
();
test
.
TestCloseTriggerWatch
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestParamTraversal
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestParamTraversal
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestParamTraversal
();
test
.
TestParamTraversal
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestDumpParamMemory
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestDumpParamMemory
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
test
.
TestDumpParamMemory
();
test
.
TestDumpParamMemory
();
}
}
HWTEST_F
(
Param
ServiceTest
,
TestServiceCtrl
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestServiceCtrl
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
int
ret
=
test
.
TestServiceCtrl
(
"server1"
,
0770
);
int
ret
=
test
.
TestServiceCtrl
(
"server1"
,
0770
);
EXPECT_NE
(
ret
,
0
);
EXPECT_NE
(
ret
,
0
);
ret
=
test
.
TestServiceCtrl
(
"server2"
,
0772
);
ret
=
test
.
TestServiceCtrl
(
"server2"
,
0772
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
HWTEST_F
(
Param
ServiceTest
,
TestPowerCtrl
,
TestSize
.
Level1
)
HWTEST_F
(
Param
UnitTest
,
TestPowerCtrl
,
TestSize
.
Level0
)
{
{
Param
Service
Test
test
;
Param
Unit
Test
test
;
int
ret
=
test
.
TestPowerCtrl
(
"reboot,shutdown"
,
0770
);
int
ret
=
test
.
TestPowerCtrl
(
"reboot,shutdown"
,
0770
);
EXPECT_NE
(
ret
,
0
);
EXPECT_NE
(
ret
,
0
);
ret
=
test
.
TestPowerCtrl
(
"reboot,shutdown"
,
0772
);
ret
=
test
.
TestPowerCtrl
(
"reboot,shutdown"
,
0772
);
...
...
services/test/unittest/param/selinux_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -35,10 +35,10 @@ static int SecurityLabelGet(const ParamAuditData *auditData, void *context)
...
@@ -35,10 +35,10 @@ static int SecurityLabelGet(const ParamAuditData *auditData, void *context)
return
0
;
return
0
;
}
}
class
ParamSelinux
Test
:
public
::
testing
::
Test
{
class
SelinuxUnit
Test
:
public
::
testing
::
Test
{
public:
public:
ParamSelinux
Test
()
{}
SelinuxUnit
Test
()
{}
virtual
~
ParamSelinux
Test
()
{}
virtual
~
SelinuxUnit
Test
()
{}
void
SetUp
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
void
TearDown
()
{}
...
@@ -237,46 +237,46 @@ private:
...
@@ -237,46 +237,46 @@ private:
ParamSecurityOps
clientParamSercurityOps
;
ParamSecurityOps
clientParamSercurityOps
;
};
};
HWTEST_F
(
ParamSelinuxTest
,
TestSelinuxGetLabel
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestSelinuxGetLabel
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestSelinuxGetLabel
();
test
.
TestSelinuxGetLabel
();
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestSelinuxInitLocalLabel
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestSelinuxInitLocalLabel
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestSelinuxInitLocalLabel
();
test
.
TestSelinuxInitLocalLabel
();
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestSelinuxCheckFilePermission
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestSelinuxCheckFilePermission
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestSelinuxCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
test
.
TestSelinuxCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestSelinuxCheckParaPermission
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestSelinuxCheckParaPermission
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestSelinuxCheckParaPermission
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
test
.
TestSelinuxCheckParaPermission
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestClientDacCheckFilePermission
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestClientDacCheckFilePermission
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestClientSelinuxCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
test
.
TestClientSelinuxCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestClientDacCheckParaPermission
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestClientDacCheckParaPermission
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
test
.
TestClientSelinuxCheckParaPermissionWrite
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
test
.
TestClientSelinuxCheckParaPermissionWrite
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
test
.
TestClientSelinuxCheckParaPermissionRead
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
test
.
TestClientSelinuxCheckParaPermissionRead
(
"aaa.bbb.bbb.ccc"
,
"user:group1:r"
);
}
}
HWTEST_F
(
ParamSelinuxTest
,
TestSeliniuxLabelEncode
,
TestSize
.
Level1
)
HWTEST_F
(
SelinuxUnitTest
,
TestSeliniuxLabelEncode
,
TestSize
.
Level0
)
{
{
ParamSelinux
Test
test
;
SelinuxUnit
Test
test
;
std
::
vector
<
char
>
buffer
;
std
::
vector
<
char
>
buffer
;
ParamSecurityLabel
*
label
;
ParamSecurityLabel
*
label
;
test
.
TestEncode
(
label
,
buffer
);
test
.
TestEncode
(
label
,
buffer
);
...
...
services/test/unittest/param/trigger_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -66,10 +66,10 @@ static int TestTriggerExecute(TriggerNode *trigger, const char *content, uint32_
...
@@ -66,10 +66,10 @@ static int TestTriggerExecute(TriggerNode *trigger, const char *content, uint32_
return
0
;
return
0
;
}
}
class
TriggerTest
:
public
::
testing
::
Test
{
class
Trigger
Unit
Test
:
public
::
testing
::
Test
{
public:
public:
TriggerTest
()
{}
Trigger
Unit
Test
()
{}
virtual
~
TriggerTest
()
{}
virtual
~
Trigger
Unit
Test
()
{}
void
SetUp
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
void
TearDown
()
{}
...
@@ -485,111 +485,111 @@ public:
...
@@ -485,111 +485,111 @@ public:
}
}
};
};
HWTEST_F
(
Trigger
Test
,
TestLoadTrigger
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestLoadTrigger
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestLoadTrigger
();
test
.
TestLoadTrigger
();
}
}
HWTEST_F
(
Trigger
Test
,
TestBootEvent
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestBootEvent
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestBootEvent
(
"pre-init"
);
test
.
TestBootEvent
(
"pre-init"
);
test
.
TestBootEvent
(
"init"
);
test
.
TestBootEvent
(
"init"
);
test
.
TestBootEvent
(
"post-init"
);
test
.
TestBootEvent
(
"post-init"
);
test
.
TestBootEvent
(
"early-init"
);
test
.
TestBootEvent
(
"early-init"
);
}
}
HWTEST_F
(
Trigger
Test
,
TestAddTriggerForBoot
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestAddTriggerForBoot
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestAddTriggerForBoot
();
test
.
TestAddTriggerForBoot
();
}
}
HWTEST_F
(
Trigger
Test
,
TestAddTriggerForParm
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestAddTriggerForParm
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestAddTriggerForParm
();
test
.
TestAddTriggerForParm
();
}
}
HWTEST_F
(
Trigger
Test
,
TestCheckParamTrigger1
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestCheckParamTrigger1
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestCheckParamTrigger1
();
test
.
TestCheckParamTrigger1
();
}
}
HWTEST_F
(
Trigger
Test
,
TestCheckParamTrigger2
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestCheckParamTrigger2
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestCheckParamTrigger2
();
test
.
TestCheckParamTrigger2
();
}
}
HWTEST_F
(
Trigger
Test
,
TestCheckParamTrigger3
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestCheckParamTrigger3
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestCheckParamTrigger3
();
test
.
TestCheckParamTrigger3
();
}
}
HWTEST_F
(
Trigger
Test
,
TestCheckParamTrigger4
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestCheckParamTrigger4
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestCheckParamTrigger4
();
test
.
TestCheckParamTrigger4
();
}
}
HWTEST_F
(
Trigger
Test
,
TestCheckParamTrigger5
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestCheckParamTrigger5
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestCheckParamTrigger5
();
test
.
TestCheckParamTrigger5
();
}
}
HWTEST_F
(
Trigger
Test
,
TestParamEvent
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestParamEvent
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestParamEvent
();
test
.
TestParamEvent
();
}
}
HWTEST_F
(
Trigger
Test
,
ComputerCondition
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
ComputerCondition
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestComputeCondition
(
"aaa=111||aaa=222||aaa=333"
);
test
.
TestComputeCondition
(
"aaa=111||aaa=222||aaa=333"
);
test
.
TestComputeCondition
(
"aaa=111||aaa=222&&aaa=333"
);
test
.
TestComputeCondition
(
"aaa=111||aaa=222&&aaa=333"
);
test
.
TestComputeCondition
(
"(aaa=111||aaa=222)&&aaa=333"
);
test
.
TestComputeCondition
(
"(aaa=111||aaa=222)&&aaa=333"
);
test
.
TestComputeCondition
(
"aaa=111||(aaa=222&&aaa=333)"
);
test
.
TestComputeCondition
(
"aaa=111||(aaa=222&&aaa=333)"
);
}
}
HWTEST_F
(
Trigger
Test
,
TestExecuteParamTrigger1
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestExecuteParamTrigger1
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestExecuteParamTrigger1
();
test
.
TestExecuteParamTrigger1
();
}
}
HWTEST_F
(
Trigger
Test
,
TestExecuteParamTrigger2
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestExecuteParamTrigger2
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestExecuteParamTrigger2
();
test
.
TestExecuteParamTrigger2
();
}
}
HWTEST_F
(
Trigger
Test
,
TestExecuteParamTrigger3
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestExecuteParamTrigger3
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestExecuteParamTrigger3
();
test
.
TestExecuteParamTrigger3
();
}
}
HWTEST_F
(
Trigger
Test
,
TestExecuteParamTrigger4
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestExecuteParamTrigger4
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestExecuteParamTrigger4
();
test
.
TestExecuteParamTrigger4
();
}
}
HWTEST_F
(
Trigger
Test
,
TestExecuteParamTrigger5
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestExecuteParamTrigger5
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
test
.
TestExecuteParamTrigger5
();
test
.
TestExecuteParamTrigger5
();
}
}
HWTEST_F
(
Trigger
Test
,
TestRunClient
,
TestSize
.
Level1
)
HWTEST_F
(
Trigger
UnitTest
,
TestRunClient
,
TestSize
.
Level0
)
{
{
TriggerTest
test
;
Trigger
Unit
Test
test
;
int
ret
=
test
.
TestRunClient
();
int
ret
=
test
.
TestRunClient
();
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
ret
,
0
);
}
}
\ No newline at end of file
services/test/unittest/param/watcher_agent_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -38,10 +38,10 @@ void TestParameterChange(const char *key, const char *value, void *context)
...
@@ -38,10 +38,10 @@ void TestParameterChange(const char *key, const char *value, void *context)
printf
(
"TestParameterChange key:%s %s"
,
key
,
value
);
printf
(
"TestParameterChange key:%s %s"
,
key
,
value
);
}
}
class
WatcherAgentTest
:
public
::
testing
::
Test
{
class
WatcherAgent
Unit
Test
:
public
::
testing
::
Test
{
public:
public:
WatcherAgentTest
()
{}
WatcherAgent
Unit
Test
()
{}
virtual
~
WatcherAgentTest
()
{}
virtual
~
WatcherAgent
Unit
Test
()
{}
void
SetUp
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
void
TearDown
()
{}
...
@@ -113,26 +113,26 @@ public:
...
@@ -113,26 +113,26 @@ public:
}
}
};
};
HWTEST_F
(
WatcherAgent
Test
,
TestAddWatcher
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherAgent
UnitTest
,
TestAddWatcher
,
TestSize
.
Level0
)
{
{
WatcherAgentTest
test
;
WatcherAgent
Unit
Test
test
;
test
.
TestAddWatcher
();
test
.
TestAddWatcher
();
}
}
HWTEST_F
(
WatcherAgent
Test
,
TestRecvMessage
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherAgent
UnitTest
,
TestRecvMessage
,
TestSize
.
Level0
)
{
{
WatcherAgentTest
test
;
WatcherAgent
Unit
Test
test
;
test
.
TestRecvMessage
(
"test.permission.watcher.agent.test1"
);
test
.
TestRecvMessage
(
"test.permission.watcher.agent.test1"
);
}
}
HWTEST_F
(
WatcherAgent
Test
,
TestDelWatcher
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherAgent
UnitTest
,
TestDelWatcher
,
TestSize
.
Level0
)
{
{
WatcherAgentTest
test
;
WatcherAgent
Unit
Test
test
;
test
.
TestDelWatcher
();
test
.
TestDelWatcher
();
}
}
HWTEST_F
(
WatcherAgent
Test
,
TestResetService
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherAgent
UnitTest
,
TestResetService
,
TestSize
.
Level0
)
{
{
WatcherAgentTest
test
;
WatcherAgent
Unit
Test
test
;
test
.
TestResetService
();
test
.
TestResetService
();
}
}
\ No newline at end of file
services/test/unittest/param/watcher_proxy_unittest.cpp
浏览文件 @
b6ef25b4
...
@@ -53,10 +53,10 @@ public:
...
@@ -53,10 +53,10 @@ public:
using
WatcherManagerPtr
=
WatcherManager
*
;
using
WatcherManagerPtr
=
WatcherManager
*
;
WatcherManagerPtr
g_watcherManager
{
nullptr
};
WatcherManagerPtr
g_watcherManager
{
nullptr
};
class
WatcherProxyTest
:
public
::
testing
::
Test
{
class
WatcherProxy
Unit
Test
:
public
::
testing
::
Test
{
public:
public:
WatcherProxyTest
()
{}
WatcherProxy
Unit
Test
()
{}
virtual
~
WatcherProxyTest
()
{}
virtual
~
WatcherProxy
Unit
Test
()
{}
void
SetUp
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
void
TearDown
()
{}
...
@@ -150,57 +150,57 @@ public:
...
@@ -150,57 +150,57 @@ public:
}
}
};
};
HWTEST_F
(
WatcherProxy
Test
,
TestAddWatcher
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestAddWatcher
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
test
.
TestAddWatcher
(
"test.permission.watcher.test1"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test1"
,
watcherId
);
test
.
TestProcessWatcherMessage
(
"test.permission.watcher.test1"
,
watcherId
);
test
.
TestProcessWatcherMessage
(
"test.permission.watcher.test1"
,
watcherId
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestAddWatcher2
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestAddWatcher2
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test2"
,
watcherId
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestAddWatcher3
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestAddWatcher3
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
test
.
TestAddWatcher
(
"test.permission.watcher.test3"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test3"
,
watcherId
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestAddWatcher4
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestAddWatcher4
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
SystemSetParameter
(
"test.watcher.test4"
,
"1101"
);
SystemSetParameter
(
"test.watcher.test4"
,
"1101"
);
SystemSetParameter
(
"test.watcher.test4.test"
,
"1102"
);
SystemSetParameter
(
"test.watcher.test4.test"
,
"1102"
);
test
.
TestAddWatcher
(
"test.watcher.test4*"
,
watcherId
);
test
.
TestAddWatcher
(
"test.watcher.test4*"
,
watcherId
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestAddWatcher5
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestAddWatcher5
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
test
.
TestAddWatcher
(
"test.permission.watcher.test5"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.test5"
,
watcherId
);
SystemSetParameter
(
"test.permission.watcher.test5"
,
"1101"
);
SystemSetParameter
(
"test.permission.watcher.test5"
,
"1101"
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestDelWatcher
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestDelWatcher
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
uint32_t
watcherId
=
0
;
uint32_t
watcherId
=
0
;
test
.
TestAddWatcher
(
"test.permission.watcher.testDel"
,
watcherId
);
test
.
TestAddWatcher
(
"test.permission.watcher.testDel"
,
watcherId
);
test
.
TestDelWatcher
(
"test.permission.watcher.testDel"
,
watcherId
);
test
.
TestDelWatcher
(
"test.permission.watcher.testDel"
,
watcherId
);
}
}
HWTEST_F
(
WatcherProxy
Test
,
TestWatchProxy
,
TestSize
.
Level1
)
HWTEST_F
(
WatcherProxy
UnitTest
,
TestWatchProxy
,
TestSize
.
Level0
)
{
{
WatcherProxyTest
test
;
WatcherProxy
Unit
Test
test
;
test
.
TestWatchProxy
(
"test.permission.watcher.test1"
,
"watcherId"
);
test
.
TestWatchProxy
(
"test.permission.watcher.test1"
,
"watcherId"
);
}
}
\ No newline at end of file
services/utils/init_utils.c
浏览文件 @
b6ef25b4
...
@@ -173,7 +173,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
...
@@ -173,7 +173,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
int
count
=
0
;
int
count
=
0
;
while
(
p
!=
NULL
)
{
while
(
p
!=
NULL
)
{
if
(
count
>
itemCounts
-
1
)
{
if
(
count
>
itemCounts
-
1
)
{
itemCounts
+=
(
itemCounts
/
2
)
+
1
;
// Request to increase the original memory by half.
itemCounts
+=
(
itemCounts
/
2
)
+
1
;
//
2
Request to increase the original memory by half.
INIT_LOGD
(
"Too many items,expand size"
);
INIT_LOGD
(
"Too many items,expand size"
);
char
**
expand
=
(
char
**
)(
realloc
(
items
,
sizeof
(
char
*
)
*
itemCounts
));
char
**
expand
=
(
char
**
)(
realloc
(
items
,
sizeof
(
char
*
)
*
itemCounts
));
if
(
expand
==
NULL
)
{
if
(
expand
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录