Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
87db96dc
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
87db96dc
编写于
10月 19, 2021
作者:
4
411148299@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code style
Signed-off-by:
N
411148299@qq.com
<
411148299@qq.com
>
上级
8a5cdb62
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
35 deletion
+39
-35
services/test/unittest/param/client_unittest.cpp
services/test/unittest/param/client_unittest.cpp
+19
-15
services/test/unittest/param/dac_unittest.cpp
services/test/unittest/param/dac_unittest.cpp
+19
-19
watchdog/linux/init_linux_watchdog.c
watchdog/linux/init_linux_watchdog.c
+1
-1
未找到文件。
services/test/unittest/param/client_unittest.cpp
浏览文件 @
87db96dc
...
...
@@ -188,6 +188,24 @@ static void TestCmd()
RunParamCommand
(
ARRAY_LENGTH
(
argForSet9
),
const_cast
<
char
**>
(
argForSet9
));
}
void
TestClientApi
(
char
testBuffer
[],
uint32_t
size
,
const
char
*
name
,
const
char
*
value
)
{
ParamHandle
handle
;
int
ret
=
SystemFindParameter
(
name
,
&
handle
);
SystemSetParameter
(
name
,
value
);
ret
=
SystemFindParameter
(
name
,
&
handle
);
EXPECT_EQ
(
ret
,
0
);
uint32_t
commitId
=
0
;
ret
=
SystemGetParameterCommitId
(
handle
,
&
commitId
);
EXPECT_EQ
(
ret
,
0
);
ret
=
SystemGetParameterName
(
handle
,
testBuffer
,
size
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
strcmp
(
testBuffer
,
name
),
0
);
ret
=
SystemGetParameterValue
(
handle
,
testBuffer
,
&
size
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
strcmp
(
testBuffer
,
value
),
0
);
}
void
TestClient
(
int
index
)
{
char
testBuffer
[
PARAM_BUFFER_SIZE
]
=
{
0
};
...
...
@@ -213,21 +231,7 @@ void TestClient(int index)
break
;
}
case
2
:
{
// 2 api test
ParamHandle
handle
;
uint32_t
size
=
PARAM_BUFFER_SIZE
;
int
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
SystemSetParameter
(
name
.
c_str
(),
value
.
c_str
());
ret
=
SystemFindParameter
(
name
.
c_str
(),
&
handle
);
EXPECT_EQ
(
ret
,
0
);
uint32_t
commitId
=
0
;
ret
=
SystemGetParameterCommitId
(
handle
,
&
commitId
);
EXPECT_EQ
(
ret
,
0
);
ret
=
SystemGetParameterName
(
handle
,
testBuffer
,
size
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
strcmp
(
testBuffer
,
name
.
c_str
()),
0
);
ret
=
SystemGetParameterValue
(
handle
,
testBuffer
,
&
size
);
EXPECT_EQ
(
ret
,
0
);
EXPECT_EQ
(
strcmp
(
testBuffer
,
value
.
c_str
()),
0
);
TestClientApi
(
testBuffer
,
PARAM_BUFFER_SIZE
,
name
.
c_str
(),
value
.
c_str
());
break
;
}
case
3
:
// 3 Traversal test
...
...
services/test/unittest/param/dac_unittest.cpp
浏览文件 @
87db96dc
...
...
@@ -34,10 +34,10 @@ static int SecurityLabelGet(const ParamAuditData *auditData, void *context)
return
0
;
}
class
ParamDac
Test
:
public
::
testing
::
Test
{
class
DacUnit
Test
:
public
::
testing
::
Test
{
public:
ParamDac
Test
()
{}
virtual
~
ParamDac
Test
()
{}
DacUnit
Test
()
{}
virtual
~
DacUnit
Test
()
{}
void
SetUp
()
{}
void
TearDown
()
{}
...
...
@@ -182,37 +182,37 @@ private:
ParamSecurityOps
clientParamSercurityOps
;
};
HWTEST_F
(
ParamDac
Test
,
TestDacGetLabel
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacGetLabel
,
TestSize
.
Level0
)
{
ParamDac
Test
test
;
DacUnit
Test
test
;
test
.
TestDacGetLabel
();
}
HWTEST_F
(
ParamDac
Test
,
TestDacInitLocalLabel
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacInitLocalLabel
,
TestSize
.
Level0
)
{
ParamDac
Test
test
;
DacUnit
Test
test
;
test
.
TestDacInitLocalLabel
();
}
HWTEST_F
(
ParamDac
Test
,
TestDacLabelEncode
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacLabelEncode
,
TestSize
.
Level0
)
{
ParamDac
Test
test
;
DacUnit
Test
test
;
std
::
vector
<
char
>
buffer
;
ParamSecurityLabel
label
=
{
0
,
{
4444
,
5555
}};
test
.
TestEncode
(
&
label
,
buffer
);
test
.
TestDecode
(
&
label
,
buffer
);
}
HWTEST_F
(
ParamDac
Test
,
TestDacCheckFilePermission
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacCheckFilePermission
,
TestSize
.
Level0
)
{
ParamDac
Test
test
;
DacUnit
Test
test
;
test
.
TestDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
}
HWTEST_F
(
ParamDac
Test
,
TestDacCheckUserParaPermission
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacCheckUserParaPermission
,
TestSize
.
Level0
)
{
// 相同用户
ParamDac
Test
test
;
DacUnit
Test
test
;
ParamDacData
dacData
;
dacData
.
gid
=
getegid
();
dacData
.
uid
=
geteuid
();
...
...
@@ -250,10 +250,10 @@ HWTEST_F(ParamDacTest, TestDacCheckUserParaPermission, TestSize.Level0)
EXPECT_EQ
(
ret
,
0
);
}
HWTEST_F
(
ParamDac
Test
,
TestDacCheckGroupParaPermission
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacCheckGroupParaPermission
,
TestSize
.
Level0
)
{
// 相同组
ParamDac
Test
test
;
DacUnit
Test
test
;
ParamDacData
dacData
;
dacData
.
gid
=
getegid
();
dacData
.
uid
=
13333
;
...
...
@@ -291,10 +291,10 @@ HWTEST_F(ParamDacTest, TestDacCheckGroupParaPermission, TestSize.Level0)
EXPECT_EQ
(
ret
,
0
);
}
HWTEST_F
(
ParamDac
Test
,
TestDacCheckOtherParaPermission
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestDacCheckOtherParaPermission
,
TestSize
.
Level0
)
{
// 其他用户
ParamDac
Test
test
;
DacUnit
Test
test
;
ParamDacData
dacData
;
dacData
.
gid
=
13333
;
dacData
.
uid
=
13333
;
...
...
@@ -332,8 +332,8 @@ HWTEST_F(ParamDacTest, TestDacCheckOtherParaPermission, TestSize.Level0)
EXPECT_EQ
(
ret
,
0
);
}
HWTEST_F
(
ParamDac
Test
,
TestClientDacCheckFilePermission
,
TestSize
.
Level0
)
HWTEST_F
(
DacUnit
Test
,
TestClientDacCheckFilePermission
,
TestSize
.
Level0
)
{
ParamDac
Test
test
;
DacUnit
Test
test
;
test
.
TestClientDacCheckFilePermission
(
PARAM_DEFAULT_PATH
"/trigger_test.cfg"
);
}
watchdog/linux/init_linux_watchdog.c
浏览文件 @
87db96dc
...
...
@@ -62,7 +62,7 @@ int main(int argc, const char *argv[])
int
gap
=
0
;
if
(
argc
>=
3
)
{
// Argument nums greater than or equal to 3.
gap
=
atoi
(
argv
[
2
]);
//
S
econd parameter.
gap
=
atoi
(
argv
[
2
]);
//
2 s
econd parameter.
}
gap
=
gap
>
0
?
gap
:
DEFAULT_GAP
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录