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("updater_service_unittest") {
21  defines = [ "UPDATER_UT" ]
22  testonly = true
23  resource_config_file = "${updater_path}/test/unittest/test_data/ohos_test.xml"
24  module_out_path = MODULE_OUTPUT_PATH
25  sources = [
26    "${updater_path}/services/factory_reset/factory_reset.cpp",
27    "${updater_path}/services/hwfault_retry/hwfault_retry.cpp",
28    "${updater_path}/services/sdcard_update/sdcard_update.cpp",
29    "${updater_path}/services/updater.cpp",
30    "${updater_path}/services/updater_main.cpp",
31    "${updater_path}/services/updater_preprocess.cpp",
32    "${updater_path}/services/updater_utils.cpp",
33    "${updater_path}/utils/utils.cpp",
34    "updater_service_unittest.cpp",
35  ]
36  include_dirs = [
37    "include",
38    "${updater_path}/services/factory_reset/",
39    "${updater_path}/interfaces/kits/include/",
40    "${updater_path}/services/common",
41    "${updater_path}/services/include/package",
42    "${updater_path}/services/package/pkg_manager",
43    "${updater_path}/services/package/pkg_verify",
44    "${updater_path}/services/include/log",
45    "${updater_path}/utils/include",
46    "${updater_path}/utils/json",
47    "${updater_path}/services",
48    "${updater_path}/services/ui",
49    "${updater_path}/services/ui/include",
50    "${updater_path}/services/include",
51    "${updater_path}/services/ui/view",
52  ]
53
54  deps = [
55    "${updater_path}/interfaces/kits/misc_info:libmiscinfo",
56    "${updater_path}/interfaces/kits/packages:libpackageExt",
57    "${updater_path}/services/applypatch:libapplypatch",
58    "${updater_path}/services/diffpatch/patch:libpatch",
59    "${updater_path}/services/fs_manager:libfsmanager",
60    "${updater_path}/services/log:libupdaterlog",
61    "${updater_path}/services/package:libupdaterpackage",
62    "${updater_path}/services/write_state:libwritestate",
63    "${updater_path}/utils:libutils",
64  ]
65
66  external_deps = [
67    "bounds_checking_function:libsec_shared",
68    "bounds_checking_function:libsec_static",
69    "bzip2:libbz2",
70    "cJSON:cjson",
71    "hilog:libhilog",
72    "init:libbegetutil_static",
73    "libdrm:libdrm",
74    "openssl:libcrypto_shared",
75    "openssl:libssl_static",
76    "ui_lite:libupdater_layout",
77    "zlib:libz",
78  ]
79  configs = [ "${updater_path}/test/unittest:utest_config" ]
80  install_enable = true
81  part_name = "updater"
82}
83