-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[docs][utest]:Add standardized documentation for semaphore Test、Memory Pool Test and Performance Test #10985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,9 +4,47 @@ | |||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||
| * | ||||||
| * Change Logs: | ||||||
| * Date Author Notes | ||||||
| * 2025-09-03 Rbb666 the first version for mempool utest | ||||||
| * Date Author Notes | ||||||
| * 2025-09-03 Rbb666 the first version for mempool utest | ||||||
| * 2025-11-30 westcity-YOLO Add standardized utest documentation block | ||||||
| */ | ||||||
|
|
||||||
| /** | ||||||
| * Test Case Name: Kernel Core MemPool Functional Test | ||||||
| * | ||||||
| * Test Objectives: | ||||||
| * - Validate static/dynamic memory pool functionality | ||||||
| * - Verify critical APIs: rt_mp_init, rt_mp_detach, rt_mp_alloc, rt_mp_free, rt_mp_create, rt_mp_delete | ||||||
| * - Test boundary conditions and stress scenarios | ||||||
| * | ||||||
| * Test Scenarios: | ||||||
| * - **Static Init**: Predefined block size/count; verify name/total/free counts | ||||||
| * - **Dynamic Create**: rt_mp_create; verify pool metadata | ||||||
| * - **Static Alloc/Free**: 3-block allocation; verify count changes | ||||||
| * - **Dynamic Alloc/Free**: Identical to static pool operations | ||||||
| * - **Exhaustion Test**: Full allocation → free=0 → next alloc=NULL | ||||||
| * - **Invalid Free**: NULL pointer free; no crash, count unchanged | ||||||
| * - **Stress Test**: 100x full alloc/free cycles; count restored each time | ||||||
| * | ||||||
| * Verification Metrics: | ||||||
| * - API returns: RT_EOK (success) / NULL (failure) | ||||||
| * - Block counts match expected values | ||||||
| * - Exhaustion: Allocation fails correctly | ||||||
| * - NULL free: Safe without crash | ||||||
| * - Stress: 0 errors/memory leaks | ||||||
| * | ||||||
| * Dependencies: | ||||||
| * - RT_USING_MEMPOOL must be enabled | ||||||
| * - RT_USING_UTEST framework must be enabled | ||||||
| * | ||||||
| * Expected Results: | ||||||
| * [ PASSED ] [ result ] testcase (core.mempool) | ||||||
| * - All 7 scenarios pass | ||||||
| * - 0 memory leaks | ||||||
| * - Stress test <10ms | ||||||
| * - Execute via: `utest_run core.mempool` in msh | ||||||
|
||||||
| * - Execute via: `utest_run core.mempool` in msh | |
| * - Executable via: `utest_run core.mempool` in msh |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,41 @@ | |||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||
| * | ||||||
| * Change Logs: | ||||||
| * Date Author Notes | ||||||
| * 2025-07-03 rcitach test case for context_switch | ||||||
| * Date Author Notes | ||||||
| * 2025-07-03 rcitach test case for context_switch | ||||||
| * 2025-11-30 westcity-YOLO Add standardized utest documentation block | ||||||
| */ | ||||||
|
|
||||||
| /* | ||||||
|
||||||
| /* | |
| /** |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] 🟡 [spelling]: Inconsistent terminology / 术语不一致
English: The term "Test executed via" is used here, while other documentation blocks in the same PR use "Executable via". For consistency across all test documentation, please use the same wording. Recommended: "Executable via: utest_run core.context_switch in msh"
中文: 此处使用了 "Test executed via",而同一 PR 中的其他文档块使用 "Executable via"。为了所有测试文档的一致性,请使用相同的措辞。建议使用:"Executable via: utest_run core.context_switch in msh"
| * - Test executed via: `utest_run core.context_switch` in msh | |
| * - Executable via: `utest_run core.context_switch` in msh |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,10 +4,50 @@ | |||||
| * SPDX-License-Identifier: Apache-2.0 | ||||||
| * | ||||||
| * Change Logs: | ||||||
| * Date Author Notes | ||||||
| * 2025-07-03 rcitach test case for irq latency | ||||||
| * Date Author Notes | ||||||
| * 2025-07-03 rcitach test case for irq latency | ||||||
| * 2025-11-30 westcity-YOLO Add standardized utest documentation block | ||||||
| */ | ||||||
|
|
||||||
| /** | ||||||
| * Test Case Name: Kernel Core Performance Benchmark Suite | ||||||
| * | ||||||
| * Test Objectives: | ||||||
| * - Measures key kernel performance metrics using high-resolution hardware timer | ||||||
| * - Validates context switch and IPC mechanism latency | ||||||
| * - Tests interrupt-to-thread response time (IRQ latency) | ||||||
| * - Provides quantitative results in microseconds (us) | ||||||
| * | ||||||
| * Test Scenarios: | ||||||
| * - **Context Switch Overhead**: Thread-to-thread switch time | ||||||
| * - **Semaphore Performance**: rt_sem_take/rt_sem_release round-trip latency | ||||||
| * - **Event Performance**: rt_event_recv/rt_event_send latency | ||||||
| * - **Message Queue Performance**: rt_mq_send/rt_mq_recv latency | ||||||
| * - **Mailbox Performance**: rt_mb_send/rt_mb_recv latency | ||||||
| * - **IRQ Latency**: Time from hardware timer interrupt to thread wakeup | ||||||
| * | ||||||
| * Verification Metrics: | ||||||
| * - All tests complete without crash or timeout | ||||||
| * - Measured times are within reasonable system limits (e.g., < 1000 us for IRQ) | ||||||
| * - Performance data is printed in structured table format | ||||||
| * - No memory leaks during test execution | ||||||
| * | ||||||
| * Dependencies: | ||||||
| * - RT_USING_PERF_TEST must be enabled | ||||||
| * - RT_USING_UTEST framework enabled | ||||||
| * - Hardware timer device named "hwtimer0" (or defined by RT_UTEST_HWTIMER_DEV_NAME) | ||||||
| * - System must support rt_device_find/open/close for HWTIMER | ||||||
| * - Sufficient heap memory for dynamic allocation in test runner | ||||||
| * | ||||||
| * Expected Results: | ||||||
| * - Console output shows a formatted table with: | ||||||
| * Test No | Test Name | Count | Total/Max/Min/Avg Time (us) | ||||||
| * - Final line: "=== Performance Test Results End ===" | ||||||
| * - utest framework reports: [ PASSED ] [ result ] testcase (core.perf_test) | ||||||
| * - Test runs via: `utest_run core.perf_test` in msh | ||||||
|
||||||
| * - Test runs via: `utest_run core.perf_test` in msh | |
| * - Executable via: `utest_run core.perf_test` in msh |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 [best_practices]: Trailing whitespace / 尾随空格
English: Line 50 contains trailing whitespace. This violates RT-Thread coding standards which require clean code without unnecessary whitespace.
Please remove the trailing space on this line.
中文: 第 50 行包含尾随空格。这违反了 RT-Thread 编码标准,要求代码整洁,不包含不必要的空格。
请删除此行的尾随空格。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] 🟡 [naming]: Inconsistent naming with RT-Thread conventions / 命名与 RT-Thread 约定不一致
English: The test case name uses "MemPool" instead of the full term "Memory Pool" which is used elsewhere in RT-Thread documentation and in other test files. For consistency and clarity, use "Memory Pool" in the title.
Current: "Kernel Core MemPool Functional Test"
Suggested: "Kernel Core Memory Pool Functional Test"
中文: 测试用例名称使用了 "MemPool" 而不是在 RT-Thread 文档和其他测试文件中使用的完整术语 "Memory Pool"。为了保持一致性和清晰度,标题中应使用 "Memory Pool"。
当前:"Kernel Core MemPool Functional Test"
建议:"Kernel Core Memory Pool Functional Test"