1# Copyright (c) 2021-2025 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("user_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_service/storage_daemon" 28 29 defines = [ 30 "STORAGE_LOG_TAG = \"StorageDaemon\"", 31 "LOG_DOMAIN = 0xD004301", 32 "private=public", 33 ] 34 35 if (storage_service_user_crypto_manager) { 36 defines += [ "USER_CRYPTO_MANAGER" ] 37 } 38 39 include_dirs = [ 40 "$ROOT_DIR/include", 41 "$ROOT_DIR/utils", 42 "${storage_service_common_path}/include", 43 "${storage_interface_path}/innerkits/storage_manager/native", 44 ] 45 46 sources = [ 47 "$ROOT_DIR/crypto/test/key_manager_mock.cpp", 48 "$ROOT_DIR/quota/quota_manager.cpp", 49 "$ROOT_DIR/user/src/mount_manager.cpp", 50 "$ROOT_DIR/user/src/mount_manager_ext.cpp", 51 "$ROOT_DIR/user/src/user_manager.cpp", 52 "$ROOT_DIR/user/test/user_manager_test.cpp", 53 "$ROOT_DIR/utils/mount_argument_utils.cpp", 54 "$ROOT_DIR/utils/test/common/help_utils.cpp", 55 ] 56 57 deps = [ 58 "$ROOT_DIR:storage_common_utils", 59 "${storage_daemon_path}:storage_daemon_header", 60 ] 61 62 external_deps = [ 63 "ability_base:zuri", 64 "app_file_service:fileuri_native", 65 "app_file_service:sandbox_helper_native", 66 "bundle_framework:appexecfwk_core", 67 "c_utils:utils", 68 "googletest:gmock_main", 69 "googletest:gtest_main", 70 "hilog:libhilog", 71 "hisysevent:libhisysevent", 72 "huks:libhukssdk", 73 "init:libbegetutil", 74 "ipc:ipc_single", 75 "ipc:libdbinder", 76 ] 77 78 if (storage_service_cloud_fuse) { 79 defines += [ "DFS_SERVICE" ] 80 external_deps += [ "dfs_service:cloud_daemon_kit_inner" ] 81 } 82 83 if (enable_huks_hdi) { 84 defines += [ "HUKS_IDL_ENVIRONMENT" ] 85 external_deps += [ "drivers_interface_huks:libhuks_proxy_1.1", ] 86 } 87} 88 89ohos_unittest("mount_manager_test") { 90 branch_protector_ret = "pac_ret" 91 sanitize = { 92 integer_overflow = true 93 cfi = true 94 cfi_cross_dso = true 95 debug = false 96 blocklist = "${storage_service_path}/cfi_blocklist.txt" 97 } 98 module_out_path = "storage_service/storage_service/storage_daemon" 99 100 defines = [ 101 "STORAGE_LOG_TAG = \"StorageDaemon\"", 102 "LOG_DOMAIN = 0xD004301", 103 "private=public", 104 ] 105 106 if (storage_service_user_crypto_manager) { 107 defines += [ "USER_CRYPTO_MANAGER" ] 108 } 109 110 include_dirs = [ 111 "$ROOT_DIR/include", 112 "$ROOT_DIR/include/mock", 113 "$ROOT_DIR/utils", 114 "${storage_service_common_path}/include", 115 "${storage_interface_path}/innerkits/storage_manager/native", 116 ] 117 118 sources = [ 119 "$ROOT_DIR/mock/file_utils_mock.cpp", 120 "$ROOT_DIR/mock/library_func_mock.cpp", 121 "$ROOT_DIR/mock/parameter_mock.cpp", 122 "$ROOT_DIR/user/src/mount_manager.cpp", 123 "$ROOT_DIR/user/src/mount_manager_ext.cpp", 124 "$ROOT_DIR/user/test/mount_manager_test.cpp", 125 "$ROOT_DIR/utils/disk_utils.cpp", 126 "$ROOT_DIR/utils/mount_argument_utils.cpp", 127 "$ROOT_DIR/utils/storage_radar.cpp", 128 "$ROOT_DIR/utils/string_utils.cpp", 129 ] 130 131 deps = [ 132 #"$ROOT_DIR:storage_common_utils", 133 "$ROOT_DIR:storage_daemon_header", 134 ] 135 136 external_deps = [ 137 "c_utils:utils", 138 "googletest:gmock_main", 139 "googletest:gtest_main", 140 "hilog:libhilog", 141 "hisysevent:libhisysevent", 142 "huks:libhukssdk", 143 "init:libbegetutil", 144 "samgr:samgr_proxy", 145 ] 146 147 if (storage_service_cloud_fuse) { 148 defines += [ "DFS_SERVICE" ] 149 external_deps += [ "dfs_service:cloud_daemon_kit_inner" ] 150 } 151 152 if (enable_huks_hdi) { 153 defines += [ "HUKS_IDL_ENVIRONMENT" ] 154 external_deps += [ "drivers_interface_huks:libhuks_proxy_1.1", ] 155 } 156} 157 158group("storage_daemon_user_test") { 159 testonly = true 160 deps = [ 161 ":mount_manager_test", 162 ":user_manager_test", 163 ] 164} 165