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  ]
59
60  include_dirs = [
61    "${updater_path}/interfaces/kits/include",
62    "${updater_path}/interfaces/kits/include/package",
63    "${updater_path}/services/common",
64    "${updater_path}/services/include",
65    "${updater_path}/services/include/package",
66    "${updater_path}/services/include/script",
67    "${updater_path}/services/include/log",
68    "${updater_path}/services/package/pkg_algorithm",
69    "${updater_path}/services/package/pkg_manager",
70    "${updater_path}/services/package/pkg_package",
71    "${updater_path}/services/package/pkg_verify",
72    "${updater_path}/test/unittest",
73    "${updater_path}/utils/include",
74  ]
75
76  deps = [
77    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
78    "${updater_path}/interfaces/kits/packages:libpackageExt",
79    "${updater_path}/services/log:libupdaterlog",
80    "${updater_path}/utils:libutils",
81  ]
82  configs = [ "${updater_path}/test/unittest:utest_config" ]
83  external_deps = [
84    "bounds_checking_function:libsec_static",
85    "bzip2:libbz2",
86    "c_utils:utils",
87    "googletest:gmock_main",
88    "googletest:gtest_main",
89    "hilog:libhilog",
90    "lz4:liblz4_static",
91    "openssl:libcrypto_shared",
92    "zlib:libz",
93  ]
94  install_enable = true
95  part_name = "updater"
96}
97