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