|
6 | 6 | * Change Logs: |
7 | 7 | * Date Author Notes |
8 | 8 | * 2025-05-01 wumingzi first version |
| 9 | + * 2025-11-24 ChuanN-sudo add standardized utest documentation block |
9 | 10 | */ |
10 | 11 |
|
11 | | -/* The file can test the rt-thread audio driver framework including following api via memory |
12 | | - * simulation. |
| 12 | +/** |
| 13 | + * Test Case Name: Audio Test |
13 | 14 | * |
14 | | - * rt_audio_register |
15 | | - * rt_audio_rx_done |
16 | | - * rt_audio_tx_complete |
| 15 | + * Test Objectives: |
| 16 | + * - Validate RT-Thread audio driver framework registration and data flow mechanisms. |
| 17 | + * - Verify audio playback (TX) and recording (RX) data transmission correctness. |
| 18 | + * - Ensure proper buffer management and memory integrity during audio operations. |
| 19 | + * - Test core APIs: rt_audio_register(), rt_audio_tx_complete(), rt_audio_rx_done() |
17 | 20 | * |
18 | | - * When audio devices generate or receive new data, the corresponding buffer in device will |
19 | | - * receive date from kernel or surroundings. The same phenomenon will also happen at the |
20 | | - * application level. Thus we can fill memory to simulate the generation of data then track |
21 | | - * and check memory to ensure kernel processing audio data correctly. And this depends on |
22 | | - * implementations of audio drivers. |
| 21 | + * Test Scenarios: |
| 22 | + * - Locate audio devices using SOUND_PLAYER_DEVICE_NAME and SOUND_MIC_DEVICE_NAME macros. |
| 23 | + * - Write known byte patterns (0xAA, 0x55) to simulate audio data flow through TX/RX buffers. |
| 24 | + * - Synchronize player and microphone test execution using audio_fsm_step state machine. |
| 25 | + * - Test two consecutive block transfers for both TX and RX paths. |
23 | 26 | * |
24 | | - * Therefore, if the player_test testcase failed, it could mean rt_audio_register or |
25 | | - * rt_audio_tx_complete existing bugs. Similarly, if mic_test testcase failed, it could mean |
26 | | - * rt_audio_register or rt_audio_rx_done existing bugs. |
| 27 | + * Verification Metrics: |
| 28 | + * - Written audio data appears correctly in device TX buffers with exact byte patterns. |
| 29 | + * - Data read from microphone device matches expected fill patterns (0xAA then 0x55) without corruption. |
| 30 | + * - Buffer boundaries are respected with no overflow or underflow conditions. |
| 31 | + * - Device open/close operations complete successfully without resource leaks. |
| 32 | + * |
| 33 | + * Dependencies: |
| 34 | + * - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread. |
| 35 | + * - Software configuration: |
| 36 | + * - RT_USING_UTESTCASES must be enabled (select "RT-Thread Utestcases" in menuconfig). |
| 37 | + * - RT_USING_AUDIO must be enabled (enable via: RT-Thread Components -> Device Drivers -> Using Audio device drivers). |
| 38 | + * - RT_UTEST_USING_AUDIO_DRIVER must be enabled (enable via: RT-Thread Utestcases -> Kernel Components-> Drivers -> Audio Test). |
| 39 | + * - Environmental Assumptions: Audio devices registered and functional, sufficient memory available. |
| 40 | + * |
| 41 | + * Expected Results: |
| 42 | + * - Final output: "[ PASSED ] [ result ] testcase (components.drivers.audio.tc_audio_main)" |
| 43 | + * - No memory leaks detected during buffer allocation/deallocation. |
| 44 | + * - No assertions triggered during test execution. |
| 45 | + * - Buffer content verification passes for all test patterns. |
27 | 46 | */ |
28 | 47 |
|
29 | 48 | #include "tc_audio_common.h" |
|
0 commit comments