|
6 | 6 | * Change Logs: |
7 | 7 | * Date Author Notes |
8 | 8 | * 2023-03-27 WangXiaoyao testcase for lwp |
| 9 | + * 2025-12-14 ChuanN-sudo Add standardized utest documentation block |
| 10 | + */ |
| 11 | + |
| 12 | +/** |
| 13 | + * Test Case Name: MM API lwp Test |
| 14 | + * |
| 15 | + * Test Objectives: |
| 16 | + * - Verify LWP user space virtual area mapping functionality. |
| 17 | + * - Test user memory accessibility checking mechanisms. |
| 18 | + * - Test core APIs: lwp_create(), lwp_user_space_init(), lwp_map_user_varea(), |
| 19 | + * lwp_map_user_varea_ext(), lwp_user_accessible_ext(), lwp_ref_dec() |
| 20 | + * |
| 21 | + * Test Scenarios: |
| 22 | + * - User Map Varea Test (user_map_varea_tc): |
| 23 | + * - test_user_map_varea(): Creates LWP, initializes user space, maps virtual area with default flags, verifies varea properties (cached, private mapping). |
| 24 | + * - test_user_map_varea_ext(): Creates LWP, maps virtual area with NOCACHE flag, verifies uncached memory attributes. |
| 25 | + * - Accessible Test (accessible_tc): |
| 26 | + * - test_user_accessible(): Creates LWP with user stack, tests accessibility checks for unmapped and mapped memory regions. |
| 27 | + * |
| 28 | + * Verification Metrics: |
| 29 | + * - Virtual areas should be correctly inserted with proper ordering. |
| 30 | + * - Default mapping should have cached attributes (MMU_MAP_U_RWCB). |
| 31 | + * - NOCACHE mapping should have uncached attributes (MMU_MAP_U_RW). |
| 32 | + * - Virtual addresses should be within user space range. |
| 33 | + * - Accessibility check should return false for unmapped memory, true for mapped memory. |
| 34 | + * |
| 35 | + * Dependencies: |
| 36 | + * - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread with MMU. |
| 37 | + * - Software configuration: |
| 38 | + * - RT_UTEST_MM_LWP must be enabled (enable via: RT-Thread Utestcases -> RT-Thread Utestcases -> Memory Management Subsystem Testcase -> Enable Utest for MM API in lwp). |
| 39 | + * - RT_USING_SMART must be enabled (enable via: Enable RT-Thread Kernel -> RT-Thread Smart (microkernel on kernel/userland)). |
| 40 | + * - Environmental Assumptions: MMU support must be available on the target platform. |
| 41 | + * |
| 42 | + * Expected Results: |
| 43 | + * - Final output: "[ PASSED ] [ result ] testcase (testcases.lwp.mm_tc)" |
| 44 | + * - No assertion failures during test execution. |
9 | 45 | */ |
10 | 46 |
|
11 | 47 | #include "common.h" |
|
0 commit comments