The receive sequence filter maps incoming data-frame sequence numbers to zero-based frame offsets. RT_LINK_FRAMES_MAX is the maximum number of split frames, so valid offsets are 0 through RT_LINK_FRAMES_MAX - 1.
Reject offset == RT_LINK_FRAMES_MAX before frame handling instead of letting it reach long-frame assembly.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
This change fixes intermittent failures of the `core.smp_bind_affinity`
utest across SMP CI targets. The original failure was a flaky assertion on
unbound threads (`thread_inc[x] != thread_tic[x]` in thread_entry), not
incorrect bind_cpu behavior. CI logs already showed T0 binding worked
(thread_inc[0] == thread_tic[0] == 100) while the not_equal check failed.
The root issue is that unbound-thread CPU placement is platform-dependent
and outside the bind_cpu contract. On dual-core RISC-V/ARMv7 CI, an
unbound thread may legitimately run all iterations on core 0 while T0
delays on the same core, so any assertion requiring cross-core migration
(thread_inc != thread_tic, or core_mask with multiple bits) remains flaky.
This patch narrows the test to what bind_affinity actually verifies: T0
bound to core 0 must always execute on core 0. Unbound threads only add
scheduling pressure; their core_mask is printed for observation but not
asserted.
Changes:
- Sample `rt_hw_cpu_id()` and update counters under `rt_sched_lock` to
avoid migration skew between counting and CPU sampling.
- Track `thread_core_mask` for diagnostics; assert only T0 binding via
`thread_inc[0] == thread_tic[0]` and `thread_core_mask[0] == 1`.
- Remove flaky unbound-thread assertions (`thread_inc != thread_tic` and
multi-core core_mask checks).
- Move T0 assertions to the main test thread after all workers finish.
- Use atomic `finsh_flag`; reset counters and `threads[]` in `utest_tc_init`.
- Spin in worker loops after `run_num` until cleanup deletes them (do not
return from thread_entry or use `RT_WAITING_FOREVER` with `rt_thread_delay`).
- Guard `rt_thread_delete` in cleanup with non-NULL checks.
Signed-off-by: GuEe-GUI <2991707448@qq.com>
- Accumulate short reads, mark finishing on EOF
- Track begin/end callback states and cleanup on error paths
- Add ACK handling with retry/error counting in send flow
* utest/msh: supports autocomplete of utest cases for utest_run
* docs/utest: explanation of adding the automatic completion function for utest_run
* fix[utest]: Improvement of annotation description
* remove outdated code
Use "Test" instead of "Unit Testcases" to make string shorter.
Use uppercase to make it look more eye-catching.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
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>
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>
* 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>
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>
- `dbg_log` is a “NOT RECOMMENDED API”, convert the calling of this
API to LOG_x and remove this API.
- `dbg_here`/`dbg_enter`/`dbg_exit`: no one use these APIs, remove
them directly.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
* [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>