475 Commits

Author SHA1 Message Date
Chen Wang
68a27e1fbe utest: UTEST_MEMPOOL_TC -> RT_UTEST_MEMPOOL
Which is missed in PR #10808 "utest: unify configname", add it.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-16 18:34:43 +08:00
Chen Wang
e8d3d0fca4 utest: move cpp from examples to components/libc/cplusplus
Also update the case names to compatible with naming rules.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 15:28:58 +08:00
Chen Wang
1dbcde518a utest: UTEST_SCHEDULER_TC -> RT_UTEST_SCHEDULER
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
5b8bfe4a77 utest: UTEST_MTSAFE_KPRINT_TC -> RT_UTEST_MTSAFE_KPRINT
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
405d096ff3 utest: UTEST_HOOKLIST_TC -> RT_UTEST_HOOKLIST
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
aac9eb8fbd utest: UTEST_ATOMIC_TC -> RT_UTEST_ATOMIC
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
ff9f1770c7 utest: UTEST_THREAD_TC -> RT_UTEST_THREAD
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
454a0c3a27 utest: UTEST_MAILBOX_TC -> RT_UTEST_MAILBOX
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
78c2acbdae utest: UTEST_MUTEX_TC -> RT_UTEST_MUTEX
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
68edf1792f utest: UTEST_SIGNAL_TC -> RT_UTEST_SIGNAL
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
7f17a580ab utest: UTEST_MESSAGEQUEUE_TC -> RT_UTEST_MESSAGEQUEUE
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
468007dda7 utest: UTEST_EVENT_TC -> RT_UTEST_EVENT
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
f0b6ad057d utest: UTEST_SEMAPHORE_TC -> RT_UTEST_SEMAPHORE
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
d5ffca9e90 utest: UTEST_IRQ_TC -> RT_UTEST_IRQ
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
0eda9bb5f1 utest: UTEST_OBJECT_TC -> RT_UTEST_OBJECT
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
0b8d2b3594 utest: UTEST_SMALL_MEM_TC -> RT_UTEST_SMALL_MEM
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
c2e1d7dee1 utest: UTEST_MEMHEAP_TC -> RT_UTEST_MEMHEAP
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
182a07ef58 utest: UTEST_TMPFS_CP -> RT_UTEST_TMPFS_CP
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
e536c49a87 utest: UTEST_MM_LWP_TC -> RT_UTEST_MM_LWP
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
9ca37156f5 utest: UTEST_MM_API_TC -> RT_UTEST_MM_API
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
0ad2ac115e utest: UTEST_CPP11_THREAD_TC -> RT_UTEST_CPP11_THREAD
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Chen Wang
df4fdc0087 utest: UTEST_SELF_PASS_TC -> RT_UTEST_SELF_PASS
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-15 09:43:16 +08:00
Rbb666
703930f7c2 [utest]Remove all posix test cases from utest. 2025-10-14 15:59:22 +08:00
Chen Wang
04e427921e utest: fixed UTEST_DEVICE_TC
In 01e015450f, "utest: move driver-related case under to drivers,"
UTEST_DEVICE_TC was replaced with RT_UTEST_DRIVERS_CORE. However,
some files are forgot to do this replacement, so this patch address
this.

Note: In .config, lines like "# CONFIG_XXX is not set" do not need
to be modified; they are comments. Furthermore, for BSPs, running
"scons --menuconfig" and save the config will automatically replace
them. Therefore, no modification is necessary in this case.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-14 09:15:15 +08:00
Chen Wang
d14daa6cb1 utest: ipc: move from examples to components/drivers/ipc
Also:
- Add "RT_" prefix for utest config options.
- Rename the case names to following the naming rule.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-13 10:44:16 +08:00
Chen Wang
7499790140 utest: core: move perf testcase from example to src
Also:

- Add "RT_" prefix for the UTEST config options.
- Follow the naming rules to update the case name.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-11 18:24:40 +08:00
Chen Wang
66448d9e96 utest: smp_call: move from example to components/drivers/smp_call
Also,
- Rename UTEST_SMP_CALL_FUNC to RT_UTEST_SMP_CALL_FUNC.
- Add depends on RT_USING_SMP in Kconfig for RT_UTEST_SMP_CALL_FUNC
- Follow the naming rules of utest case to update the cases' name.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-11 16:20:38 +08:00
Chen Wang
3b97667323 utest: serial: move from examples to components/drivers/serial
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-11 15:38:45 +08:00
Chen Wang
ba795c6d65 utest: serial_v2: add depends on RT_USING_SERIAL_V2
Add dependent of RT_USING_SERIAL_V2 in Kconfig to
make sure utest for serial_v2 is only available
when RT_USING_SERIAL_V2 is enabled.

Otherwise menuconfig allow people enable UTEST_SERIAL_TC
but building of utestcases failed. It looks weird and
better to be fixed.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-10 20:24:18 +08:00
Chen Wang
cc8b0d9f39 utest: serial: bypass: add depends on RT_USING_SERIAL_BYPASS
Add dependent of RT_USING_SERIAL_BYPASS in Kconfig to
make sure utest for serial-bypass is only available
when RT_USING_SERIAL_BYPASS is enabled.

