diff --git a/packing_tool/frameworks/test/unittest/shell_command_test/BUILD.gn b/packing_tool/frameworks/test/unittest/shell_command_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be86f3ee9f7dae2f0d162cfcc2b79da107717a51 --- /dev/null +++ b/packing_tool/frameworks/test/unittest/shell_command_test/BUILD.gn @@ -0,0 +1,80 @@ +# 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. + +import("//build/ohos.gni") +import("//build/test.gni") + +config("shell_command_test_config") { + include_dirs = [ + "../../../include", + "../../../include/json", + "../../../../../../../third_party/json/include", + ] + + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +module_output_path = "developtools/packing_tool" + +ohos_unittest("shell_command_test") { + module_out_path = module_output_path + public_configs = [ ":shell_command_test_config" ] + sources = [ + "../../../src/app_packager.cpp", + "../../../src/appqf_packager.cpp", + "../../../src/fast_app_packager.cpp", + "../../../src/hap_packager.cpp", + "../../../src/hqf_packager.cpp", + "../../../src/hqf_verify.cpp", + "../../../src/hsp_packager.cpp", + "../../../src/json/distro_filter.cpp", + "../../../src/json/hap_verify_info.cpp", + "../../../src/json/hap_verify_utils.cpp", + "../../../src/json/json_utils.cpp", + "../../../src/json/module_json.cpp", + "../../../src/json/module_json_fa.cpp", + "../../../src/json/module_json_stage.cpp", + "../../../src/json/module_json_utils.cpp", + "../../../src/json/normalize_version_utils.cpp", + "../../../src/json/pack_info.cpp", + "../../../src/json/pack_info_utils.cpp", + "../../../src/json/patch_json.cpp", + "../../../src/json/patch_json_utils.cpp", + "../../../src/json/pt_json.cpp", + "../../../src/log.cpp", + "../../../src/multiapp_packager.cpp", + "../../../src/package_normalize.cpp", + "../../../src/packager.cpp", + "../../../src/shell_command.cpp", + "../../../src/unzip_wrapper.cpp", + "../../../src/utils.cpp", + "../../../src/version_normalize.cpp", + "../../../src/zip_utils.cpp", + "../../../src/zip_wrapper.cpp", + "shell_command_test.cpp", + ] + external_deps = [ + "bounds_checking_function:libsec_static", + "cJSON:cjson_static", + "hilog:libhilog", + "openssl:libcrypto_shared", + "zlib:libz", + ] +} + +group("unittest") { + testonly = true + + deps = [ ":shell_command_test" ] +} diff --git a/packing_tool/frameworks/test/unittest/shell_command_test/shell_command_test.cpp b/packing_tool/frameworks/test/unittest/shell_command_test/shell_command_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..710d4f1c2d617900f596b0cef6c813eea247d1fa --- /dev/null +++ b/packing_tool/frameworks/test/unittest/shell_command_test/shell_command_test.cpp @@ -0,0 +1,228 @@ +/* + * 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 + +#include +#include "constants.h" +#include "zip_constants.h" +#define private public +#define protected public +#include "packager.h" +#include "shell_command.h" +#undef private +#undef protected + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { + +class ShellCommandTest : public testing::Test { +public: + ShellCommandTest() {} + virtual ~ShellCommandTest() {} + + static void SetUpTestCase(); + + static void TearDownTestCase(); + + void SetUp(); + + void TearDown(); +}; + +void ShellCommandTest::SetUpTestCase() {} + +void ShellCommandTest::TearDownTestCase() {} + +void ShellCommandTest::SetUp() {} + +void ShellCommandTest::TearDown() {} + +/* + * @tc.name: CreateCommandMap_0100 + * @tc.desc: CreateCommandMap. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, CreateCommandMap_0100, Function | MediumTest | Level1) +{ + int argc = 2; + const char *argv[] = { + "ohos_packing_tool", + "pack", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + int ret = shellcmd.CreateCommandMap(); + EXPECT_EQ(ret, 0); +} + +/* + * @tc.name: getPackager_0200 + * @tc.desc: getPackager. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, getPackager_0200, Function | MediumTest | Level1) +{ + int argc = 16; + const char *argv[] = { + "ohos_packing_tool", + "pack", + "--mode", + "hap", + "--json-path", + "/data/testunpack/test_hqf_unpacking/patch.json", + "--lib-path", + "/data/testunpack/test_hqf_unpacking/libs", + "--resources-path", + "/data/testunpack/test_hqf_unpacking/resources", + "--ets-pat", + "/data/testunpack/test_hqf_unpacking/ets", + "--out-path", + "/data/hqfpacking/test_1.hqf", + "--force", + "true", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + int ret = shellcmd.ParseParam(); + EXPECT_EQ(ret, 0); + std::unique_ptr packager = shellcmd.getPackager(); + EXPECT_TRUE(packager != nullptr); + shellcmd.parameterMap_[OHOS::AppPackingTool::Constants::PARAM_MODE] = "hsp"; + std::unique_ptr packager2 = shellcmd.getPackager(); + EXPECT_TRUE(packager2 != nullptr); + shellcmd.parameterMap_[OHOS::AppPackingTool::Constants::PARAM_MODE] = ""; + std::unique_ptr packager3 = shellcmd.getPackager(); + EXPECT_TRUE(packager3 == nullptr); +} + +/* + * @tc.name: OnCommand_0300 + * @tc.desc: OnCommand. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, OnCommand_0300, Function | MediumTest | Level1) +{ + int argc = 2; + const char *argv[] = { + "ohos_packing_tool", + "help", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + int ret = shellcmd.CreateCommandMap(); + EXPECT_EQ(ret, 0); + ret = shellcmd.OnCommand(); + EXPECT_EQ(ret, 0); +} + +/* + * @tc.name: ExecCommand_0400 + * @tc.desc: ExecCommand. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, ExecCommand_0400, Function | MediumTest | Level1) +{ + int argc = 16; + const char *argv[] = { + "ohos_packing_tool", + "pack", + "--mode", + "hqf", + "--json-path", + "/data/testunpack/test_hqf_unpacking/patch.json", + "--lib-path", + "/data/testunpack/test_hqf_unpacking/libs", + "--resources-path", + "/data/testunpack/test_hqf_unpacking/resources", + "--ets-pat", + "/data/testunpack/test_hqf_unpacking/ets", + "--out-path", + "/data/hqfpacking/test_1.hqf", + "--force", + "true", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + std::string resultReceiver = shellcmd.ExecCommand(); + EXPECT_FALSE(resultReceiver.empty()); +} + +/* + * @tc.name: RunAsHelpCommand_0500 + * @tc.desc: RunAsHelpCommand. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, RunAsHelpCommand_0500, Function | MediumTest | Level1) +{ + int argc = 4; + const char *argv[] = { + "ohos_packing_tool", + "pack", + "--mode", + "hqf", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + EXPECT_EQ(shellcmd.RunAsHelpCommand(), 0); +} + +/* + * @tc.name: RunAsPackCommand_0600 + * @tc.desc: RunAsPackCommand. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, RunAsPackCommand_0600, Function | MediumTest | Level1) +{ + int argc = 4; + const char *argv[] = { + "ohos_packing_tool", + "pack", + "--mode", + "hqf", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + EXPECT_EQ(shellcmd.RunAsPackCommand(), 0); +} + +/* + * @tc.name: RunAsUnpackCommand_0700 + * @tc.desc: RunAsUnpackCommand. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(ShellCommandTest, RunAsUnpackCommand_0700, Function | MediumTest | Level1) +{ + int argc = 4; + const char *argv[] = { + "ohos_packing_tool", + "pack", + "--mode", + "hqf", + }; + + OHOS::AppPackingTool::ShellCommand shellcmd(argc, const_cast(argv), OHOS::AppPackingTool::TOOL_NAME); + EXPECT_EQ(shellcmd.RunAsUnpackCommand(), 0); +} +} // namespace OHOS \ No newline at end of file diff --git a/packing_tool/frameworks/test/unittest/utils_Test/BUILD.gn b/packing_tool/frameworks/test/unittest/utils_Test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..eda740891d7bfa619df26ae7dc274153ff10c84a --- /dev/null +++ b/packing_tool/frameworks/test/unittest/utils_Test/BUILD.gn @@ -0,0 +1,50 @@ +# 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. + +import("//build/ohos.gni") +import("//build/test.gni") + +config("utils_Test_config") { + include_dirs = [ + "../../../include", + "../../../include/json", + ] + + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +module_output_path = "developtools/packing_tool" + +ohos_unittest("utils_Test") { + module_out_path = module_output_path + public_configs = [ ":utils_Test_config" ] + sources = [ + "../../../src/log.cpp", + "../../../src/utils.cpp", + "utils_test.cpp", + ] + external_deps = [ + "bounds_checking_function:libsec_static", + "cJSON:cjson_static", + "hilog:libhilog", + "openssl:libcrypto_shared", + "zlib:libz", + ] +} + +group("unittest") { + testonly = true + + deps = [ ":utils_Test" ] +} diff --git a/packing_tool/frameworks/test/unittest/utils_Test/utils_test.cpp b/packing_tool/frameworks/test/unittest/utils_Test/utils_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1c7ee4ae7bb213a8c19866da2fd871cb35610cf --- /dev/null +++ b/packing_tool/frameworks/test/unittest/utils_Test/utils_test.cpp @@ -0,0 +1,412 @@ +/* + * 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 + +#include +#include "constants.h" +#define private public +#define protected public +#include "utils.h" +#undef private +#undef protected + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { + +#define FILE_PATH "/data/utils_Test" +#define TEMP_PATH "/data" + +class UtilsTest : public testing::Test { +public: + UtilsTest() {} + virtual ~UtilsTest() {} + + static void SetUpTestCase(); + + static void TearDownTestCase(); + + void SetUp(); + + void TearDown(); +}; + +void UtilsTest::SetUpTestCase() {} + +void UtilsTest::TearDownTestCase() {} + +void UtilsTest::SetUp() {} + +void UtilsTest::TearDown() {} + +/* + * @tc.name: GetFileContent_0100 + * @tc.desc: GetFileContent. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetFileContent_0100, Function | MediumTest | Level1) +{ + std::string content = OHOS::AppPackingTool::Utils::GetFileContent(FILE_PATH); + EXPECT_TRUE(!content.empty()); +} + +/* + * @tc.name: ListToString_0100 + * @tc.desc: ListToString. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, ListToString_0100, Function | MediumTest | Level1) +{ + std::list lst = { + "aaaaaaa", + "bbbbbbb", + "ccccccc" + }; + + std::string str = OHOS::AppPackingTool::Utils::ListToString(lst); + EXPECT_TRUE(!str.empty()); +} + +/* + * @tc.name: ReplaceAll_0200 + * @tc.desc: ReplaceAll. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, ReplaceAll_0200, Function | MediumTest | Level1) +{ + std::string str = {"1234567890"}; + std::string from = {"456"}; + std::string to = {"AAA"}; + str = OHOS::AppPackingTool::Utils::ReplaceAll(str, from, to); + EXPECT_NE(str.find(to), 0); +} + +/* + * @tc.name: GetFileLength_0300 + * @tc.desc: GetFileLength. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetFileLength_0300, Function | MediumTest | Level1) +{ + int64_t len = OHOS::AppPackingTool::Utils::GetFileLength(FILE_PATH); + EXPECT_NE(len, 0); +} + +/* + * @tc.name: EndsWith_0400 + * @tc.desc: EndsWith. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, EndsWith_0400, Function | MediumTest | Level1) +{ + std::string str = {"test.txt"}; + std::string suffix = {".txt"}; + EXPECT_TRUE(OHOS::AppPackingTool::Utils::EndsWith(str, suffix)); +} + +/* + * @tc.name: CheckDisjoint_0500 + * @tc.desc: CheckDisjoint. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CheckDisjoint_0500, Function | MediumTest | Level1) +{ + std::list list1 = {"111111", "2222222"}; + std::list list2 = {"3333333", "4444444"}; + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CheckDisjoint(list1, list2)); +} + +/* + * @tc.name: CheckContainsAll_0600 + * @tc.desc: CheckContainsAll. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CheckContainsAll_0600, Function | MediumTest | Level1) +{ + std::list list1 = {"111111", "2222222", "3333333", "4444444"}; + std::list list2 = {"111111", "2222222"}; + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CheckContainsAll(list1, list2)); +} + +/* + * @tc.name: GetSha256Str_0700 + * @tc.desc: GetSha256Str. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetSha256Str_0700, Function | MediumTest | Level1) +{ + std::string str = {"1111112222222"}; + EXPECT_TRUE(!OHOS::AppPackingTool::Utils::GetSha256Str(str).empty()); +} + +/* + * @tc.name: GetSha256File_0800 + * @tc.desc: GetSha256File. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetSha256File_0800, Function | MediumTest | Level1) +{ + EXPECT_TRUE(!OHOS::AppPackingTool::Utils::GetSha256File(FILE_PATH).empty()); +} + +/* + * @tc.name: IsFileExists_0900 + * @tc.desc: IsFileExists. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, IsFileExists_0900, Function | MediumTest | Level1) +{ + EXPECT_TRUE(OHOS::AppPackingTool::Utils::IsFileExists(FILE_PATH)); +} + +/* + * @tc.name: IsFile_1000 + * @tc.desc: IsFile. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, IsFile_1000, Function | MediumTest | Level1) +{ + EXPECT_TRUE(OHOS::AppPackingTool::Utils::IsFile(FILE_PATH)); +} + +/* + * @tc.name: IsDirectory_1100 + * @tc.desc: IsDirectory. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, IsDirectory_1100, Function | MediumTest | Level1) +{ + EXPECT_TRUE(OHOS::AppPackingTool::Utils::IsDirectory(TEMP_PATH)); +} + +/* + * @tc.name: RemoveFile_1200 + * @tc.desc: RemoveFile. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, RemoveFile_1200, Function | MediumTest | Level1) +{ + system("touch patch.json"); + std::string file("patch.json"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::RemoveFile(file)); +} + +/* + * @tc.name: RemoveDirectory_1300 + * @tc.desc: RemoveDirectory. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, RemoveDirectory_1300, Function | MediumTest | Level1) +{ + system("mkdir tempdir"); + std::string path("tempdir"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::RemoveDirectory(path)); +} + +/* + * @tc.name: GetFilePathByDir_1400 + * @tc.desc: GetFilePathByDir. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetFilePathByDir_1400, Function | MediumTest | Level1) +{ + std::string path("tempdir"); + std::string file("testfile"); + std::string filePath("tempdir/testfile"); + std::string temp = OHOS::AppPackingTool::Utils::GetFilePathByDir(path, file); + EXPECT_EQ(temp.compare(filePath), 0); +} + +/* + * @tc.name: ForceCreateDirectory_1500 + * @tc.desc: ForceCreateDirectory. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, ForceCreateDirectory_1500, Function | MediumTest | Level1) +{ + std::string path("tempdir"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::ForceCreateDirectory(path)); +} + +/* + * @tc.name: ForceRemoveDirectory_1600 + * @tc.desc: ForceRemoveDirectory. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, ForceRemoveDirectory_1600, Function | MediumTest | Level1) +{ + std::string path("tempdir"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::ForceCreateDirectory(path)); + + EXPECT_TRUE(OHOS::AppPackingTool::Utils::ForceRemoveDirectory(path)); +} + +/* + * @tc.name: CopyListToSet_1700 + * @tc.desc: CopyListToSet. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CopyListToSet_1700, Function | MediumTest | Level1) +{ + std::list lst; + lst.push_front("test"); + std::set st; + OHOS::AppPackingTool::Utils::CopyListToSet(lst, st); + auto it = st.find("test"); + EXPECT_TRUE(it != st.end()); +} + +/* + * @tc.name: CheckListContain_1800 + * @tc.desc: CheckListContain. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CheckListContain_1800, Function | MediumTest | Level1) +{ + std::string value("test"); + std::list lst; + lst.push_front(value.c_str()); + + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CheckListContain(lst, std::string(value))); +} + +/* + * @tc.name: GetListDistinctCount_1900 + * @tc.desc: GetListDistinctCount. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetListDistinctCount_1900, Function | MediumTest | Level1) +{ + std::string value("test"); + std::list lst; + lst.push_front(value.c_str()); + + EXPECT_EQ(OHOS::AppPackingTool::Utils::GetListDistinctCount(lst), 1); +} + +/* + * @tc.name: GetCeilFileSize_2000 + * @tc.desc: GetCeilFileSize. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetCeilFileSize_2000, Function | MediumTest | Level1) +{ + long fileSize = 12 * 1024 * 1014L; + int sizeLimit = 12; + + EXPECT_TRUE(OHOS::AppPackingTool::Utils::GetCeilFileSize(fileSize, sizeLimit) < 12); +} + +/* + * @tc.name: IsPositiveInteger_2100 + * @tc.desc: IsPositiveInteger. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, IsPositiveInteger_2100, Function | MediumTest | Level1) +{ + EXPECT_TRUE(OHOS::AppPackingTool::Utils::IsPositiveInteger(std::string("123"), 0, 200)); +} + +/* + * @tc.name: CheckFileName_2200 + * @tc.desc: CheckFileName. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CheckFileName_2200, Function | MediumTest | Level1) +{ + std::string filePath(FILE_PATH); + std::string fileName("utils_Test"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CheckFileName(filePath, fileName)); +} + +/* + * @tc.name: CheckFileSuffix_2300 + * @tc.desc: CheckFileSuffix. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CheckFileSuffix_2300, Function | MediumTest | Level1) +{ + std::string filePath("aaaa.hsp"); + std::string suffix(".hsp"); + system("touch aaaa.hsp"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CheckFileSuffix(filePath, suffix)); + system("rm aaaa.hsp"); +} + +/* + * @tc.name: GenerateUUID_2400 + * @tc.desc: GenerateUUID. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GenerateUUID_2400, Function | MediumTest | Level1) +{ + std::string id = OHOS::AppPackingTool::Utils::GenerateUUID(); + EXPECT_TRUE(!id.empty()); +} + +/* + * @tc.name: CopyFile_2500 + * @tc.desc: CopyFile. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, CopyFile_2500, Function | MediumTest | Level1) +{ + std::string srcPath(FILE_PATH); + std::string dstPath("aaaaa"); + EXPECT_TRUE(OHOS::AppPackingTool::Utils::CopyFile(srcPath, dstPath)); + system("rm aaaaa"); +} + +/* + * @tc.name: GetFormattedPath_2600 + * @tc.desc: GetFormattedPath. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(UtilsTest, GetFormattedPath_2600, Function | MediumTest | Level1) +{ + std::string path(FILE_PATH); + std::string formattedPath; + EXPECT_TRUE(OHOS::AppPackingTool::Utils::GetFormattedPath(path, formattedPath)); +} +} // namespace OHOS