1# Copyright (c) 2023-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( 16 "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") 17 18module_out_path = unittest_output_path 19 20config("module_private_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ 23 "include", 24 "${utils_path}/include", 25 "${innerkits_path}/include/ipc", 26 "${services_path}/distributedhardwarefwkservice/include", 27 "${services_path}/distributedhardwarefwkservice/include/resourcemanager", 28 "${services_path}/distributedhardwarefwkservice/include/task", 29 "${services_path}/distributedhardwarefwkservice/include/utils", 30 "${common_path}/utils/include", 31 "${common_path}/log/include", 32 ] 33} 34 35## UnitTest resource_manager_test 36ohos_unittest("CapabilityInfoTest") { 37 module_out_path = module_out_path 38 39 sources = [ "capability_info_test.cpp" ] 40 41 configs = [ ":module_private_config" ] 42 43 cflags = [ 44 "-Wall", 45 "-Werror", 46 "-g3", 47 "-Dprivate=public", 48 ] 49 50 deps = [ 51 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 52 "${utils_path}:distributedhardwareutils", 53 ] 54 55 external_deps = [ 56 "cJSON:cjson", 57 "c_utils:utils", 58 "hilog:libhilog", 59 "kv_store:distributeddata_inner", 60 ] 61} 62 63ohos_unittest("DBAdapterTest") { 64 module_out_path = module_out_path 65 66 sources = [ "db_adapter_test.cpp" ] 67 68 configs = [ ":module_private_config" ] 69 70 cflags = [ 71 "-Wall", 72 "-Werror", 73 "-g3", 74 "-Dprivate=public", 75 ] 76 77 deps = [ 78 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 79 "${utils_path}:distributedhardwareutils", 80 ] 81 82 external_deps = [ 83 "cJSON:cjson", 84 "c_utils:utils", 85 "eventhandler:libeventhandler", 86 "hilog:libhilog", 87 "ipc:ipc_core", 88 "kv_store:distributeddata_inner", 89 ] 90} 91 92ohos_unittest("LocalCapInfoMgrTest") { 93 module_out_path = module_out_path 94 95 sources = [ "local_capability_info_manager_test.cpp" ] 96 97 configs = [ ":module_private_config" ] 98 99 cflags = [ 100 "-Wall", 101 "-Werror", 102 "-g3", 103 "-Dprivate=public", 104 ] 105 106 deps = [ 107 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 108 "${utils_path}:distributedhardwareutils", 109 ] 110 111 external_deps = [ 112 "cJSON:cjson", 113 "c_utils:utils", 114 "eventhandler:libeventhandler", 115 "hilog:libhilog", 116 "kv_store:distributeddata_inner", 117 "safwk:system_ability_fwk", 118 ] 119} 120 121ohos_unittest("MetaCapInfoTest") { 122 module_out_path = module_out_path 123 124 sources = [ "meta_cap_info_test.cpp" ] 125 126 configs = [ ":module_private_config" ] 127 128 cflags = [ 129 "-Wall", 130 "-Werror", 131 "-g3", 132 "-Dprivate=public", 133 ] 134 135 deps = [ 136 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 137 "${utils_path}:distributedhardwareutils", 138 ] 139 140 external_deps = [ 141 "cJSON:cjson", 142 "c_utils:utils", 143 "eventhandler:libeventhandler", 144 "hilog:libhilog", 145 "kv_store:distributeddata_inner", 146 ] 147} 148 149ohos_unittest("MetaInfoMgrTest") { 150 module_out_path = module_out_path 151 152 sources = [ "meta_info_manager_test.cpp" ] 153 154 configs = [ ":module_private_config" ] 155 156 cflags = [ 157 "-Wall", 158 "-Werror", 159 "-g3", 160 "-Dprivate=public", 161 ] 162 163 deps = [ 164 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 165 "${utils_path}:distributedhardwareutils", 166 ] 167 168 external_deps = [ 169 "cJSON:cjson", 170 "c_utils:utils", 171 "eventhandler:libeventhandler", 172 "hilog:libhilog", 173 "ipc:ipc_core", 174 "kv_store:distributeddata_inner", 175 "safwk:system_ability_fwk", 176 ] 177} 178 179ohos_unittest("ResourceManagerTest") { 180 module_out_path = module_out_path 181 182 sources = [ "resource_manager_test.cpp" ] 183 184 configs = [ ":module_private_config" ] 185 186 cflags = [ 187 "-Wall", 188 "-Werror", 189 "-g3", 190 "-Dprivate=public", 191 ] 192 193 deps = [ 194 "${innerkits_path}:libdhfwk_sdk", 195 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 196 "${utils_path}:distributedhardwareutils", 197 ] 198 199 external_deps = [ 200 "cJSON:cjson", 201 "c_utils:utils", 202 "eventhandler:libeventhandler", 203 "hilog:libhilog", 204 "ipc:ipc_core", 205 "kv_store:distributeddata_inner", 206 "safwk:system_ability_fwk", 207 ] 208} 209 210ohos_unittest("VersionInfoTest") { 211 module_out_path = module_out_path 212 213 sources = [ "version_info_test.cpp" ] 214 215 configs = [ ":module_private_config" ] 216 217 cflags = [ 218 "-Wall", 219 "-Werror", 220 "-g3", 221 "-Dprivate=public", 222 ] 223 224 deps = [ 225 "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", 226 "${utils_path}:distributedhardwareutils", 227 ] 228 229 external_deps = [ 230 "cJSON:cjson", 231 "c_utils:utils", 232 "hilog:libhilog", 233 "kv_store:distributeddata_inner", 234 ] 235} 236 237group("resource_manager_test") { 238 testonly = true 239 deps = [ 240 ":CapabilityInfoTest", 241 ":DBAdapterTest", 242 ":LocalCapInfoMgrTest", 243 ":MetaCapInfoTest", 244 ":MetaInfoMgrTest", 245 ":ResourceManagerTest", 246 ":VersionInfoTest", 247 ] 248} 249