1# Copyright (c) 2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/update/updater/updater_default_cfg.gni") 15import("//build/test.gni") 16 17MODULE_OUTPUT_PATH = "updater/updater_test" 18 19updater_path = rebase_path("${updater_absolutely_path}", ".") 20ohos_unittest("package_unittest") { 21 testonly = true 22 resource_config_file = "${updater_path}/test/unittest/test_data/ohos_test.xml" 23 module_out_path = MODULE_OUTPUT_PATH 24 defines = [ 25 "UPDATER_UT", 26 "OPENSSL_SUPPRESS_DEPRECATED", 27 ] 28 sources = [ 29 "package_unittest.cpp", 30 "pkg_algo_unittest.cpp", 31 "pkg_manager_unittest.cpp", 32 "pkg_package_unittest.cpp", 33 "pkg_verify_unittest.cpp", 34 ] 35 36 sources += [ 37 "${updater_path}/interfaces/kits/packages/package.cpp", 38 "${updater_path}/services/package/pkg_algorithm/pkg_algo_deflate.cpp", 39 "${updater_path}/services/package/pkg_algorithm/pkg_algo_digest.cpp", 40 "${updater_path}/services/package/pkg_algorithm/pkg_algo_lz4.cpp", 41 "${updater_path}/services/package/pkg_algorithm/pkg_algo_sign.cpp", 42 "${updater_path}/services/package/pkg_algorithm/pkg_algorithm.cpp", 43 "${updater_path}/services/package/pkg_manager/pkg_managerImpl.cpp", 44 "${updater_path}/services/package/pkg_manager/pkg_stream.cpp", 45 "${updater_path}/services/package/pkg_manager/pkg_utils.cpp", 46 "${updater_path}/services/package/pkg_package/packages_info.cpp", 47 "${updater_path}/services/package/pkg_package/pkg_gzipfile.cpp", 48 "${updater_path}/services/package/pkg_package/pkg_lz4file.cpp", 49 "${updater_path}/services/package/pkg_package/pkg_pkgfile.cpp", 50 "${updater_path}/services/package/pkg_package/pkg_upgradefile.cpp", 51 "${updater_path}/services/package/pkg_package/pkg_zipfile.cpp", 52 "${updater_path}/services/package/pkg_verify/cert_verify.cpp", 53 "${updater_path}/services/package/pkg_verify/hash_data_verifier.cpp", 54 "${updater_path}/services/package/pkg_verify/openssl_util.cpp", 55 "${updater_path}/services/package/pkg_verify/pkcs7_signed_data.cpp", 56 "${updater_path}/services/package/pkg_verify/pkg_verify_util.cpp", 57 "${updater_path}/services/package/pkg_verify/zip_pkg_parse.cpp", 58 "${updater_path}/utils/utils.cpp", 59 ] 60 61 include_dirs = [ 62 "${updater_path}/interfaces/kits/include", 63 "${updater_path}/interfaces/kits/include/package", 64 "${updater_path}/services/common", 65 "${updater_path}/services/include", 66 "${updater_path}/services/include/package", 67 "${updater_path}/services/include/script", 68 "${updater_path}/services/include/log", 69 "${updater_path}/services/package/pkg_algorithm", 70 "${updater_path}/services/package/pkg_manager", 71 "${updater_path}/services/package/pkg_package", 72 "${updater_path}/services/package/pkg_verify", 73 "${updater_path}/test/unittest", 74 "${updater_path}/utils/include", 75 ] 76 77 deps = [ 78 "${updater_path}/interfaces/kits/misc_info:libmiscinfo", 79 "${updater_path}/interfaces/kits/packages:libpackageExt", 80 "${updater_path}/services/log:libupdaterlog", 81 "${updater_path}/utils:libutils", 82 ] 83 configs = [ "${updater_path}/test/unittest:utest_config" ] 84 external_deps = [ 85 "bounds_checking_function:libsec_static", 86 "bzip2:libbz2", 87 "c_utils:utils", 88 "googletest:gmock_main", 89 "googletest:gtest_main", 90 "hilog:libhilog", 91 "init:libbegetutil_static", 92 "init:libfsmanager_static_real", 93 "lz4:liblz4_static", 94 "openssl:libcrypto_shared", 95 "zlib:libz", 96 ] 97 install_enable = true 98 part_name = "updater" 99} 100