mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-14 03:10:07 +08:00
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 <unicorn_wang@outlook.com>
This commit is contained in:
2
Kconfig
2
Kconfig
@@ -1,4 +1,4 @@
|
||||
rsource "src/Kconfig"
|
||||
rsource "libcpu/Kconfig"
|
||||
rsource "components/Kconfig"
|
||||
rsource "examples/utest/testcases/Kconfig"
|
||||
rsource "Kconfig.utestcases"
|
||||
|
24
Kconfig.utestcases
Normal file
24
Kconfig.utestcases
Normal file
@@ -0,0 +1,24 @@
|
||||
menu "RT-Thread Utestcases"
|
||||
|
||||
config RT_USING_UTESTCASES
|
||||
bool "RT-Thread Utestcases"
|
||||
default n
|
||||
select RT_USING_UTEST
|
||||
|
||||
if RT_USING_UTESTCASES
|
||||
|
||||
rsource "examples/utest/testcases/utest/Kconfig"
|
||||
rsource "examples/utest/testcases/kernel/Kconfig"
|
||||
rsource "examples/utest/testcases/cpp11/Kconfig"
|
||||
rsource "examples/utest/testcases/drivers/serial_v2/Kconfig"
|
||||
rsource "examples/utest/testcases/drivers/serial_bypass/Kconfig"
|
||||
rsource "examples/utest/testcases/drivers/ipc/Kconfig"
|
||||
rsource "examples/utest/testcases/posix/Kconfig"
|
||||
rsource "examples/utest/testcases/mm/Kconfig"
|
||||
rsource "examples/utest/testcases/tmpfs/Kconfig"
|
||||
rsource "examples/utest/testcases/smp_call/Kconfig"
|
||||
rsource "examples/utest/testcases/perf/Kconfig"
|
||||
|
||||
endif
|
||||
|
||||
endmenu
|
@@ -1,23 +0,0 @@
|
||||
menu "RT-Thread Utestcases"
|
||||
|
||||
config RT_USING_UTESTCASES
|
||||
bool "RT-Thread Utestcases"
|
||||
default n
|
||||
select RT_USING_UTEST
|
||||
|
||||
if RT_USING_UTESTCASES
|
||||
|
||||
rsource "utest/Kconfig"
|
||||
rsource "kernel/Kconfig"
|
||||
rsource "cpp11/Kconfig"
|
||||
rsource "drivers/serial_v2/Kconfig"
|
||||
rsource "drivers/serial_bypass/Kconfig"
|
||||
rsource "drivers/ipc/Kconfig"
|
||||
rsource "posix/Kconfig"
|
||||
rsource "mm/Kconfig"
|
||||
rsource "tmpfs/Kconfig"
|
||||
rsource "smp_call/Kconfig"
|
||||
rsource "perf/Kconfig"
|
||||
endif
|
||||
|
||||
endmenu
|
@@ -327,7 +327,7 @@ def get_file_md5(file):
|
||||
|
||||
# Exclude utestcases
|
||||
def exclude_utestcases(RTT_ROOT):
|
||||
if os.path.isfile(os.path.join(RTT_ROOT, 'examples/utest/testcases/Kconfig')):
|
||||
if os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig.utestcases')):
|
||||
return
|
||||
|
||||
if not os.path.isfile(os.path.join(RTT_ROOT, 'Kconfig')):
|
||||
@@ -337,7 +337,7 @@ def exclude_utestcases(RTT_ROOT):
|
||||
data = f.readlines()
|
||||
with open(os.path.join(RTT_ROOT, 'Kconfig'), 'w') as f:
|
||||
for line in data:
|
||||
if line.find('examples/utest/testcases/Kconfig') == -1:
|
||||
if line.find('Kconfig.utestcases') == -1:
|
||||
f.write(line)
|
||||
|
||||
|
||||
|
@@ -118,7 +118,7 @@ def bsp_update_kconfig_testcases(dist_dir):
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'rt-thread/Kconfig'), 'w') as f:
|
||||
for line in data:
|
||||
if line.find('examples/utest/testcases/Kconfig') == -1:
|
||||
if line.find('Kconfig.utestcases') == -1:
|
||||
f.write(line)
|
||||
|
||||
def bsp_update_kconfig(dist_dir):
|
||||
|
Reference in New Issue
Block a user