BUILD.gn 12.3 KB
Newer Older
L
lnlan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
#    conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
#    of conditions and the following disclaimer in the documentation and/or other materials
#    provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
#    to endorse or promote products derived from this software without specific prior written
#    permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import("config.gni")

32 33 34 35 36 37 38
local_flags = [
  "-fpermissive",
  "-O2",
  "-fbuiltin",
  "-Wno-narrowing",
  "-fPIE",
]
39
if (LOSCFG_USER_TEST_SMP == "enable" || (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) {
40
  local_flags += [ "-DLOSCFG_USER_TEST_SMP" ]
L
lnlan 已提交
41
}
L
lnlan 已提交
42

43 44 45
config("public_config_for_door") {
  cflags = [
    "-DLOSCFG_USER_TEST_SMOKE",
46 47 48 49 50
  ]
  cflags += local_flags
  cflags_cc = cflags
}

51 52 53 54
config("public_config_for_all") {
  cflags = [
    "-DLOSCFG_USER_TEST_SMOKE",
    "-DLOSCFG_USER_TEST_FULL",
L
lnlan 已提交
55
  ]
56
  cflags += local_flags
L
lnlan 已提交
57
  cflags_cc = cflags
L
lnlan 已提交
58 59
}

60 61 62
config("public_config_for_pressure") {
  cflags = [
    "-DLOSCFG_USER_TEST_PRESSURE",
L
lnlan 已提交
63
  ]
64
  cflags += local_flags
L
lnlan 已提交
65 66 67 68 69
  cflags_cc = cflags
}

group("unittest") {
  deps = []
L
lnlan 已提交
70
  if (ohos_build_type == "debug") {
71 72 73
    if (LOSCFG_USER_TEST_FS_JFFS == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "fs:liteos_a_fs_unittest_door" ]
L
lnlan 已提交
74
      }
75 76 77 78 79
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "fs:liteos_a_fs_unittest" ]
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) {
        deps += [ "fs:liteos_a_fs_unittest_pressure" ]
L
lnlan 已提交
80 81
      }
    }
82 83
    if (LOSCFG_USER_TEST_FS_VFAT == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
F
Far 已提交
84
        deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_door" ]
L
lnlan 已提交
85
      }
86
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
F
Far 已提交
87
        deps += [ "fs/vfat:liteos_a_fs_vfat_unittest" ]
88 89
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) {
F
Far 已提交
90
        deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_pressure" ]
L
lnlan 已提交
91 92
      }
    }
93 94 95
    if (LOSCFG_USER_TEST_FS_PROC == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "fs/proc:liteos_a_fs_procfs_unittest_door" ]
L
lnlan 已提交
96
      }
97 98
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "fs/proc:liteos_a_fs_procfs_unittest" ]
L
lnlan 已提交
99 100
      }
    }
101 102 103
    if (LOSCFG_USER_TEST_MISC == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "misc:liteos_a_misc_unittest_door" ]
L
lnlan 已提交
104
      }
105 106
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "misc:liteos_a_misc_unittest" ]
L
lnlan 已提交
107 108
      }
    }
109 110 111
    if (LOSCFG_USER_TEST_DRIVERS_HID == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "drivers/hid:liteos_a_drivers_hid_unittest_door" ]
L
lnlan 已提交
112
      }
113 114
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "drivers/hid:liteos_a_drivers_hid_unittest" ]
L
lnlan 已提交
115 116
      }
    }
117 118 119
    if (LOSCFG_USER_TEST_DRIVERS_STORAGE == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "drivers/storage:liteos_a_drivers_storage_unittest_door" ]
L
lnlan 已提交
120
      }
121 122
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "drivers/storage:liteos_a_drivers_storage_unittest" ]
L
lnlan 已提交
123 124
      }
    }
125 126 127
    if (LOSCFG_USER_TEST_DYNLOAD == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "dynload:liteos_a_dynload_unittest_door" ]
L
lnlan 已提交
128
      }
