Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
543a0972
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看板
未验证
提交
543a0972
编写于
11月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6665 修复xts
Merge pull request !6665 from shilei91/OpenHarmony-3.2-Beta3
上级
a5552a66
3bf5ed62
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
50 addition
and
12 deletion
+50
-12
appexecfwk_lite/appexecfwk_hal/BUILD.gn
appexecfwk_lite/appexecfwk_hal/BUILD.gn
+2
-0
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
+48
-12
未找到文件。
appexecfwk_lite/appexecfwk_hal/BUILD.gn
浏览文件 @
543a0972
...
@@ -20,6 +20,8 @@ hctest_suite("ActsBundleMgrTest") {
...
@@ -20,6 +20,8 @@ hctest_suite("ActsBundleMgrTest") {
"${aafwk_lite_path}/interfaces/kits/want_lite",
"${aafwk_lite_path}/interfaces/kits/want_lite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite/slite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite/slite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
"${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
"${appexecfwk_lite_path}/utils/bundle_lite",
"//commonlibrary/utils_lite/memory/include",
]
]
if (board_toolchain_type != "iccarm") {
if (board_toolchain_type != "iccarm") {
...
...
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
浏览文件 @
543a0972
...
@@ -16,12 +16,15 @@
...
@@ -16,12 +16,15 @@
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include "adapter.h"
#include "hctest.h"
#include "hctest.h"
#include "securec.h"
#include "securec.h"
#include "bundle_info.h"
#include "bundle_info.h"
#include "bundle_manager.h"
#include "bundle_manager.h"
#include "want.h"
#include "want.h"
#define nullptr NULL
/**
/**
* @brief register a test suit named BundleMgrTestSuite
* @brief register a test suit named BundleMgrTestSuite
* @param subsystem name is appexecfwk
* @param subsystem name is appexecfwk
...
@@ -53,8 +56,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumT
...
@@ -53,8 +56,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumT
AbilityInfo
abilityInfo
;
AbilityInfo
abilityInfo
;
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
char
*
name
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
size_t
len
=
strlen
(
name
);
abilityInfo
.
bundleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
abilityInfo
.
bundleName
);
errno_t
err
=
strncpy_s
(
abilityInfo
.
bundleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
name
);
ClearAbilityInfo
(
&
abilityInfo
);
ClearAbilityInfo
(
&
abilityInfo
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
NULL
);
printf
(
"------end testClearAbilityInfo------
\n
"
);
printf
(
"------end testClearAbilityInfo------
\n
"
);
...
@@ -71,9 +79,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
...
@@ -71,9 +79,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
AbilityInfo
abilityInfo
=
{
0
};
AbilityInfo
abilityInfo
=
{
0
};
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
char
*
name
=
"com.openharmony.testjsdemo"
;
size_t
len
=
strlen
(
name
);
abilityInfo
.
bundleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
abilityInfo
.
bundleName
);
errno_t
err
=
strncpy_s
(
abilityInfo
.
bundleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
ClearAbilityInfo
(
NULL
);
ClearAbilityInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
name
);
AdapterFree
(
abilityInfo
.
bundleName
);
printf
(
"------end testClearAbilityInfoIllegal------
\n
"
);
printf
(
"------end testClearAbilityInfoIllegal------
\n
"
);
}
}
...
@@ -88,8 +102,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTe
...
@@ -88,8 +102,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTe
BundleInfo
bundleInfo
=
{
0
};
BundleInfo
bundleInfo
=
{
0
};
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
char
*
name
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
size_t
len
=
strlen
(
name
);
bundleInfo
.
bundleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
bundleInfo
.
bundleName
);
errno_t
err
=
strncpy_s
(
bundleInfo
.
bundleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
name
);
ClearBundleInfo
(
&
bundleInfo
);
ClearBundleInfo
(
&
bundleInfo
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
NULL
);
printf
(
"------end testClearBundleInfo------
\n
"
);
printf
(
"------end testClearBundleInfo------
\n
"
);
...
@@ -106,9 +125,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
...
@@ -106,9 +125,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
char
*
name
=
"com.openharmony.testjsdemo"
;
size_t
len
=
strlen
(
name
);
bundleInfo
.
bundleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
bundleInfo
.
bundleName
);
errno_t
err
=
strncpy_s
(
bundleInfo
.
bundleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
ClearBundleInfo
(
NULL
);
ClearBundleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
name
);
AdapterFree
(
bundleInfo
.
bundleName
);
printf
(
"------end testClearBundleInfoIllegal------
\n
"
);
printf
(
"------end testClearBundleInfoIllegal------
\n
"
);
}
}
...
@@ -123,8 +148,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTe
...
@@ -123,8 +148,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTe
ModuleInfo
moduleInfo
=
{
0
};
ModuleInfo
moduleInfo
=
{
0
};
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
moduleInfo
.
moduleName
=
"test"
;
char
*
name
=
"test"
;
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
size_t
len
=
strlen
(
name
);
moduleInfo
.
moduleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
moduleInfo
.
moduleName
);
errno_t
err
=
strncpy_s
(
moduleInfo
.
moduleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
name
);
ClearModuleInfo
(
&
moduleInfo
);
ClearModuleInfo
(
&
moduleInfo
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
NULL
);
printf
(
"------end testClearModuleInfo------
\n
"
);
printf
(
"------end testClearModuleInfo------
\n
"
);
...
@@ -141,9 +171,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | Medium
...
@@ -141,9 +171,15 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | Medium
ModuleInfo
moduleInfo
=
{
0
};
ModuleInfo
moduleInfo
=
{
0
};
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
TEST_ASSERT_TRUE
(
result
==
0
);
moduleInfo
.
moduleName
=
"test"
;
char
*
name
=
"test"
;
size_t
len
=
strlen
(
name
);
moduleInfo
.
moduleName
=
(
char
*
)(
AdapterMalloc
(
len
+
1
));
TEST_ASSERT_NOT_NULL
(
moduleInfo
.
moduleName
);
errno_t
err
=
strncpy_s
(
moduleInfo
.
moduleName
,
len
+
1
,
name
,
len
);
TEST_ASSERT_EQUAL
(
err
,
EOK
);
ClearModuleInfo
(
NULL
);
ClearModuleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
name
);
AdapterFree
(
moduleInfo
.
moduleName
);
printf
(
"------end testClearModuleInfoIllegal------
\n
"
);
printf
(
"------end testClearModuleInfoIllegal------
\n
"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录