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 40
if (LOSCFG_USER_TEST_SMP == "enable" ||
    (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) {
41
  local_flags += [ "-DLOSCFG_USER_TEST_SMP" ]
L
lnlan 已提交
42
}
L
lnlan 已提交
43

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

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

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

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