1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 2# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without modification, 5# are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this list of 8# conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, this list 11# of conditions and the following disclaimer in the documentation and/or other materials 12# provided with the distribution. 13# 14# 3. Neither the name of the copyright holder nor the names of its contributors may be used 15# to endorse or promote products derived from this software without specific prior written 16# permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30import("config.gni") 31 32local_flags = [ 33 "-fpermissive", 34 "-O2", 35 "-fbuiltin", 36 "-Wno-narrowing", 37 "-fPIE", 38] 39if (LOSCFG_USER_TEST_SMP == "enable" || (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) { 40 local_flags += [ "-DLOSCFG_USER_TEST_SMP" ] 41} 42 43config("public_config_for_door") { 44 cflags = [ 45 "-DLOSCFG_USER_TEST_SMOKE", 46 ] 47 cflags += local_flags 48 cflags_cc = cflags 49} 50 51config("public_config_for_all") { 52 cflags = [ 53 "-DLOSCFG_USER_TEST_SMOKE", 54 "-DLOSCFG_USER_TEST_FULL", 55 ] 56 cflags += local_flags 57 cflags_cc = cflags 58} 59 60config("public_config_for_pressure") { 61 cflags = [ 62 "-DLOSCFG_USER_TEST_PRESSURE", 63 ] 64 cflags += local_flags 65 cflags_cc = cflags 66} 67 68group("unittest") { 69 deps = [] 70 if (ohos_build_type == "debug") { 71 if (LOSCFG_USER_TEST_FS_JFFS == true) { 72 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 73 deps += [ "fs:liteos_a_fs_unittest_door" ] 74 } 75 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 76 deps += [ "fs:liteos_a_fs_unittest" ] 77 } 78 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { 79 deps += [ "fs:liteos_a_fs_unittest_pressure" ] 80 } 81 } 82 if (LOSCFG_USER_TEST_FS_VFAT == true) { 83 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 84 deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_door" ] 85 } 86 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 87 deps += [ "fs/vfat:liteos_a_fs_vfat_unittest" ] 88 } 89 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { 90 deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_pressure" ] 91 } 92 } 93 if (LOSCFG_USER_TEST_FS_PROC == true) { 94 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 95 deps += [ "fs/proc:liteos_a_fs_procfs_unittest_door" ] 96 } 97 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 98 deps += [ "fs/proc:liteos_a_fs_procfs_unittest" ] 99 } 100 } 101 if (LOSCFG_USER_TEST_MISC == true) { 102 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 103 deps += [ "misc:liteos_a_misc_unittest_door" ] 104 } 105 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 106 deps += [ "misc:liteos_a_misc_unittest" ] 107 } 108 } 109 if (LOSCFG_USER_TEST_DRIVERS_HID == true) { 110 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 111 deps += [ "drivers/hid:liteos_a_drivers_hid_unittest_door" ] 112 } 113 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 114 deps += [ "drivers/hid:liteos_a_drivers_hid_unittest" ] 115 } 116 } 117 if (LOSCFG_USER_TEST_DRIVERS_STORAGE == true) { 118 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 119 deps += [ "drivers/storage:liteos_a_drivers_storage_unittest_door" ] 120 } 121 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 122 deps += [ "drivers/storage:liteos_a_drivers_storage_unittest" ] 123 } 124 } 125 if (LOSCFG_USER_TEST_DYNLOAD == true) { 126 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 127 deps += [ "dynload:liteos_a_dynload_unittest_door" ] 128 } 129 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 130 deps += [ "dynload:liteos_a_dynload_unittest" ] 131 } 132 } 133 if (LOSCFG_USER_TEST_EXC == true) { 134 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 135 deps += [ "exc:liteos_a_exc_unittest_door" ] 136 } 137 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 138 deps += [ "exc:liteos_a_exc_unittest" ] 139 } 140 } 141 if (LOSCFG_USER_TEST_IO == true) { 142 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 143 deps += [ "IO:liteos_a_io_unittest_door" ] 144 } 145 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 146 deps += [ "IO:liteos_a_io_unittest" ] 147 } 148 } 149 if (LOSCFG_USER_TEST_IPC == true) { 150 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 151 deps += [ "IPC:liteos_a_ipc_unittest_door" ] 152 } 153 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 154 deps += [ "IPC:liteos_a_ipc_unittest" ] 155 } 156 } 157 if (LOSCFG_USER_TEST_LITEIPC == true) { 158 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 159 deps += [ "liteipc:liteos_a_liteipc_unittest_door" ] 160 } 161 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 162 deps += [ "liteipc:liteos_a_liteipc_unittest" ] 163 } 164 } 165 if (LOSCFG_USER_TEST_MEM_SHM == true) { 166 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 167 deps += [ "mem/shm:liteos_a_mem_shm_unittest_door" ] 168 } 169 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 170 deps += [ "mem/shm:liteos_a_mem_shm_unittest" ] 171 } 172 } 173 if (LOSCFG_USER_TEST_MEM_VM == true) { 174 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 175 deps += [ "mem/vm:liteos_a_mem_vm_unittest_door" ] 176 } 177 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 178 deps += [ "mem/vm:liteos_a_mem_vm_unittest" ] 179 } 180 } 181 if (LOSCFG_USER_TEST_NET_NETDB == true) { 182 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 183 deps += [ "net/netdb:liteos_a_net_netdb_unittest_door" ] 184 } 185 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 186 deps += [ "net/netdb:liteos_a_net_netdb_unittest" ] 187 } 188 } 189 if (LOSCFG_USER_TEST_NET_RESOLV == true) { 190 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 191 deps += [ "net/resolv:liteos_a_net_resolv_unittest_door" ] 192 } 193 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 194 deps += [ "net/resolv:liteos_a_net_resolv_unittest" ] 195 } 196 } 197 if (LOSCFG_USER_TEST_NET_SOCKET == true) { 198 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 199 deps += [ "net/socket:liteos_a_net_socket_unittest_door" ] 200 } 201 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 202 deps += [ "net/socket:liteos_a_net_socket_unittest" ] 203 } 204 } 205 if (LOSCFG_USER_TEST_POSIX_MEM == true) { 206 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 207 deps += [ "posix/mem:liteos_a_posix_mem_unittest_door" ] 208 } 209 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 210 deps += [ "posix/mem:liteos_a_posix_mem_unittest" ] 211 } 212 } 213 if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) { 214 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 215 deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest_door" ] 216 } 217 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 218 deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest" ] 219 } 220 } 221 if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) { 222 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 223 deps += [ "posix/pthread:liteos_a_posix_pthread_unittest_door" ] 224 } 225 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 226 deps += [ "posix/pthread:liteos_a_posix_pthread_unittest" ] 227 } 228 } 229 if (LOSCFG_USER_TEST_MUTEX == true) { 230 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 231 deps += [ "process/mutex:liteos_a_mutex_unittest_door" ] 232 } 233 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 234 deps += [ "process/mutex:liteos_a_mutex_unittest" ] 235 } 236 } 237 if (LOSCFG_USER_TEST_PROCESS == true) { 238 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 239 deps += [ "process/process:liteos_a_process_unittest_door" ] 240 } 241 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 242 deps += [ "process/process:liteos_a_process_unittest" ] 243 } 244 } 245 if (LOSCFG_USER_TEST_PTHREAD == true) { 246 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 247 deps += [ "process/pthread:liteos_a_pthread_unittest_door" ] 248 } 249 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 250 deps += [ "process/pthread:liteos_a_pthread_unittest" ] 251 } 252 } 253 if (LOSCFG_USER_TEST_RWLOCK == true) { 254 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 255 deps += [ "process/rwlock:liteos_a_rwlock_unittest_door" ] 256 } 257 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 258 deps += [ "process/rwlock:liteos_a_rwlock_unittest" ] 259 } 260 } 261 if (LOSCFG_USER_TEST_SPINLOCK == true) { 262 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 263 deps += [ "process/spinlock:liteos_a_spinlock_unittest_door" ] 264 } 265 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 266 deps += [ "process/spinlock:liteos_a_spinlock_unittest" ] 267 } 268 } 269 if (LOSCFG_USER_TEST_SECURITY_REUGID == true) { 270 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 271 deps += [ "security/reugid:liteos_a_security_reugid_unittest_door" ] 272 } 273 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 274 deps += [ "security/reugid:liteos_a_security_reugid_unittest" ] 275 } 276 } 277 if (LOSCFG_USER_TEST_SECURITY_CAPABILITY == true) { 278 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 279 deps += [ "security/capability:liteos_a_security_capability_unittest_door" ] 280 } 281 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 282 deps += [ "security/capability:liteos_a_security_capability_unittest" ] 283 } 284 } 285 if (LOSCFG_USER_TEST_SECURITY_VID == true) { 286 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 287 deps += [ "security/vid:liteos_a_security_vid_unittest_door" ] 288 } 289 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 290 deps += [ "security/vid:liteos_a_security_vid_unittest" ] 291 } 292 } 293 if (LOSCFG_USER_TEST_UTIL == true) { 294 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 295 deps += [ "util:liteos_a_util_unittest_door" ] 296 } 297 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 298 deps += [ "util:liteos_a_util_unittest" ] 299 } 300 } 301 if (LOSCFG_USER_TEST_TIME_TIMER == true) { 302 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 303 deps += [ "time/timer:liteos_a_time_timer_unittest_door" ] 304 } 305 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 306 deps += [ "time/timer:liteos_a_time_timer_unittest" ] 307 } 308 } 309 if (LOSCFG_USER_TEST_TIME_CLOCK == true) { 310 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 311 deps += [ "time/clock:liteos_a_time_clock_unittest_door" ] 312 } 313 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 314 deps += [ "time/clock:liteos_a_time_clock_unittest" ] 315 } 316 } 317 if (LOSCFG_USER_TEST_SYS == true) { 318 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 319 deps += [ "sys:liteos_a_sys_unittest_door" ] 320 } 321 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 322 deps += [ "sys:liteos_a_sys_unittest" ] 323 } 324 } 325 if (LOSCFG_USER_TEST_SIGNAL == true) { 326 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 327 deps += [ "signal:liteos_a_signal_unittest_door" ] 328 } 329 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 330 deps += [ "signal:liteos_a_signal_unittest" ] 331 } 332 } 333 if (LOSCFG_USER_TEST_TRACE == true) { 334 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 335 deps += [ "trace:liteos_a_trace_unittest_door" ] 336 } 337 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 338 deps += [ "trace:liteos_a_trace_unittest" ] 339 } 340 } 341 } 342} 343