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 17updater_path = rebase_path("${updater_absolutely_path}", ".") 18 19MODULE_OUTPUT_PATH = "updater/updater_test" 20HDC_PATH = "//developtools/hdc/src" 21 22ohos_unittest("flashd_unittest") { 23 testonly = true 24 resource_config_file = 25 "//base/update/updater/test/unittest/test_data/ohos_test.xml" 26 module_out_path = MODULE_OUTPUT_PATH 27 sources = [ 28 "${HDC_PATH}/common/async_cmd.cpp", 29 "${HDC_PATH}/common/auth.cpp", 30 "${HDC_PATH}/common/base.cpp", 31 "${HDC_PATH}/common/channel.cpp", 32 "${HDC_PATH}/common/circle_buffer.cpp", 33 "${HDC_PATH}/common/compress.cpp", 34 "${HDC_PATH}/common/debug.cpp", 35 "${HDC_PATH}/common/decompress.cpp", 36 "${HDC_PATH}/common/entry.cpp", 37 "${HDC_PATH}/common/file.cpp", 38 "${HDC_PATH}/common/file_descriptor.cpp", 39 "${HDC_PATH}/common/forward.cpp", 40 "${HDC_PATH}/common/header.cpp", 41 "${HDC_PATH}/common/session.cpp", 42 "${HDC_PATH}/common/task.cpp", 43 "${HDC_PATH}/common/tcp.cpp", 44 "${HDC_PATH}/common/transfer.cpp", 45 "${HDC_PATH}/common/usb.cpp", 46 "${HDC_PATH}/daemon/daemon_app.cpp", 47 "${HDC_PATH}/daemon/daemon_forward.cpp", 48 "${HDC_PATH}/daemon/daemon_tcp.cpp", 49 "${HDC_PATH}/daemon/daemon_unity.cpp", 50 "${HDC_PATH}/daemon/daemon_usb.cpp", 51 "${HDC_PATH}/daemon/jdwp.cpp", 52 "${HDC_PATH}/daemon/shell.cpp", 53 "${updater_path}/services/flashd/daemon/commander.cpp", 54 "${updater_path}/services/flashd/daemon/commander_factory.cpp", 55 "${updater_path}/services/flashd/daemon/daemon_updater.cpp", 56 "${updater_path}/services/flashd/daemon/erase_commander.cpp", 57 "${updater_path}/services/flashd/daemon/flash_commander.cpp", 58 "${updater_path}/services/flashd/daemon/flashd_utils.cpp", 59 "${updater_path}/services/flashd/daemon/format_commander.cpp", 60 "${updater_path}/services/flashd/daemon/update_commander.cpp", 61 "${updater_path}/services/flashd/image_writer/image_writer.cpp", 62 "${updater_path}/services/flashd/partition.cpp", 63 "${updater_path}/services/hdi/client/update_hdi_client.cpp", 64 "${updater_path}/services/hdi/server/update_hdi_impl.cpp", 65 "${updater_path}/services/updater_utils.cpp", 66 "flashd_unittest.cpp", 67 ] 68 include_dirs = [ 69 "${HDC_PATH}/daemon", 70 "${HDC_PATH}/common", 71 "${updater_path}/services", 72 "${updater_path}/services/common", 73 "${updater_path}/services/flashd", 74 "${updater_path}/services/flashd/daemon", 75 "${updater_path}/services/flashd/common", 76 "${updater_path}/interfaces/kits/include", 77 "${updater_path}/services/include/package", 78 "${updater_path}/services/include/ptable_parse", 79 "${updater_path}/services/include/script", 80 "${updater_path}/services/ui", 81 "${updater_path}/services/include/log", 82 "${updater_path}/services/include", 83 "${updater_path}/services/ptable_parse", 84 "${updater_path}/utils/include", 85 "${updater_path}/utils/json", 86 "//base/startup/init/services/include/param", 87 "//third_party/bounds_checking_function/include", 88 "//third_party/cJSON", 89 "//third_party/lz4/lib", 90 "//third_party/libuv", 91 ] 92 93 deps = [ 94 "${updater_path}/interfaces/kits/misc_info:libmiscinfo", 95 "${updater_path}/interfaces/kits/updaterkits:libupdaterkits", 96 "${updater_path}/services:updater", 97 "${updater_path}/services/applypatch:libapplypatch", 98 "${updater_path}/services/diffpatch/patch:libpatch", 99 "${updater_path}/services/flashd:hdc_hash_gen", 100 "${updater_path}/services/fs_manager:libfsmanager", 101 "${updater_path}/services/hdi/server:libupdate_hdi_impl", 102 "${updater_path}/services/log:libupdaterlog", 103 "${updater_path}/services/package:libupdaterpackage", 104 "${updater_path}/services/script:libupdaterscript", 105 "${updater_path}/utils:libutils", 106 "//third_party/bounds_checking_function:libsec_static", 107 "//third_party/bzip2:libbz2", 108 "//third_party/cJSON:cjson", 109 "//third_party/googletest:gmock_main", 110 "//third_party/googletest:gtest_main", 111 "//third_party/libuv:uv", 112 "//third_party/lz4:liblz4_static", 113 "//third_party/openssl:libcrypto_shared", 114 "//third_party/zlib:libz", 115 ] 116 117 external_deps = [ 118 "hilog:libhilog", 119 "init:libbegetutil_static", 120 ] 121 configs = [ "${updater_path}/test/unittest:utest_config" ] 122 install_enable = true 123 part_name = "updater" 124 defines = [ 125 "UPDATER_UT", 126 "OPENSSL_SUPPRESS_DEPRECATED", 127 ] 128} 129 130ohos_unittest("flashd_utils_unittest") { 131 testonly = true 132 resource_config_file = "${updater_path}/test/unittest/test_data/ohos_test.xml" 133 module_out_path = MODULE_OUTPUT_PATH 134 sources = [ 135 "${updater_path}/services/flashd/daemon/flashd_utils.cpp", 136 "flashd_utils_unittest.cpp", 137 ] 138 include_dirs = [ 139 "${updater_path}/services/include", 140 "${updater_path}/utils/include", 141 "${updater_path}/services/flashd", 142 "//third_party/libuv", 143 "${updater_path}/interfaces/kits/include", 144 "${updater_path}/services/common", 145 "${updater_path}/services/flashd/common", 146 ] 147 148 external_deps = [ 149 "c_utils:utils", 150 "hilog:libhilog", 151 "init:libbegetutil_static", 152 ] 153 deps = [ "//third_party/libuv:uv" ] 154 configs = [ "${updater_path}/test/unittest:utest_config" ] 155 install_enable = true 156 part_name = "updater" 157 defines = [ 158 "OPENSSL_SUPPRESS_DEPRECATED", 159 "HDC_SUPPORT_FLASHD", 160 ] 161} 162