From 495c8cfc25e0d03eb6ba9914df17487f839c557d Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Thu, 25 Sep 2025 14:01:47 +0800 Subject: [PATCH] utest: remove RT_UTEST_USING_ALL_CASES Many modules' utests currently don't support enabling all tests at once. Furthermore, some modules' tests are complex, for example due to their numerous dependencies on other modules. This makes it nearly impossible to enable all tests with a single global switch. Consequently, the previously defined `RT_UTEST_USING_ALL_CASES` has lost its original meaning. We recommend deprecating this configuration switch. If a module needs to enable a group of functional tests through its own configuration, this local enable all switch should be implemented by the module itself, and a global RTT enable switch will no longer be provided. If such a requirement arises in the future, we recommend careful design, especially considering how to ensure that turning on a single switch enables all dependencies for all involved modules for ease of use. Signed-off-by: Chen Wang --- bsp/k230/drivers/utest/SConscript | 2 +- components/drivers/audio/utest/SConscript | 2 +- components/net/utest/SConscript | 2 +- components/utilities/Kconfig | 7 ------- components/utilities/utest/utest/SConscript | 2 +- documentation/6.components/utest/utest.md | 2 +- examples/utest/testcases/cpp11/SConscript | 2 +- src/Kconfig | 1 - src/klibc/utest/SConscript | 2 +- 9 files changed, 7 insertions(+), 15 deletions(-) diff --git a/bsp/k230/drivers/utest/SConscript b/bsp/k230/drivers/utest/SConscript index eeaa0f78f4..1069520d73 100644 --- a/bsp/k230/drivers/utest/SConscript +++ b/bsp/k230/drivers/utest/SConscript @@ -2,7 +2,7 @@ from building import * src = [] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('BSP_UTEST_DRIVERS'): +if GetDepend('BSP_UTEST_DRIVERS'): src += ['test_gpio.c'] src += ['test_gpio_irq.c'] diff --git a/components/drivers/audio/utest/SConscript b/components/drivers/audio/utest/SConscript index 4a535be5c3..f8b5639bb6 100644 --- a/components/drivers/audio/utest/SConscript +++ b/components/drivers/audio/utest/SConscript @@ -5,7 +5,7 @@ cwd = GetCurrentDir() src = [] CPPPATH = [cwd] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_USING_AUDIO_DRIVER'): +if GetDepend('RT_UTEST_USING_AUDIO_DRIVER'): src += Glob('tc_*.c') group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_AUDIO'], CPPPATH = CPPPATH) diff --git a/components/net/utest/SConscript b/components/net/utest/SConscript index 010ccb4e5f..4c9190fa40 100644 --- a/components/net/utest/SConscript +++ b/components/net/utest/SConscript @@ -5,7 +5,7 @@ cwd = GetCurrentDir() src = [] CPPPATH = [cwd] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'): +if GetDepend('RT_UTEST_TC_USING_LWIP') or GetDepend('RT_UTEST_TC_USING_NETDEV'): if GetDepend('RT_UTEST_TC_USING_LWIP'): # Add lwIP test source if enabled diff --git a/components/utilities/Kconfig b/components/utilities/Kconfig index b5eff9bee4..8601eb1e51 100644 --- a/components/utilities/Kconfig +++ b/components/utilities/Kconfig @@ -216,13 +216,6 @@ config RT_USING_UTEST default n help If enable this option, the test cases will be run automatically when board boot up. - - config RT_UTEST_USING_ALL_CASES - bool "Enable all selected modules' test cases" - default n - help - If enable this option, all selected modules' test cases will be run. - Otherwise, only the test cases that are explicitly enabled will be run. endif config RT_USING_VAR_EXPORT diff --git a/components/utilities/utest/utest/SConscript b/components/utilities/utest/utest/SConscript index 6437618551..ec1e214de6 100644 --- a/components/utilities/utest/utest/SConscript +++ b/components/utilities/utest/utest/SConscript @@ -2,7 +2,7 @@ from building import * src = [] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('UTEST_SELF_PASS_TC'): +if GetDepend('UTEST_SELF_PASS_TC'): src += Glob('TC_*.c') group = DefineGroup('utc_UTest', src, depend = ['']) diff --git a/documentation/6.components/utest/utest.md b/documentation/6.components/utest/utest.md index 9cc63b6b81..713adfbb14 100644 --- a/documentation/6.components/utest/utest.md +++ b/documentation/6.components/utest/utest.md @@ -314,7 +314,7 @@ For each module, you can maintain unit testcases in a unified manner in the foll - `Kconfig` file, which defining configuration options for the unit test cases 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-testcases will be enabled to avoid selecting one by one. + - `SConscript` file, when adding src files, you need to rely on `RT_UTEST_TC_USING_XXXX`. After completing the above steps, rsource the path of the Kconfig file of utest of this module to the file `Kconfig.utestcases`. diff --git a/examples/utest/testcases/cpp11/SConscript b/examples/utest/testcases/cpp11/SConscript index 706d689aeb..e82d652f62 100644 --- a/examples/utest/testcases/cpp11/SConscript +++ b/examples/utest/testcases/cpp11/SConscript @@ -5,7 +5,7 @@ cwd = GetCurrentDir() src = [] CPPPATH = [cwd] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('UTEST_CPP11_THREAD_TC'): +if GetDepend('UTEST_CPP11_THREAD_TC'): src += Glob('tc_*.cpp') group = DefineGroup('utestcases', src, depend = ['RT_USING_UTESTCASES', 'RT_USING_CPLUSPLUS'], CPPPATH = CPPPATH) diff --git a/src/Kconfig b/src/Kconfig index 0cc80305c2..260bf99ba1 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -242,7 +242,6 @@ config RT_USING_CI_ACTION bool "Enable CI Action build mode" select RT_USING_UTEST select RT_UTEST_USING_AUTO_RUN - select RT_UTEST_USING_ALL_CASES default n help Identify that the environment is CI Action. diff --git a/src/klibc/utest/SConscript b/src/klibc/utest/SConscript index a9acd1b3c6..48a68acc28 100644 --- a/src/klibc/utest/SConscript +++ b/src/klibc/utest/SConscript @@ -2,7 +2,7 @@ from building import * src = [] -if GetDepend('RT_UTEST_USING_ALL_CASES') or GetDepend('RT_UTEST_TC_USING_KLIBC'): +if GetDepend('RT_UTEST_TC_USING_KLIBC'): src += Glob('TC_*.c') group = DefineGroup('utestcases', src, depend = [''])