!972 Native软件包管理ut测试码上传&黑盒测试发现问题修复

Merge pull request !972 from 郭桦炜/hnp_test
This commit is contained in:
openharmony_ci 2024-03-18 04:43:37 +00:00 committed by Gitee
commit 8c92b120fb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 498 additions and 12 deletions

View File

@ -81,7 +81,7 @@ static int ParseLinksJsonToHnpHead(cJSON *linksItem, NativeHnpHead *hnpHead, Nat
return HNP_ERRNO_PACK_GET_ARRAY_ITRM_FAILED;
}
cJSON *sourceItem = cJSON_GetObjectItem(link, "source");
if (sourceItem == NULL) {
if ((sourceItem == NULL) || (sourceItem->valuestring == NULL)) {
HNP_LOGE("get source info in cfg unsuccess.");
free(linkArray);
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
@ -91,13 +91,10 @@ static int ParseLinksJsonToHnpHead(cJSON *linksItem, NativeHnpHead *hnpHead, Nat
free(linkArray);
return HNP_ERRNO_BASE_COPY_FAILED;
}
linkArray[i].target[0] = '\0'; //允许target不填软链接默认使用原二进制名称
cJSON *targetItem = cJSON_GetObjectItem(link, "target");
if (targetItem == NULL) {
HNP_LOGE("get target info in cfg unsuccess.");
free(linkArray);
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
}
if (strcpy_s(linkArray[i].target, MAX_FILE_PATH_LEN, targetItem->valuestring) != EOK) {
if ((targetItem != NULL) && (targetItem->valuestring != NULL) &&
(strcpy_s(linkArray[i].target, MAX_FILE_PATH_LEN, targetItem->valuestring) != EOK)) {
HNP_LOGE("strcpy unsuccess.");
free(linkArray);
return HNP_ERRNO_BASE_COPY_FAILED;
@ -115,7 +112,7 @@ static int ParseJsonStreamToHnpHead(cJSON *json, char *name, NativeHnpHead *hnpH
int ret;
cJSON *typeItem = cJSON_GetObjectItem(json, "type");
if (typeItem == NULL) {
if ((typeItem == NULL) || (typeItem->valuestring == NULL)) {
HNP_LOGE("get type info in cfg unsuccess.");
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
}
@ -124,7 +121,7 @@ static int ParseJsonStreamToHnpHead(cJSON *json, char *name, NativeHnpHead *hnpH
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
}
cJSON *nameItem = cJSON_GetObjectItem(json, "name");
if (nameItem == NULL) {
if ((nameItem == NULL) || (nameItem->valuestring == NULL)) {
HNP_LOGE("get name info in cfg unsuccess.");
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
}
@ -134,7 +131,7 @@ static int ParseJsonStreamToHnpHead(cJSON *json, char *name, NativeHnpHead *hnpH
return HNP_ERRNO_BASE_COPY_FAILED;
}
cJSON *versionItem = cJSON_GetObjectItem(json, "version");
if (versionItem == NULL) {
if ((versionItem == NULL) || (versionItem->valuestring == NULL)) {
HNP_LOGE("get version info in cfg unsuccess.");
return HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND;
}
@ -262,7 +259,7 @@ int HnpCmdPack(int argc, char *argv[])
index++;
}
if ((name != NULL) && (version != NULL)) {
if ((name != NULL) && (strlen(name) != 0) && (version != NULL) && (strlen(version) != 0)) {
NativeHnpHead hnpHead;
hnpHead.linkNum = 0;
if (strcpy_s(hnpHead.hnpVersion, HNP_VERSION_LEN, version) != EOK) {
@ -276,7 +273,7 @@ int HnpCmdPack(int argc, char *argv[])
return PackHnpWithCfg(srcPath, dstPath, cfgPath);
}
HNP_LOGE("pack args parse miss! \r\n");
HNP_LOGE("pack args parse miss!");
return HNP_ERRNO_PACK_MISS_OPERATOR_PARAM;
}

View File

@ -25,6 +25,7 @@ group("unittest") {
if (!defined(ohos_lite)) {
testonly = true
deps = [ "unittest:AppSpawn_ut" ]
deps += [ "unittest/hnp_test:HnpTest" ]
} else {
testonly = true
deps = [ "unittest/app_spawn_lite_test:unittest" ]

View File

@ -0,0 +1,54 @@
# Copyright (c) 2021-2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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.
import("//base/startup/appspawn/appspawn.gni")
import("//build/test.gni")
if (!defined(ohos_lite)) {
ohos_unittest("HnpTest") {
module_out_path = "${module_output_path}"
cflags = [
"-Wno-implicit-fallthrough",
"-Wno-unused-function",
"-Dprivate=public",
"-Dprotected=public",
]
cflags_cc = [
"-Wno-implicit-fallthrough",
"-fexceptions",
]
include_dirs = [
"${appspawn_path}/service/hnp/base",
"${appspawn_path}/service/hnp/pack/include",
]
sources = [
"${appspawn_path}/service/hnp/base/hnp_file.c",
"${appspawn_path}/service/hnp/base/hnp_log.c",
"${appspawn_path}/service/hnp/base/hnp_zip.c",
"${appspawn_path}/service/hnp/pack/src/hnp_pack.c",
"hnp_pack_test.cpp",
]
defines = [ "APPSPAWN_TEST" ]
deps = [ "//third_party/cJSON:cjson" ]
external_deps = [
"bounds_checking_function:libsec_shared",
"hilog:libhilog",
"zlib:shared_libz",
]
}
}

View File

@ -0,0 +1,434 @@
/*
* Copyright (c) 2024 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
#include <gtest/gtest.h>
#include <cerrno>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "hnp_base.h"
#include "hnp_pack.h"
#include "securec.h"
using namespace testing;
using namespace testing::ext;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
namespace OHOS {
class HnpPackTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp();
void TearDown();
};
void HnpPackTest::SetUpTestCase()
{
GTEST_LOG_(INFO) << "Hnp_Pack_TEST SetUpTestCase";
}
void HnpPackTest::TearDownTestCase()
{
GTEST_LOG_(INFO) << "Hnp_Pack_TEST TearDownTestCase";
}
void HnpPackTest::SetUp()
{
GTEST_LOG_(INFO) << "Hnp_Pack_TEST SetUp";
}
void HnpPackTest::TearDown()
{
GTEST_LOG_(INFO) << "Hnp_Pack_TEST TearDown";
}
/**
* @tc.name: Hnp_Pack_001
* @tc.desc: Verify set Arg if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_001, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_001 start";
// clear resource before test
remove("./hnp_out/sample.hnp");
rmdir("hnp_out");
rmdir("hnp_sample");
remove("hnp.cfg");
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
char arg1[] = "hnp";
char arg2[] = "pack";
{ // param num not enough
char* argv[] = {arg1, arg2};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_ARGV_NUM_INVALID);
}
{ // src dir path is invalid
char arg3[] = "./hnp_sample2";
char arg4[] = "./hnp_out";
char* argv[] = {arg1, arg2, arg3, arg4};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_GET_REALPATH_FAILED);
}
{ // no name and version
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char* argv[] = {arg1, arg2, arg3, arg4};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_MISS_OPERATOR_PARAM);
}
{ // ok
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-name";
char arg6[] = "sample";
char arg7[] = "-v";
char arg8[] = "1.1";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
EXPECT_EQ(remove("./hnp_out/sample.hnp"), 0);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_001 end";
}
/**
* @tc.name: Hnp_Pack_002
* @tc.desc: Verify set Arg with cfg if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_002, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_002 start";
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
FILE *fp = fopen("hnp.cfg", "w");
EXPECT_NE(fp, nullptr);
fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-cfg";
{ // cfg file path is invalid
char arg6[] = "./hnp2.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_GET_REALPATH_FAILED);
}
{ // cfg file content is empty
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_READ_FILE_STREAM_FAILED);
}
{ // cfg file not json formaat
char cfg[] = "this is for test!";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_JSON_FAILED);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
EXPECT_EQ(remove("hnp.cfg"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_002 end";
}
/**
* @tc.name: Hnp_Pack_003
* @tc.desc: Verify set cfg type item invalid if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_003, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_003 start";
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
FILE *fp = fopen("hnp.cfg", "w");
EXPECT_NE(fp, nullptr);
fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-cfg";
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
{ // cfg file content has not type item
char cfg[] = "{\"typ\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
{ // type item value is not expected
char cfg[] = "{\"type\":\"hnpconfig\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
EXPECT_EQ(remove("hnp.cfg"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_003 end";
}
/**
* @tc.name: Hnp_Pack_004
* @tc.desc: Verify set cfg invalid if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_004, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_004 start";
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
FILE *fp = fopen("hnp.cfg", "w");
EXPECT_NE(fp, nullptr);
fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-cfg";
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
{ // cfg file content has not name item
char cfg[] = "{\"type\":\"hnp-config\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
{ // cfg file content has not version item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
{ // cfg file content has not install item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"uninstall\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
EXPECT_EQ(remove("hnp.cfg"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_004 end";
}
/**
* @tc.name: Hnp_Pack_005
* @tc.desc: Verify set cfg links item invalid if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_005, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_005 start";
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
FILE *fp = fopen("hnp.cfg", "w");
EXPECT_NE(fp, nullptr);
fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-cfg";
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
{ // link arry item has not source item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"src\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), HNP_ERRNO_PACK_PARSE_ITEM_NO_FOUND);
}
{ // ok, link arry item has not target item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"tar\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
EXPECT_EQ(remove("./hnp_out/sample.hnp"), 0);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
EXPECT_EQ(remove("hnp.cfg"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_005 end";
}
/**
* @tc.name: Hnp_Pack_006
* @tc.desc: Verify set cfg valid if HnpCmdPack succeed.
* @tc.type: FUNC
* @tc.require:issueI98PSE
* @tc.author:
*/
HWTEST(HnpPackTest, Hnp_Pack_006, TestSize.Level0)
{
GTEST_LOG_(INFO) << "Hnp_Pack_006 start";
EXPECT_EQ(mkdir("hnp_sample", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
EXPECT_EQ(mkdir("hnp_out", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH), 0);
FILE *fp = fopen("hnp.cfg", "w");
EXPECT_NE(fp, nullptr);
fclose(fp);
char arg1[] = "hnp";
char arg2[] = "pack";
char arg3[] = "./hnp_sample";
char arg4[] = "/hnp_out";
char arg5[] = "-cfg";
char arg6[] = "./hnp.cfg";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6};
int argc = sizeof(argv) / sizeof(argv[0]);
{ // ok. no links item in install item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":{}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
EXPECT_EQ(remove("./hnp_out/sample.hnp"), 0);
}
{ // ok. no array in links item
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
EXPECT_EQ(remove("./hnp_out/sample.hnp"), 0);
}
{ // ok. 2 links
char cfg[] = "{\"type\":\"hnp-config\",\"name\":\"sample\",\"version\":\"1.1\",\"install\":"
"{\"links\":[{\"source\":\"bin/out\",\"target\":\"out\"},{\"source\":\"bin/out2\","
"\"target\":\"out2\"}]}}";
FILE *fp = fopen("./hnp.cfg", "w");
EXPECT_EQ(fwrite(cfg, sizeof(char), strlen(cfg) + 1, fp), strlen(cfg) + 1);
fclose(fp);
EXPECT_EQ(HnpCmdPack(argc, argv), 0);
EXPECT_EQ(remove("./hnp_out/sample.hnp"), 0);
}
EXPECT_EQ(rmdir("hnp_sample"), 0);
EXPECT_EQ(rmdir("hnp_out"), 0);
EXPECT_EQ(remove("hnp.cfg"), 0);
GTEST_LOG_(INFO) << "Hnp_Pack_006 end";
}
} // namespace OHOS