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_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/user_manager.cpp", 51 "$ROOT_DIR/user/test/user_manager_test.cpp", 52 "$ROOT_DIR/utils/mount_argument_utils.cpp", 53 "$ROOT_DIR/utils/test/common/help_utils.cpp", 54 ] 55 56 deps = [ 57 "$ROOT_DIR:storage_common_utils", 58 "//third_party/googletest:gtest_main", 59 ] 60 61 external_deps = [ 62 "ability_base:zuri", 63 "app_file_service:fileuri_native", 64 "app_file_service:sandbox_helper_native", 65 "bundle_framework:appexecfwk_core", 66 "c_utils:utils", 67 "hilog:libhilog", 68 "hisysevent:libhisysevent", 69 "huks:libhukssdk", 70 "init:libbegetutil", 71 "ipc:ipc_single", 72 "ipc:libdbinder", 73 ] 74 75 if (storage_service_cloud_fuse) { 76 defines += [ "DFS_SERVICE" ] 77 external_deps += [ "dfs_service:cloud_daemon_kit_inner" ] 78 } 79} 80 81ohos_unittest("mount_manager_test") { 82 branch_protector_ret = "pac_ret" 83 sanitize = { 84 integer_overflow = true 85 cfi = true 86 cfi_cross_dso = true 87 debug = false 88 blocklist = "${storage_service_path}/cfi_blocklist.txt" 89 } 90 module_out_path = "storage_service/storage_daemon" 91 92 defines = [ 93 "STORAGE_LOG_TAG = \"StorageDaemon\"", 94 "LOG_DOMAIN = 0xD004301", 95 "private=public", 96 ] 97 98 if (storage_service_user_crypto_manager) { 99 defines += [ "USER_CRYPTO_MANAGER" ] 100 } 101 102 include_dirs = [ 103 "$ROOT_DIR/include", 104 "$ROOT_DIR/include/mock", 105 "$ROOT_DIR/utils", 106 "${storage_service_common_path}/include", 107 "${storage_interface_path}/innerkits/storage_manager/native", 108 ] 109 110 sources = [ 111 "$ROOT_DIR/mock/file_utils_mock.cpp", 112 "$ROOT_DIR/mock/library_func_mock.cpp", 113 "$ROOT_DIR/user/src/mount_manager.cpp", 114 "$ROOT_DIR/user/test/mount_manager_test.cpp", 115 "$ROOT_DIR/utils/mount_argument_utils.cpp", 116 "$ROOT_DIR/utils/storage_radar.cpp", 117 "$ROOT_DIR/utils/string_utils.cpp", 118 ] 119 120 deps = [ 121 #"$ROOT_DIR:storage_common_utils", 122 ] 123 124 external_deps = [ 125 "c_utils:utils", 126 "googletest:gmock_main", 127 "googletest:gtest_main", 128 "hilog:libhilog", 129 "hisysevent:libhisysevent", 130 "huks:libhukssdk", 131 "init:libbegetutil", 132 ] 133 134 if (storage_service_cloud_fuse) { 135 defines += [ "DFS_SERVICE" ] 136 external_deps += [ "dfs_service:cloud_daemon_kit_inner" ] 137 } 138} 139 140group("storage_daemon_user_test") { 141 testonly = true 142 deps = [ 143 ":mount_manager_test", 144 ":user_manager_test", 145 ] 146} 147