Otherwise building of utestcases failed when UTEST_SERIAL_BYPASS
is enabled.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-10-10 20:23:40 +08:00
Yuqiang Wang
36393c61be improve[ci]: integrate utest run ci (#10748) 2025-09-28 16:08:51 +08:00
Chen Wang
6e51a8405f utest: move core tesetcases under to directiry "src"
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-26 09:59:05 +08:00
Chen Wang
495c8cfc25 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 <unicorn_wang@outlook.com>
2025-09-26 09:57:54 +08:00
Yonggang Luo
19451d9bb7 RT_TIMER_CTRL_SET_TIME and RT_TIMER_CTRL_GET_TIME should both use rt_tick_t 2025-09-24 18:12:36 +08:00
Rbb666
db1779e239 [utest][cpp]add cpp-smartptr testcase. 2025-09-23 10:55:47 +08:00
Rbb666
618516ef94 [utest][cpp]add cpp-lambda testcase. 2025-09-23 10:55:47 +08:00
Rbb666
c300b00470 [utest][cpp]add cpp-auto testcase. 2025-09-23 10:55:47 +08:00
Rbb666
d848e7321b [utest][cpp]add cpp-mutex testcase. 2025-09-23 10:55:47 +08:00
Rbb666
a4e5ae7bed [utest][cpp]add cpp-atomic testcase. 2025-09-23 10:55:47 +08:00
Rbb666
e4586d48cb [utest][cpp]rename thread_tc.cpp to tc_thread.cpp. 2025-09-23 10:55:47 +08:00
Rbb666
e1c1a07c48 [add][thread]Add api:rt_thread_suspend_force allow suspend other threads. 2025-09-09 13:08:30 +08:00
Rbb666
8cca8d6a39 fix ci problem. 2025-09-07 07:52:08 +08:00
Rbb666
ae8782bc7f [add][testcase]add mempool tc. 2025-09-07 07:52:08 +08:00
Chen Wang
c0142c786e utest/utest: intergare testcases into utest framework (#10665)
* utest: move testcases of Utest from example to Utest folder

Create unit-test-cases for the Utest framework subsystem
according to "How to add utest cases into RT-Thread for your module." [1]

Link:
https://rt-thread.github.io/rt-thread/page_component_utest.html#autotoc_md804
[1]

The original `components/utilities/utest` directory already has unit
testcases, which are more comprehensive than the testcases in
`examples/utest/testcases/utest/`. Therefore, simply deleted
the test cases in `examples` and used the existing testcases
in the utest framework.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* utest/utest: rename name and add license text

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

---------

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-02 18:48:07 +08:00
Rbb666
3c17851fe2 [Add][kernel/thread]Add thread overflow hook and testcases:thread_overflow_tc.c. 2025-09-02 16:46:55 +08:00
Chen Wang
06c5cc0846 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>
2025-08-26 10:26:47 +08:00
RyanCW
e0243e87c0 [component][drivers][serial_v2] 优化serial_v2 (#10603)
* [bsp][stm32][drv_usart_v2] uart_isr不再使用链式调用,RXNE内循环读空,一些细节优化

* [componnents][drivers][serial_v2] 增加获取config接口,使用rt_tick_get_delta替代内部的时间绕回判断,写满丢弃策略rx接收数据错乱修复,clang-tidy和cppcheck审查优化

* [utest][drivers][serial_v2] 测试例程进行优化

* [bsp][stm32][drv_usart_v2] 撤回DMAMUX1修改

* [componnents][drivers][serial_v2] read和write不再返回-RT_ETIMEOUT改为已发送或读取的字节数,细节优化

* [utest][drivers][serial_v2] 增加单独的timeout测试,减少测试中的硬延时

* [utest][drivers][serial_v2] 漏提交的posix下标志位

* [utest][drivers][serial_v2] 优化测试例程

* [bsp][stm32][drv_usart_v2] transmit返回错误值,RXNE增加超时逻辑

* [componnents][drivers][serial_v2] 增加transmit错误处理,增加超时退出机制显式的避免死循环

* [componnents][drivers][serial_v2] 适配serial_v2和posix非libc标准库下的console和shell
2025-08-16 11:51:57 +08:00
Yuqiang Wang
62f3fb4ce5 fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version #10537 2025-07-30 10:58:49 +08:00
kurisaw
ece19e961a kernel/testcase: fixed buffer overflow vulnerability in object 2025-07-18 20:15:53 +08:00
rcitach
2cb69c8e08 testcase: add system performance testcase (#10452)
* add  sys pref frameworks

* add context switch test code

* add irq latency test code

* add  thread sem test code

* add  thread event test code

* add  thread mbox test code

* add  thread mq test code

* Adding a Test Documentation Note

* Modification of text description
2025-07-16 12:55:54 +08:00