Skip to content

Commit 06c5cc0

Browse files
unicornxRbb666
authored andcommitted
utest: move entry from examples to utest
Change the entry of utest's Kconfig from 'examples/utest/testcases/Kconfig' to 'Kconfig.utestcases'. Modified the build scripts where the path name is "examples/utest/testcases/Kconfig" and changed it to 'Kconfig.utestcases', otherwise build operations such 'scons --dist' may fail. In the future, the testcase source code of utest will be placed in each module for maintenance, but the entry of Kconfig will all be placed in Kconfig.utestcases for unified maintenance. In this way, when executing menuconfig, people can enter and configure from one place, avoiding searching for utest configuration switches here and there in the menuconfig interface. For each module, you can maintain unit-test in a unified manner in the following way: - Create a subdirectory named 'utest' in the directory where your module is located. - Store the following files in the utest subdirectory: - Unit test case program source code files for this module. - Kconfig file, add configuration options for the unit test files of this module, the recommended option is named RT_UTEST_TC_USING_XXXX, XXXX is the global unique module name of this module. - SConscript file, note that when adding src files, in addition to relying on RT_UTEST_TC_USING_XXXX, you must also rely on RT_UTEST_USING_ALL_CASES, the two dependencies are in an "or" relationship. The role of RT_UTEST_USING_ALL_CASES is that once this option is turned on, all unit tests will be enabled to avoid selecting one by one. After completing the above steps, add the path of the Kconfig file of utest of this module to the Kconfig.utestcases file. Signed-off-by: Chen Wang <[email protected]>
1 parent 1892b27 commit 06c5cc0

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rsource "src/Kconfig"
22
rsource "libcpu/Kconfig"
33
rsource "components/Kconfig"
4-
rsource "examples/utest/testcases/Kconfig"
4+
rsource "Kconfig.utestcases"

Kconfig.utestcases

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
menu "RT-Thread Utestcases"
2+
3+
config RT_USING_UTESTCASES
4+
bool "RT-Thread Utestcases"
5+
default n
6+
select RT_USING_UTEST
7+
8+
if RT_USING_UTESTCASES
9+
10+
rsource "examples/utest/testcases/utest/Kconfig"
11+
rsource "examples/utest/testcases/kernel/Kconfig"
12+
rsource "examples/utest/testcases/cpp11/Kconfig"
13+
rsource "examples/utest/testcases/drivers/serial_v2/Kconfig"
14+
rsource "examples/utest/testcases/drivers/serial_bypass/Kconfig"
15+
rsource "examples/utest/testcases/drivers/ipc/Kconfig"
16+
rsource "examples/utest/testcases/posix/Kconfig"
17+
rsource "examples/utest/testcases/mm/Kconfig"
18+
rsource "examples/utest/testcases/tmpfs/Kconfig"
19+
rsource "examples/utest/testcases/smp_call/Kconfig"
20+
rsource "examples/utest/testcases/perf/Kconfig"
21+
22+
endif
23+
24+
endmenu

examples/utest/testcases/Kconfig

Lines changed: 0 additions & 23 deletions
This file was deleted.

tools/env_utility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def get_file_md5(file):
327327

328328
# Exclude utestcases
329329
def exclude_utestcases(RTT_ROOT):
330-
if os.path.isfile(os.path.join(RTT_ROOT, 'examples/utest/testcases/Kconfig')):
330+
if os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig.utestcases')):
331331
return
332332

333333
if not os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig')):
@@ -337,7 +337,7 @@ def exclude_utestcases(RTT_ROOT):
337337
data = f.readlines()
338338
with open(os.path.join(RTT_ROOT, 'Kconfig'), 'w') as f:
339339
for line in data:
340-
if line.find('examples/utest/testcases/Kconfig') == -1:
340+
if line.find('Kconfig.utestcases') == -1:
341341
f.write(line)
342342

343343

tools/mkdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def bsp_update_kconfig_testcases(dist_dir):
118118
data = f.readlines()
119119
with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'w') as f:
120120
for line in data:
121-
if line.find('examples/utest/testcases/Kconfig') == -1:
121+
if line.find('Kconfig.utestcases') == -1:
122122
f.write(line)
123123

124124
def bsp_update_kconfig(dist_dir):

0 commit comments

Comments
 (0)