1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 2# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without modification, 5# are permitted provided that the following conditions are met: 6# 7# 1. Redistributions of source code must retain the above copyright notice, this list of 8# conditions and the following disclaimer. 9# 10# 2. Redistributions in binary form must reproduce the above copyright notice, this list 11# of conditions and the following disclaimer in the documentation and/or other materials 12# provided with the distribution. 13# 14# 3. Neither the name of the copyright holder nor the names of its contributors may be used 15# to endorse or promote products derived from this software without specific prior written 16# permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30import("config.gni") 31 32local_flags = [ 33 "-fpermissive", 34 "-O2", 35 "-fbuiltin", 36 "-Wno-narrowing", 37 "-fPIE", 38 "-Wno-error", 39] 40if (LOSCFG_USER_TEST_SMP == "enable" || 41 (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) { 42 local_flags += [ "-DLOSCFG_USER_TEST_SMP" ] 43} 44 45config("public_config_for_door") { 46 cflags = [ "-DLOSCFG_USER_TEST_SMOKE" ] 47 cflags += local_flags 48 cflags_cc = cflags 49} 50 51config("public_config_for_all") { 52 cflags = [ 53 "-DLOSCFG_USER_TEST_SMOKE", 54 "-DLOSCFG_USER_TEST_FULL", 55 ] 56 cflags += local_flags 57 cflags_cc = cflags 58} 59 60config("public_config_for_pressure") { 61 cflags = [ "-DLOSCFG_USER_TEST_PRESSURE" ] 62 cflags += local_flags 63 cflags_cc = cflags 64} 65 66# Note: The execution time of a single XXX_door.bin cannot exceed 90 seconds. 67group("unittest") { 68 deps = [] 69 if (ohos_build_type == "debug") { 70 # basic test 71 if (LOSCFG_USER_TEST_BASIC == true) { 72 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 73 deps += [ "basic:liteos_a_basic_unittest_door" ] 74 } 75 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 76 deps += [ "basic:liteos_a_basic_unittest" ] 77 } 78 } 79 80 # drivers test 81 if (LOSCFG_USER_TEST_DRIVERS == true) { 82 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 83 deps += [ "drivers:liteos_a_drivers_unittest_door" ] 84 } 85 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 86 deps += [ "drivers:liteos_a_drivers_unittest" ] 87 } 88 } 89 90 # extended test 91 if (LOSCFG_USER_TEST_EXTENDED == true) { 92 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 93 deps += [ "extended:liteos_a_extended_unittest_door" ] 94 } 95 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 96 deps += [ "extended:liteos_a_extended_unittest" ] 97 } 98 } 99 100 # fs test 101 if (LOSCFG_USER_TEST_FS == true) { 102 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 103 deps += [ "fs:liteos_a_fs_unittest_door" ] 104 } 105 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 106 deps += [ "fs:liteos_a_fs_unittest" ] 107 } 108 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { 109 deps += [ "fs:liteos_a_fs_unittest_pressure" ] 110 } 111 } 112 113 # libc test 114 if (LOSCFG_USER_TEST_LIBC == true) { 115 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 116 deps += [ 117 "libc/io:liteos_a_libc_io_unittest_door", 118 "libc/misc:liteos_a_libc_misc_unittest_door", 119 "libc/posix:liteos_a_libc_posix_unittest_door", 120 "libc/sys:liteos_a_libc_sys_unittest_door", 121 "libc/time:liteos_a_libc_time_unittest_door", 122 "libc/util:liteos_a_libc_util_unittest_door", 123 ] 124 } 125 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 126 deps += [ 127 "libc/io:liteos_a_libc_io_unittest", 128 "libc/misc:liteos_a_libc_misc_unittest", 129 "libc/posix:liteos_a_libc_posix_unittest", 130 "libc/sys:liteos_a_libc_sys_unittest", 131 "libc/time:liteos_a_libc_time_unittest", 132 "libc/util:liteos_a_libc_util_unittest", 133 ] 134 } 135 } 136 137 # net test 138 if (LOSCFG_USER_TEST_NET == true) { 139 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 140 deps += [ "net:liteos_a_net_unittest_door" ] 141 } 142 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 143 deps += [ "net:liteos_a_net_unittest" ] 144 } 145 } 146 147 # process test 148 if (LOSCFG_USER_TEST_PROCESS_THREAD == true) { 149 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 150 deps += [ 151 "process/basic/process:liteos_a_process_basic_process_unittest_door", 152 "process/basic/pthread:liteos_a_process_basic_pthread_unittest_door", 153 "process/lock:liteos_a_process_lock_unittest_door", 154 ] 155 if (LOSCFG_USER_TEST_PROCESS_FS == true) { 156 deps += [ "process/fs:liteos_a_process_fs_unittest_door" ] 157 } 158 if (LOSCFG_USER_TEST_PROCESS_PLIMITS == true) { 159 deps += [ "process/plimits:liteos_a_process_plimits_unittest_door" ] 160 } 161 } 162 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 163 deps += [ 164 "process/basic/process:liteos_a_process_basic_process_unittest", 165 "process/basic/pthread:liteos_a_process_basic_pthread_unittest", 166 "process/lock:liteos_a_process_lock_unittest", 167 ] 168 if (LOSCFG_USER_TEST_PROCESS_FS == true) { 169 deps += [ "process/fs:liteos_a_process_fs_unittest" ] 170 } 171 if (LOSCFG_USER_TEST_PROCESS_PLIMITS == true) { 172 deps += [ "process/plimits:liteos_a_process_plimits_unittest" ] 173 } 174 } 175 } 176 177 # security test 178 if (LOSCFG_USER_TEST_SECURITY == true) { 179 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 180 deps += [ "security:liteos_a_security_unittest_door" ] 181 } 182 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 183 deps += [ "security:liteos_a_security_unittest" ] 184 } 185 } 186 187 # container test 188 if (LOSCFG_USER_TEST_CONTAINER == true) { 189 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { 190 deps += [ "container:liteos_a_container_unittest_door" ] 191 } 192 if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { 193 deps += [ "container:liteos_a_container_unittest" ] 194 } 195 } 196 197 # fuzz test 198 if (LOSCFG_USER_FUZZ_TEST == true) { 199 deps += [ "fuzz:liteos_a_fuzztest" ] 200 } 201 } 202} 203