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"
18updater_path = rebase_path("${updater_absolutely_path}", ".")
19
20ohos_unittest("binary_unittest") {
21  resource_config_file = "${updater_path}/test/unittest/test_data/ohos_test.xml"
22  module_out_path = MODULE_OUTPUT_PATH
23  sources = [
24    "update_image_block_test.cpp",
25    "update_image_patch_unittest.cpp",
26    "update_partitions_unittest.cpp",
27    "update_processor_unittest.cpp",
28  ]
29
30  sources += [
31    "${updater_path}/services/applypatch/block_set.cpp",
32    "${updater_path}/services/updater_binary/update_image_block.cpp",
33    "${updater_path}/services/updater_binary/update_image_patch.cpp",
34    "${updater_path}/services/updater_binary/update_partitions.cpp",
35    "${updater_path}/services/updater_binary/update_processor.cpp",
36    "${updater_path}/utils/utils.cpp",
37  ]
38
39  include_dirs = [
40    "${updater_path}/interfaces/kits/include",
41    "${updater_path}/services",
42    "${updater_path}/services/common",
43    "${updater_path}/services/flow_update",
44    "${updater_path}/services/include/package",
45    "${updater_path}/services/include/script",
46    "${updater_path}/services/include/log",
47    "${updater_path}/services/include/fs_manager",
48    "${updater_path}/services/include",
49    "${updater_path}/utils/include",
50    "${updater_path}/utils/json",
51    "${updater_path}/services/package/pkg_algorithm",
52    "${updater_path}/services/include/applypatch",
53    "${updater_path}/services/script/script_manager",
54    "${updater_path}/services/script/script_interpreter",
55    "${updater_path}/test/unittest",
56    "${updater_path}/test/unittest/script",
57    "${updater_path}/services/updater_binary",
58  ]
59  deps = [
60    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
61    "${updater_path}/interfaces/kits/slot_info:libslotinfo",
62    "${updater_path}/services/applypatch:libapplypatch",
63    "${updater_path}/services/common/ring_buffer:libringbuffer",
64    "${updater_path}/services/diffpatch/patch:libpatch",
65    "${updater_path}/services/flow_update/update_bin:libBinFlowUpdate",
66    "${updater_path}/services/fs_manager:libfsmanager",
67    "${updater_path}/services/log:libupdaterlog",
68    "${updater_path}/services/package:libupdaterpackage",
69    "${updater_path}/services/script:libupdaterscript",
70  ]
71
72  configs = [ "${updater_path}/test/unittest:utest_config" ]
73  external_deps = [
74    "bzip2:libbz2",
75    "cJSON:cjson",
76    "c_utils:utils",
77    "googletest:gmock_main",
78    "googletest:gtest_main",
79    "hilog:libhilog",
80    "init:libbegetutil_static",
81    "init:libfsmanager_static_real",
82    "lz4:liblz4_static",
83    "openssl:libcrypto_shared",
84    "openssl:libssl_shared",
85    "zlib:libz",
86  ]
87  install_enable = true
88  part_name = "updater"
89  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
90}
91