Commit Graph

47 Commits

Author SHA1 Message Date
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
Chen Wang
b03bb709b9 utest: update naems using new rule
The names of the utest cases defined in their respective
modules have been updated.

Some utest case names are not yet in their respective modules
because their paths need to be finalized before their unique
names can be determined. Currently, these names do not
appear to conflict with the unified names. These include:

- utest cases still in examples
- bsp/qemu-virt64-riscv/applications/test/test_vector/test_vector.c.
  The entire test case should probably be placed in libcpu/risc-v
  rather than bsp.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-15 19:40:31 +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
Chen Wang
01ca3911ec componnets: utest: fix case-name matching problem
There is a problem with the matching of case names
in the original code. Due to original code use memcmp
with len, if the input case name and the existing
case name have an inclusion relationship, for example,
if the actual case name is "gpip_irq", and run
`utest_run gpio` will also match successfully, but it's
not expected.

Modify the logic of exact matching and use strcmp instead.
Keep the original wildcard logic, that is,
`utest_run gpio*` can match both "gpio_irq" and "gpio".

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-06-10 19:22:25 +08:00
Yuqiang Wang
ad79383fa3 feat: ci script associated with auto_utest. (#9933)
* feat: ci script associated with auto_utest.
2025-03-10 11:08:21 +08:00
Meco Man
da6c62c293 [utest] fix twice operation of uassert 2025-01-15 10:26:40 +08:00
Meco Man
bdd9447d70 [utest] make RT_USING_CI_ACTION to be clear
RT_USING_CI_ACTION will select RT_UTEST_USING_AUTO_RUN and RT_UTEST_USING_ALL_CASES
2025-01-09 17:45:15 -05:00
Meco Man
88920fd814 [utest] 修复UTEST_UNIT_RUN嵌套宏时将宏直接输出的问题 2025-01-07 20:44:29 -05:00
Meco Man
0a25fcffab [utest] add float operators
uassert_float_equal and uassert_float_not_equal
2025-01-07 20:44:29 -05:00
Meco Man
d583615afe [utest] add rt_memset test case 2025-01-03 13:42:21 +08:00
Meco Man
26828a175e [utest] implement uassert_ptr_equal and uassert_ptr_not_equal 2024-12-24 13:42:04 +08:00
Meco Man
a9746edc08 [utest] optimize the utest to support new CI 2024-12-21 14:57:17 -05:00
Meco Man
7772d4619a [klibc] format code 2024-12-21 14:57:17 -05:00
Meco Man
09f47c55a9 [utest] format code and remove duplicate header file 2024-11-18 09:58:55 +08:00
Shell
540370e4de [utest] remove delay for on thread testing (#9053)
* [utest] remove delay for on thread testing

The delay is introduced from 0dc7b9a5a2.

Though this is unnecessary for on sync utest.
So this is removed by a new entry and delay for asynchronous utest only.

Signed-off-by: Shell <smokewood@qq.com>

* fixup: msh cmd prototype

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-06-12 19:48:51 +08:00
zhkag
0f998f6b05 [simulator] 模拟器可以使用 utest 测试框架 (#7644)
Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
2023-06-10 12:32:34 +08:00
朱天龙 (Armink)
69e6c3017b Utest win (#7347)
* [tools] Add `--add-rtconfig` args for scons when you want to add macro definitions build time.

* [utilities][utest] Add VS simulator support.
2023-04-22 21:49:20 +08:00
Man, Jianting (Meco)
99bdf978d7 [rtdef] use lower-case to define attributes (#6728)
* [rtdef] rename RT_WEAK attribute as rt_weak

* [rtdef] rename RT_USED attribute as rt_used

* [rtdef] rename RT_SECTION attribute as rt_section

* [rtdef] rename ALIGN attribute as rt_align

* [legacy] add RT_USED ALIGN RT_SECTION RT_WEAK as legacy support
2022-12-11 13:12:03 -05:00
Meco Man
f89a162ea3 [core] 使用rt_memcpy rt_memset代替memcpy memset 2022-01-09 00:23:18 +08:00
Meco Man
5187d75af5 [armclang] 使用__clang__代替__CLANG_ARM 2021-12-29 14:15:38 -05:00
BernardXiong
51e0559631 [utest] fix libc issue 2021-09-11 18:34:13 +08:00
guozhanxin
9e558ab130 【utest】fix TC_FAIL_LIST_MARK_FAILED 下标计算错误的问题 2021-08-24 17:06:51 +08:00
guozhanxin
38f5fec63e [utest] 完善代码,添加对tc_num的判断 2021-08-19 11:21:31 +08:00
guozhanxin
4af99b0dca [add] utest add fail_list. 2021-08-18 09:39:21 +08:00
Meco Man
3c05a4e719 [compoenets] auto & manual formatted 2021-03-08 18:19:04 +08:00
liruncong
0208fc5546 [components]SECTION=>RT_SECTION(与catch2中SECTION冲突) 2021-02-09 23:25:46 +08:00
yangjie
ef62febf1f [SConscript]update group name 2020-12-19 16:49:11 +08:00
yangjie11
91261e25b9 [SConscript]rename group name 2020-11-20 13:38:11 +08:00
michael
4bf1535c42 utest:fixed compile err 2020-08-29 22:45:22 +08:00
liruncong
7953cdfae3 [components/utilities/utest]修正无测试用例时,执行utest_run时跑飞问题. utest_init增加__CLANG_ARM编译开关判断 2019-09-14 22:44:44 +08:00
tyustli
a559179e6f fix cpp thread class error 2019-06-24 15:59:26 +08:00
armink
fa4d4ab7cf Update all of debug log definition to DBG_TAG and DBG_LVL. 2019-04-12 10:18:57 +08:00
MurphyZhao
e5c5215917 [components/utilities/utest] 增加测试运行测试打印
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-03-19 14:27:39 +08:00
armink
0d7ba79219 Remove the DBG_COLOR and DBG_ENABLE definition. 2019-03-06 17:54:30 +08:00
MurphyZhao
e3546a5043 [components][utest] 增加 utest_help,用于输出帮助信息
[components][utest] 对于不支持的测试用例,增加输出日志

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-02-15 12:04:36 +08:00
MurphyZhao
a305c6cca9 [components][utest] utest_run 增加 loop 功能,方便持续运行单一一个测试用例;
[components][utest] utest_run 指定测试用例名字的时候,增加通配符 `*` 的支持,及支持仅指定测试用例名字的前部分字节来运行测试用例。该功能会执行匹配成功的所有测试用例。

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-02-14 15:28:56 +08:00
MurphyZhao
0dc7b9a5a2 [components][utest] utest 延时启动
在使用 utest 的线程模式的时候,utest_run 命令执行完成后,finsh 会输出 `msh >`,干扰了 utest 内部的日志结构,因此默认在 utest 启动前增加延时。

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-02-14 12:03:29 +08:00
MurphyZhao
82f022f6f0 [components][utest] 增加 utest 线程模式
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-02-13 14:37:08 +08:00
MurphyZhao
655c4ad36b [component][utest] 增加 utest 日志输出级别配置,提供 ASSERT 和 ALL 两个级别,便于测试用例控制 log 输出
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-01-25 17:25:29 +08:00
MurphyZhao
f9e5d87c98 [components][utest] 将 utest_assert.h 加入 utest.h,以后测试用例仅需要包含 utest.h
[components][utest] 增加 buf 类型的字节比较 assert 宏
[components][utest] 修复错误日志打印的输出类型为 ERR 级别

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2019-01-22 15:46:12 +08:00
MurphyZhao
bce7f85907 [components/utilities/utest] 移除不那么必要的日志接口 redefine
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-08 15:01:08 +08:00
MurphyZhao
98b10877e7 [components/utilities/utest] 修复 gcc 编译警告
[components/utilities/utest] 移除组件的版本号
[components/utilities/utest] 优化 basename 函数的处理

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-08 14:48:54 +08:00
MurphyZhao
51b17a15e4 [components/utilities/utest] 完善代码,增加注释
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-06 18:59:13 +08:00
MurphyZhao
8824b2ca77 [components/utilities] [Kconfig] 增加 kconfig RT_USING_UTEST 配置
[components/utilities] [utest] 增加 testcase 运行超时时间参数

Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-06 17:13:14 +08:00
MurphyZhao
0759b66eb9 【更新】components/utilities/utest 增加 SConscript depend
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-05 18:07:03 +08:00
MurphyZhao
1ecf6cbc7c 【更新】utest gcc 链接符
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-12-05 14:53:37 +08:00
MurphyZhao
85d275b399 [components/utilities][add] 增加测试框架 utest 代码
Signed-off-by: MurphyZhao <d2014zjt@163.com>
2018-11-30 16:13:17 +08:00