Skip to content

Commit 5423d43

Browse files
ChuanN-sudoRbb666
authored andcommitted
[utest][audio]:Add standardized documentation for Audio Test
1 parent d3e2699 commit 5423d43

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

components/drivers/audio/utest/tc_audio_main.c

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,43 @@
66
* Change Logs:
77
* Date Author Notes
88
* 2025-05-01 wumingzi first version
9+
* 2025-11-24 ChuanN-sudo add standardized utest documentation block
910
*/
1011

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
1314
*
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()
1720
*
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.
2326
*
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.
2746
*/
2847

2948
#include "tc_audio_common.h"

0 commit comments

Comments
 (0)