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
local_flags = [
  "-fpermissive",
  "-O2",
  "-fbuiltin",
  "-Wno-narrowing",
  "-fPIE",
38
  "-Wno-error",
39
]
40 41
if (LOSCFG_USER_TEST_SMP == "enable" ||
    (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) {
42
  local_flags += [ "-DLOSCFG_USER_TEST_SMP" ]
L
lnlan 已提交
43
}
L
lnlan 已提交
44

45
config("public_config_for_door") {
46
  cflags = [ "-DLOSCFG_USER_TEST_SMOKE" ]
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
config("public_config_for_pressure") {
61
  cflags = [ "-DLOSCFG_USER_TEST_PRESSURE" ]
62
  cflags += local_flags
L
lnlan 已提交
63 64 65 66 67
  cflags_cc = cflags
}

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