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 "//third_party/googletest:gtest_main", 50 ] 51 52 external_deps = [ 53 "ability_runtime:tools_aa_source_set", 54 "c_utils:utils", 55 "hilog:libhilog", 56 "ipc:ipc_single", 57 "os_account:os_account_innerkits", 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 "//third_party/googletest:gtest_main", 92 ] 93 94 external_deps = [ 95 "ability_runtime:tools_aa_source_set", 96 "c_utils:utils", 97 "hilog:libhilog", 98 "ipc:ipc_single", 99 "os_account:os_account_innerkits", 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 "//third_party/googletest:gtest_main", 134 ] 135 136 external_deps = [ 137 "ability_runtime:tools_aa_source_set", 138 "c_utils:utils", 139 "hilog:libhilog", 140 "ipc:ipc_single", 141 "os_account:os_account_innerkits", 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 "//third_party/googletest:gtest_main", 176 ] 177 178 external_deps = [ 179 "ability_runtime:tools_aa_source_set", 180 "c_utils:utils", 181 "hilog:libhilog", 182 "ipc:ipc_single", 183 "os_account:os_account_innerkits", 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 "//third_party/googletest:gtest_main", 218 ] 219 220 external_deps = [ 221 "ability_runtime:tools_aa_source_set", 222 "c_utils:utils", 223 "hilog:libhilog", 224 "ipc:ipc_single", 225 "os_account:os_account_innerkits", 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 "//third_party/googletest:gtest_main", 261 ] 262 263 external_deps = [ 264 "ability_runtime:tools_aa_source_set", 265 "c_utils:utils", 266 "hilog:libhilog", 267 "ipc:ipc_single", 268 "os_account:os_account_innerkits", 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