1# Copyright (c) 2021-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("../../../../os_account.gni") 16 17module_output_path = "os_account/tools" 18 19ohos_unittest("account_command_create_test") { 20 branch_protector_ret = "pac_ret" 21 22 sanitize = { 23 cfi = true 24 cfi_cross_dso = true 25 debug = false 26 } 27 28 module_out_path = module_output_path 29 30 include_dirs = [] 31 32 sources = [ 33 "${tools_path}/acm/src/account_command.cpp", 34 "account_command_create_test.cpp", 35 ] 36 37 configs = [ 38 "${ability_runtime_path}/tools/aa:ability_command_config", 39 "${tools_path}/acm:tools_acm_config", 40 ] 41 42 cflags = [] 43 if (target_cpu == "arm") { 44 cflags += [ "-DBINDER_IPC_32BIT" ] 45 } 46 47 deps = [ 48 "${common_path}:libaccount_common", 49 "${os_account_innerkits_native_path}:os_account_innerkits", 50 "//third_party/googletest:gtest_main", 51 ] 52 53 external_deps = [ 54 "ability_runtime:tools_aa_source_set", 55 "c_utils:utils", 56 "hilog:libhilog", 57 "ipc:ipc_single", 58 ] 59} 60 61ohos_unittest("account_command_delete_test") { 62 branch_protector_ret = "pac_ret" 63 64 sanitize = { 65 cfi = true 66 cfi_cross_dso = true 67 debug = false 68 } 69 70 module_out_path = module_output_path 71 72 include_dirs = [] 73 74 sources = [ 75 "${tools_path}/acm/src/account_command.cpp", 76 "account_command_delete_test.cpp", 77 ] 78 79 configs = [ 80 "${ability_runtime_path}/tools/aa:ability_command_config", 81 "${tools_path}/acm:tools_acm_config", 82 ] 83 84 cflags = [] 85 if (target_cpu == "arm") { 86 cflags += [ "-DBINDER_IPC_32BIT" ] 87 } 88 89 deps = [ 90 "${common_path}:libaccount_common", 91 "${os_account_innerkits_native_path}:os_account_innerkits", 92 "//third_party/googletest:gtest_main", 93 ] 94 95 external_deps = [ 96 "ability_runtime:tools_aa_source_set", 97 "c_utils:utils", 98 "hilog:libhilog", 99 "ipc:ipc_single", 100 ] 101} 102 103ohos_unittest("account_command_dump_test") { 104 branch_protector_ret = "pac_ret" 105 106 sanitize = { 107 cfi = true 108 cfi_cross_dso = true 109 debug = false 110 } 111 112 module_out_path = module_output_path 113 114 include_dirs = [] 115 116 sources = [ 117 "${tools_path}/acm/src/account_command.cpp", 118 "account_command_dump_test.cpp", 119 ] 120 121 configs = [ 122 "${ability_runtime_path}/tools/aa:ability_command_config", 123 "${tools_path}/acm:tools_acm_config", 124 ] 125 126 cflags = [] 127 if (target_cpu == "arm") { 128 cflags += [ "-DBINDER_IPC_32BIT" ] 129 } 130 131 deps = [ 132 "${common_path}:libaccount_common", 133 "${os_account_innerkits_native_path}:os_account_innerkits", 134 "//third_party/googletest:gtest_main", 135 ] 136 137 external_deps = [ 138 "ability_runtime:tools_aa_source_set", 139 "c_utils:utils", 140 "hilog:libhilog", 141 "ipc:ipc_single", 142 ] 143} 144 145ohos_unittest("account_command_set_test") { 146 branch_protector_ret = "pac_ret" 147 148 sanitize = { 149 cfi = true 150 cfi_cross_dso = true 151 debug = false 152 } 153 154 module_out_path = module_output_path 155 156 include_dirs = [] 157 158 sources = [ 159 "${tools_path}/acm/src/account_command.cpp", 160 "account_command_set_test.cpp", 161 ] 162 163 configs = [ 164 "${ability_runtime_path}/tools/aa:ability_command_config", 165 "${tools_path}/acm:tools_acm_config", 166 ] 167 168 cflags = [] 169 if (target_cpu == "arm") { 170 cflags += [ "-DBINDER_IPC_32BIT" ] 171 } 172 173 deps = [ 174 "${common_path}:libaccount_common", 175 "${os_account_innerkits_native_path}:os_account_innerkits", 176 "//third_party/googletest:gtest_main", 177 ] 178 179 external_deps = [ 180 "ability_runtime:tools_aa_source_set", 181 "c_utils:utils", 182 "hilog:libhilog", 183 "ipc:ipc_single", 184 ] 185} 186 187ohos_unittest("account_command_switch_test") { 188 branch_protector_ret = "pac_ret" 189 190 sanitize = { 191 cfi = true 192 cfi_cross_dso = true 193 debug = false 194 } 195 196 module_out_path = module_output_path 197 198 include_dirs = [] 199 200 sources = [ 201 "${tools_path}/acm/src/account_command.cpp", 202 "account_command_switch_test.cpp", 203 ] 204 205 configs = [ 206 "${ability_runtime_path}/tools/aa:ability_command_config", 207 "${tools_path}/acm:tools_acm_config", 208 ] 209 210 cflags = [] 211 if (target_cpu == "arm") { 212 cflags += [ "-DBINDER_IPC_32BIT" ] 213 } 214 215 deps = [ 216 "${common_path}:libaccount_common", 217 "${os_account_innerkits_native_path}:os_account_innerkits", 218 "//third_party/googletest:gtest_main", 219 ] 220 221 external_deps = [ 222 "ability_runtime:tools_aa_source_set", 223 "c_utils:utils", 224 "hilog:libhilog", 225 "ipc:ipc_single", 226 ] 227} 228 229ohos_unittest("account_command_test") { 230 branch_protector_ret = "pac_ret" 231 232 sanitize = { 233 cfi = true 234 cfi_cross_dso = true 235 debug = false 236 } 237 238 module_out_path = module_output_path 239 240 include_dirs = [] 241 242 sources = [ 243 "${tools_path}/acm/src/account_command.cpp", 244 "account_command_test.cpp", 245 ] 246 247 configs = [ 248 "${ability_runtime_path}/tools/aa:ability_command_config", 249 "${tools_path}/acm:tools_acm_config", 250 ] 251 252 cflags = [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ] 253 254 if (target_cpu == "arm") { 255 cflags += [ "-DBINDER_IPC_32BIT" ] 256 } 257 258 deps = [ 259 "${common_path}:libaccount_common", 260 "${os_account_innerkits_native_path}:os_account_innerkits", 261 "//third_party/googletest:gtest_main", 262 ] 263 264 external_deps = [ 265 "ability_runtime:tools_aa_source_set", 266 "c_utils:utils", 267 "hilog:libhilog", 268 "ipc:ipc_single", 269 ] 270} 271 272group("unittest") { 273 testonly = true 274 deps = [] 275 if (os_account_enable_multiple_os_accounts || use_clang_coverage) { 276 deps += [ 277 ":account_command_create_test", 278 ":account_command_delete_test", 279 ":account_command_dump_test", 280 ":account_command_set_test", 281 ":account_command_switch_test", 282 ":account_command_test", 283 ] 284 } 285} 286