BUILD.gn 6.8 KB
Newer Older
L
lnlan 已提交
1
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
2
# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved.
L
lnlan 已提交
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
#
# 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
  cflags_cc = cflags
}

66
# Note: The execution time of a single XXX_door.bin cannot exceed 90 seconds.
L
lnlan 已提交
67 68
group("unittest") {
  deps = []
L
lnlan 已提交
69
  if (ohos_build_type == "debug") {
70 71
    # basic test
    if (LOSCFG_USER_TEST_BASIC == true) {
72
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
73
        deps += [ "basic:liteos_a_basic_unittest_door" ]
L
lnlan 已提交
74
      }
75
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
76
        deps += [ "basic:liteos_a_basic_unittest" ]
77
      }
L
lnlan 已提交
78
    }
79 80 81

    # drivers test
    if (LOSCFG_USER_TEST_DRIVERS == true) {
82
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
83
        deps += [ "drivers:liteos_a_drivers_unittest_door" ]
L
lnlan 已提交
84
      }
85
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
86
        deps += [ "drivers:liteos_a_drivers_unittest" ]
87
      }
L
lnlan 已提交
88
    }
89 90 91

    # extended test
    if (LOSCFG_USER_TEST_EXTENDED == true) {
92
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
93
        deps += [ "extended:liteos_a_extended_unittest_door" ]
L
lnlan 已提交
94
      }
95
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
96
        deps += [ "extended:liteos_a_extended_unittest" ]
97
      }
L
lnlan 已提交
98
    }
99 100 101

    # fs test
    if (LOSCFG_USER_TEST_FS == true) {
102
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
103
        deps += [ "fs:liteos_a_fs_unittest_door" ]
L
lnlan 已提交
104
      }
105
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
106
        deps += [ "fs:liteos_a_fs_unittest" ]
L
lnlan 已提交
107
      }
108 109
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) {
        deps += [ "fs:liteos_a_fs_unittest_pressure" ]
110
      }
L
lnlan 已提交
111
    }
112 113 114

    # libc test
    if (LOSCFG_USER_TEST_LIBC == true) {
115
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
Z
zhangdengyu 已提交
116 117 118 119 120 121 122 123
        deps += [
          "libc/io:liteos_a_libc_io_unittest_door",
          "libc/misc:liteos_a_libc_misc_unittest_door",
          "libc/posix:liteos_a_libc_posix_unittest_door",
          "libc/sys:liteos_a_libc_sys_unittest_door",
          "libc/time:liteos_a_libc_time_unittest_door",
          "libc/util:liteos_a_libc_util_unittest_door",
        ]
L
lnlan 已提交
124
      }
125
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
Z
zhangdengyu 已提交
126 127 128 129 130 131 132 133
        deps += [
          "libc/io:liteos_a_libc_io_unittest",
          "libc/misc:liteos_a_libc_misc_unittest",
          "libc/posix:liteos_a_libc_posix_unittest",
          "libc/sys:liteos_a_libc_sys_unittest",
          "libc/time:liteos_a_libc_time_unittest",
          "libc/util:liteos_a_libc_util_unittest",
        ]
134
      }
L
lnlan 已提交
135
    }
136 137 138

    # net test
    if (LOSCFG_USER_TEST_NET == true) {
139
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
140
        deps += [ "net:liteos_a_net_unittest_door" ]
L
lnlan 已提交
141
      }
142
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
143
        deps += [ "net:liteos_a_net_unittest" ]
144
      }
L
lnlan 已提交
145
    }
146

147 148 149
    # process test
    if (LOSCFG_USER_TEST_PROCESS_THREAD == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
Z
zhangdengyu 已提交
150 151 152 153 154
        deps += [
          "process/basic/process:liteos_a_process_basic_process_unittest_door",
          "process/basic/pthread:liteos_a_process_basic_pthread_unittest_door",
          "process/lock:liteos_a_process_lock_unittest_door",
        ]
155 156 157
        if (LOSCFG_USER_TEST_PROCESS_FS == true) {
          deps += [ "process/fs:liteos_a_process_fs_unittest_door" ]
        }
Z
zhushengle 已提交
158 159 160
        if (LOSCFG_USER_TEST_PROCESS_PLIMITS == true) {
          deps += [ "process/plimits:liteos_a_process_plimits_unittest_door" ]
        }
161 162
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
Z
zhangdengyu 已提交
163 164 165 166 167
        deps += [
          "process/basic/process:liteos_a_process_basic_process_unittest",
          "process/basic/pthread:liteos_a_process_basic_pthread_unittest",
          "process/lock:liteos_a_process_lock_unittest",
        ]
168 169 170
        if (LOSCFG_USER_TEST_PROCESS_FS == true) {
          deps += [ "process/fs:liteos_a_process_fs_unittest" ]
        }
Z
zhushengle 已提交
171 172 173
        if (LOSCFG_USER_TEST_PROCESS_PLIMITS == true) {
          deps += [ "process/plimits:liteos_a_process_plimits_unittest" ]
        }
174 175 176
      }
    }

177 178
    # security test
    if (LOSCFG_USER_TEST_SECURITY == true) {
L
LiteOS2021 已提交
179
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
180
        deps += [ "security:liteos_a_security_unittest_door" ]
L
LiteOS2021 已提交
181 182
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
183
        deps += [ "security:liteos_a_security_unittest" ]
L
LiteOS2021 已提交
184 185
      }
    }
Z
zhushengle 已提交
186 187 188 189 190 191 192 193 194 195

    # container test
    if (LOSCFG_USER_TEST_CONTAINER == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "container:liteos_a_container_unittest_door" ]
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "container:liteos_a_container_unittest" ]
      }
    }
Z
zhushengle 已提交
196 197 198 199 200

    # fuzz test
    if (LOSCFG_USER_FUZZ_TEST == true) {
      deps += [ "fuzz:liteos_a_fuzztest" ]
    }
L
lnlan 已提交
201 202
  }
}