129 130
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "dynload:liteos_a_dynload_unittest" ]
L
lnlan 已提交
131 132
      }
    }
133 134 135
    if (LOSCFG_USER_TEST_EXC == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "exc:liteos_a_exc_unittest_door" ]
L
lnlan 已提交
136
      }
137 138 139 140 141 142
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "exc:liteos_a_exc_unittest" ]
      }
    }
    if (LOSCFG_USER_TEST_IO == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
143 144
        deps += [ "IO:liteos_a_io_unittest_door" ]
      }
145 146 147
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "IO:liteos_a_io_unittest" ]
      }
L
lnlan 已提交
148 149
    }
    if (LOSCFG_USER_TEST_IPC == true) {
150
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
151 152
        deps += [ "IPC:liteos_a_ipc_unittest_door" ]
      }
153 154 155
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "IPC:liteos_a_ipc_unittest" ]
      }
L
lnlan 已提交
156 157
    }
    if (LOSCFG_USER_TEST_LITEIPC == true) {
158
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
159 160
        deps += [ "liteipc:liteos_a_liteipc_unittest_door" ]
      }
161 162 163
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "liteipc:liteos_a_liteipc_unittest" ]
      }
L
lnlan 已提交
164 165
    }
    if (LOSCFG_USER_TEST_MEM_SHM == true) {
166
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
167 168
        deps += [ "mem/shm:liteos_a_mem_shm_unittest_door" ]
      }
169 170 171
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "mem/shm:liteos_a_mem_shm_unittest" ]
      }
L
lnlan 已提交
172 173
    }
    if (LOSCFG_USER_TEST_MEM_VM == true) {
174
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
175 176
        deps += [ "mem/vm:liteos_a_mem_vm_unittest_door" ]
      }
177 178 179
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "mem/vm:liteos_a_mem_vm_unittest" ]
      }
L
lnlan 已提交
180 181
    }
    if (LOSCFG_USER_TEST_NET_NETDB == true) {
182
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
183 184
        deps += [ "net/netdb:liteos_a_net_netdb_unittest_door" ]
      }
185 186 187
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "net/netdb:liteos_a_net_netdb_unittest" ]
      }
L
lnlan 已提交
188 189
    }
    if (LOSCFG_USER_TEST_NET_RESOLV == true) {
190
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
191 192
        deps += [ "net/resolv:liteos_a_net_resolv_unittest_door" ]
      }
193 194 195
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "net/resolv:liteos_a_net_resolv_unittest" ]
      }
L
lnlan 已提交
196 197
    }
    if (LOSCFG_USER_TEST_NET_SOCKET == true) {
198
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
199 200
        deps += [ "net/socket:liteos_a_net_socket_unittest_door" ]
      }
201 202 203
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "net/socket:liteos_a_net_socket_unittest" ]
      }
L
lnlan 已提交
204 205
    }
    if (LOSCFG_USER_TEST_POSIX_MEM == true) {
206
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
207 208
        deps += [ "posix/mem:liteos_a_posix_mem_unittest_door" ]
      }
209 210 211
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "posix/mem:liteos_a_posix_mem_unittest" ]
      }
L
lnlan 已提交
212 213
    }
    if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) {
214
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
215 216
        deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest_door" ]
      }
217 218 219
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest" ]
      }
L
lnlan 已提交
220 221
    }
    if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) {
222
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
223 224
        deps += [ "posix/pthread:liteos_a_posix_pthread_unittest_door" ]
      }
225 226 227
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "posix/pthread:liteos_a_posix_pthread_unittest" ]
      }
L
lnlan 已提交
228 229
    }
    if (LOSCFG_USER_TEST_MUTEX == true) {
230
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
231 232
        deps += [ "process/mutex:liteos_a_mutex_unittest_door" ]
      }
233 234 235
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/mutex:liteos_a_mutex_unittest" ]
      }
