• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
2# Copyright (c) 2020-2021 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 += [ "libc:liteos_a_libc_unittest_door" ]
117      }
118      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
119        deps += [ "libc:liteos_a_libc_unittest" ]
120      }
121    }
122
123    # net test
124    if (LOSCFG_USER_TEST_NET == true) {
125      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
126        deps += [ "net:liteos_a_net_unittest_door" ]
127      }
128      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
129        deps += [ "net:liteos_a_net_unittest" ]
130      }
131    }
132
133    # process test
134    if (LOSCFG_USER_TEST_PROCESS_THREAD == true) {
135      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
136        deps += [ "process/basic:liteos_a_process_basic_unittest_door" ]
137        deps += [ "process/lock:liteos_a_process_lock_unittest_door" ]
138      }
139      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
140        deps += [ "process/basic:liteos_a_process_basic_unittest" ]
141        deps += [ "process/lock:liteos_a_process_lock_unittest" ]
142      }
143    }
144
145    # security test
146    if (LOSCFG_USER_TEST_SECURITY == true) {
147      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
148        deps += [ "security:liteos_a_security_unittest_door" ]
149      }
150      if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
151        deps += [ "security:liteos_a_security_unittest" ]
152      }
153    }
154  }
155}
156