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("applypatch_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  sources = [
25    "all_cmd_unittest.cpp",
26    "applypatch_unittest.cpp",
27    "blockset_unittest.cpp",
28    "commands_unittest.cpp",
29    "commandsfunction_unittest.cpp",
30    "partition_update_record_unittest.cpp",
31    "store_unittest.cpp",
32    "transfer_manager_unittest.cpp",
33    "update_progress_unittest.cpp",
34  ]
35  sources += [
36    "${updater_path}/services/applypatch/block_set.cpp",
37    "${updater_path}/services/applypatch/block_writer.cpp",
38    "${updater_path}/services/applypatch/command.cpp",
39    "${updater_path}/services/applypatch/command_function.cpp",
40    "${updater_path}/services/applypatch/command_process.cpp",
41    "${updater_path}/services/applypatch/data_writer.cpp",
42    "${updater_path}/services/applypatch/partition_record.cpp",
43    "${updater_path}/services/applypatch/raw_writer.cpp",
44    "${updater_path}/services/applypatch/store.cpp",
45    "${updater_path}/services/applypatch/transfer_manager.cpp",
46    "${updater_path}/services/applypatch/update_progress.cpp",
47  ]
48  include_dirs = [
49    "${updater_path}/interfaces/kits/include",
50    "${updater_path}/services",
51    "${updater_path}/services/common",
52    "${updater_path}/services/include",
53    "${updater_path}/services/include/fs_manager",
54    "${updater_path}/services/include/log",
55    "${updater_path}/services/include/package",
56    "${updater_path}/services/include/script",
57    "${updater_path}/services/script/threadpool",
58    "${updater_path}/services/package/pkg_manager",
59    "${updater_path}/test/unittest",
60    "${updater_path}/test/unittest/script",
61    "${updater_path}/utils/include",
62  ]
63  deps = [
64    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
65    "${updater_path}/services/applypatch:libapplypatch",
66    "${updater_path}/services/fs_manager:libfsmanager",
67    "${updater_path}/utils:libutils",
68  ]
69  external_deps = [
70    "bounds_checking_function:libsec_static",
71    "googletest:gmock_main",
72    "googletest:gtest_main",
73    "init:libbegetutil_static",
74    "openssl:libcrypto_shared",
75    "openssl:libssl_static",
76  ]
77  configs = [ "${updater_path}/test/unittest:utest_config" ]
78  install_enable = true
79  part_name = "updater"
80}
81