L
lnlan 已提交
236 237
    }
    if (LOSCFG_USER_TEST_PROCESS == true) {
238
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
239 240
        deps += [ "process/process:liteos_a_process_unittest_door" ]
      }
241 242 243
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/process:liteos_a_process_unittest" ]
      }
L
lnlan 已提交
244 245
    }
    if (LOSCFG_USER_TEST_PTHREAD == true) {
246
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
247 248
        deps += [ "process/pthread:liteos_a_pthread_unittest_door" ]
      }
249 250 251
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/pthread:liteos_a_pthread_unittest" ]
      }
L
lnlan 已提交
252 253
    }
    if (LOSCFG_USER_TEST_RWLOCK == true) {
254
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
255 256
        deps += [ "process/rwlock:liteos_a_rwlock_unittest_door" ]
      }
257 258 259
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/rwlock:liteos_a_rwlock_unittest" ]
      }
L
lnlan 已提交
260 261
    }
    if (LOSCFG_USER_TEST_SPINLOCK == true) {
262
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
263 264
        deps += [ "process/spinlock:liteos_a_spinlock_unittest_door" ]
      }
265 266 267
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/spinlock:liteos_a_spinlock_unittest" ]
      }
L
lnlan 已提交
268 269
    }
    if (LOSCFG_USER_TEST_SECURITY_REUGID == true) {
270
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
271 272
        deps += [ "security/reugid:liteos_a_security_reugid_unittest_door" ]
      }
273 274 275
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "security/reugid:liteos_a_security_reugid_unittest" ]
      }
L
lnlan 已提交
276 277
    }
    if (LOSCFG_USER_TEST_SECURITY_CAPABILITY == true) {
278
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
279 280
        deps += [ "security/capability:liteos_a_security_capability_unittest_door" ]
      }
281 282 283
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "security/capability:liteos_a_security_capability_unittest" ]
      }
L
lnlan 已提交
284 285
    }
    if (LOSCFG_USER_TEST_SECURITY_VID == true) {
286
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
287 288
        deps += [ "security/vid:liteos_a_security_vid_unittest_door" ]
      }
289 290 291
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "security/vid:liteos_a_security_vid_unittest" ]
      }
L
lnlan 已提交
292 293
    }
    if (LOSCFG_USER_TEST_UTIL == true) {
294
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
295 296
        deps += [ "util:liteos_a_util_unittest_door" ]
      }
297 298 299
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "util:liteos_a_util_unittest" ]
      }
L
lnlan 已提交
300 301
    }
    if (LOSCFG_USER_TEST_TIME_TIMER == true) {
302
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
303 304
        deps += [ "time/timer:liteos_a_time_timer_unittest_door" ]
      }
305 306 307
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "time/timer:liteos_a_time_timer_unittest" ]
      }
L
lnlan 已提交
308 309
    }
    if (LOSCFG_USER_TEST_TIME_CLOCK == true) {
310
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
311 312
        deps += [ "time/clock:liteos_a_time_clock_unittest_door" ]
      }
313 314 315
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "time/clock:liteos_a_time_clock_unittest" ]
      }
L
lnlan 已提交
316 317
    }
    if (LOSCFG_USER_TEST_SYS == true) {
318
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
319 320
        deps += [ "sys:liteos_a_sys_unittest_door" ]
      }
321 322 323
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "sys:liteos_a_sys_unittest" ]
      }
L
lnlan 已提交
324 325
    }
    if (LOSCFG_USER_TEST_SIGNAL == true) {
326
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
L
lnlan 已提交
327 328
        deps += [ "signal:liteos_a_signal_unittest_door" ]
      }
329 330 331
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "signal:liteos_a_signal_unittest" ]
      }
L
lnlan 已提交
332
    }
L
LiteOS2021 已提交
333 334 335 336 337 338 339 340
    if (LOSCFG_USER_TEST_TRACE == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "trace:liteos_a_trace_unittest_door" ]
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "trace:liteos_a_trace_unittest" ]
      }
    }
L
lnlan 已提交
341 342
  }
}