BUILD.gn 5.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) {
116
        deps += [ "libc:liteos_a_libc_unittest_door" ]
L
lnlan 已提交
117
      }
118
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
119
        deps += [ "libc:liteos_a_libc_unittest" ]
120
      }
L
lnlan 已提交
121
    }
122 123 124

    # net test
    if (LOSCFG_USER_TEST_NET == true) {
125
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
126
        deps += [ "net:liteos_a_net_unittest_door" ]
L
lnlan 已提交
127
      }
128
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
129
        deps += [ "net:liteos_a_net_unittest" ]
130
      }
L
lnlan 已提交
131
    }
132

133 134 135 136 137
    # process test
    if (LOSCFG_USER_TEST_PROCESS_THREAD == true) {
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
        deps += [ "process/basic:liteos_a_process_basic_unittest_door" ]
        deps += [ "process/lock:liteos_a_process_lock_unittest_door" ]
138 139 140
        if (LOSCFG_USER_TEST_PROCESS_FS == true) {
          deps += [ "process/fs:liteos_a_process_fs_unittest_door" ]
        }
141 142 143 144
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
        deps += [ "process/basic:liteos_a_process_basic_unittest" ]
        deps += [ "process/lock:liteos_a_process_lock_unittest" ]
145 146 147
        if (LOSCFG_USER_TEST_PROCESS_FS == true) {
          deps += [ "process/fs:liteos_a_process_fs_unittest" ]
        }
148 149 150
      }
    }

151 152
    # security test
    if (LOSCFG_USER_TEST_SECURITY == true) {
L
LiteOS2021 已提交
153
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
154
        deps += [ "security:liteos_a_security_unittest_door" ]
L
LiteOS2021 已提交
155 156
      }
      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
157
        deps += [ "security:liteos_a_security_unittest" ]
L
LiteOS2021 已提交
158 159
      }
    }
Z
zhushengle 已提交
160 161 162 163 164 165 166 167 168 169

    # 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 已提交
170 171 172 173 174

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