1# Copyright (c) 2021 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("//build/test.gni") 15import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni") 16 17ROOT_DIR = "${storage_daemon_path}" 18 19ohos_unittest("disk_manager_test") { 20 branch_protector_ret = "pac_ret" 21 sanitize = { 22 integer_overflow = true 23 cfi = true 24 cfi_cross_dso = true 25 debug = false 26 } 27 module_out_path = "storage_service/storage_daemon" 28 29 defines = [ 30 "STORAGE_LOG_TAG = \"StorageDaemon\"", 31 "LOG_DOMAIN = 0xD004301", 32 ] 33 34 include_dirs = [ 35 "$ROOT_DIR/include", 36 "${storage_service_path}/utils/include", 37 "${storage_manager_path}/include", 38 "${storage_interface_path}/innerkits/storage_manager/native", 39 "${storage_service_common_path}/include", 40 ] 41 42 sources = [ 43 "$ROOT_DIR/disk/src/disk_config.cpp", 44 "$ROOT_DIR/disk/src/disk_info.cpp", 45 "$ROOT_DIR/disk/src/disk_manager.cpp", 46 "$ROOT_DIR/disk/test/disk_manager_test.cpp", 47 "$ROOT_DIR/ipc/src/storage_manager_client.cpp", 48 "$ROOT_DIR/netlink/src/netlink_data.cpp", 49 "$ROOT_DIR/volume/src/external_volume_info.cpp", 50 "$ROOT_DIR/volume/src/process.cpp", 51 "$ROOT_DIR/volume/src/volume_info.cpp", 52 "$ROOT_DIR/volume/src/volume_manager.cpp", 53 ] 54 55 deps = [ 56 "$ROOT_DIR:storage_common_utils", 57 "//third_party/googletest:gtest_main", 58 ] 59 60 external_deps = [ 61 "c_utils:utils", 62 "hilog:libhilog", 63 "init:libbegetutil", 64 "ipc:ipc_single", 65 "safwk:system_ability_fwk", 66 "samgr:samgr_proxy", 67 "storage_service:storage_manager_sa_proxy", 68 ] 69} 70 71ohos_unittest("disk_info_test") { 72 branch_protector_ret = "pac_ret" 73 sanitize = { 74 integer_overflow = true 75 cfi = true 76 cfi_cross_dso = true 77 debug = false 78 blocklist = "${storage_service_path}/cfi_blocklist.txt" 79 } 80 module_out_path = "storage_service/storage_daemon" 81 82 defines = [ 83 "STORAGE_LOG_TAG = \"StorageDaemon\"", 84 "LOG_DOMAIN = 0xD004301", 85 ] 86 87 include_dirs = [ 88 "$ROOT_DIR/disk/test", 89 "$ROOT_DIR/include", 90 "${storage_service_path}/utils/include", 91 "${storage_manager_path}/include", 92 "${storage_interface_path}/innerkits/storage_manager/native", 93 "${storage_service_common_path}/include", 94 ] 95 96 sources = [ 97 "$ROOT_DIR/disk/src/disk_info.cpp", 98 "$ROOT_DIR/disk/test/disk_info_test.cpp", 99 "$ROOT_DIR/ipc/src/storage_manager_client.cpp", 100 "$ROOT_DIR/netlink/src/netlink_data.cpp", 101 "$ROOT_DIR/volume/src/external_volume_info.cpp", 102 "$ROOT_DIR/volume/src/process.cpp", 103 "$ROOT_DIR/volume/src/volume_info.cpp", 104 "$ROOT_DIR/volume/src/volume_manager.cpp", 105 ] 106 107 deps = [ 108 "$ROOT_DIR:storage_common_utils", 109 "//third_party/googletest:gmock_main", 110 "//third_party/googletest:gtest_main", 111 ] 112 113 external_deps = [ 114 "c_utils:utils", 115 "hilog:libhilog", 116 "init:libbegetutil", 117 "ipc:ipc_single", 118 "safwk:system_ability_fwk", 119 "samgr:samgr_proxy", 120 "storage_service:storage_manager_sa_proxy", 121 ] 122} 123 124ohos_unittest("disk_info_sup_test") { 125 branch_protector_ret = "pac_ret" 126 sanitize = { 127 integer_overflow = true 128 cfi = true 129 cfi_cross_dso = true 130 debug = false 131 blocklist = "${storage_service_path}/cfi_blocklist.txt" 132 } 133 module_out_path = "storage_service/storage_daemon" 134 135 defines = [ 136 "STORAGE_LOG_TAG = \"StorageDaemon\"", 137 "LOG_DOMAIN = 0xD004301", 138 "private=public", 139 ] 140 141 include_dirs = [ 142 "$ROOT_DIR/include", 143 "${storage_service_path}/utils/include", 144 "${storage_manager_path}/include", 145 "${storage_interface_path}/innerkits/storage_manager/native", 146 "${storage_service_common_path}/include", 147 ] 148 149 sources = [ 150 "$ROOT_DIR/disk/src/disk_info.cpp", 151 "$ROOT_DIR/disk/test/disk_info_sup_test.cpp", 152 "$ROOT_DIR/ipc/src/storage_manager_client.cpp", 153 "$ROOT_DIR/netlink/src/netlink_data.cpp", 154 "$ROOT_DIR/volume/src/external_volume_info.cpp", 155 "$ROOT_DIR/volume/src/process.cpp", 156 "$ROOT_DIR/volume/src/volume_info.cpp", 157 "$ROOT_DIR/volume/src/volume_manager.cpp", 158 ] 159 160 deps = [ "$ROOT_DIR:storage_common_utils" ] 161 162 external_deps = [ 163 "c_utils:utils", 164 "googletest:gmock_main", 165 "googletest:gtest_main", 166 "hilog:libhilog", 167 "init:libbegetutil", 168 "ipc:ipc_single", 169 "safwk:system_ability_fwk", 170 "samgr:samgr_proxy", 171 "storage_service:storage_manager_sa_proxy", 172 ] 173} 174 175ohos_unittest("disk_config_test") { 176 branch_protector_ret = "pac_ret" 177 sanitize = { 178 integer_overflow = true 179 cfi = true 180 cfi_cross_dso = true 181 debug = false 182 } 183 module_out_path = "storage_service/storage_daemon" 184 185 defines = [ 186 "STORAGE_LOG_TAG = \"StorageDaemon\"", 187 "LOG_DOMAIN = 0xD004301", 188 ] 189 190 include_dirs = [ 191 "$ROOT_DIR/disk/test", 192 "$ROOT_DIR/include", 193 "${storage_service_path}/utils/include", 194 "${storage_manager_path}/include", 195 "${storage_interface_path}/innerkits/storage_manager/native", 196 "${storage_service_common_path}/include", 197 ] 198 199 sources = [ 200 "$ROOT_DIR/disk/src/disk_config.cpp", 201 "$ROOT_DIR/disk/test/disk_config_test.cpp", 202 ] 203 204 deps = [ "//third_party/googletest:gmock_main" ] 205 206 external_deps = [ 207 "c_utils:utils", 208 "hilog:libhilog", 209 "ipc:ipc_single", 210 "safwk:system_ability_fwk", 211 ] 212} 213 214group("storage_daemon_disk_test") { 215 testonly = true 216 deps = [ 217 ":disk_config_test", 218 ":disk_info_sup_test", 219 ":disk_info_test", 220 ":disk_manager_test", 221 ] 222} 223