selftests: ALSA: pcmtest: Compare all captured bytes in ni_capture

The ni_capture test reads rate * time frames into each channel buffer
and then compares rate * time bytes. A frame is sample_size bytes per
channel, so with S16_LE only the first half of each channel is checked.
If the second half is wrong the test still passes.

Compare rate * time * sample_size bytes per channel.

Fixes: 10b98a4db1 ("selftests: ALSA: Add test for the 'pcmtest' driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://patch.msgid.link/20261021112554.4037107-1-sammiee5311@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
HyeongJun An 2026-10-21 20:25:54 +09:00 committed by Takashi Iwai
parent d158ee133e
commit c8c199e1b1

View File

@ -265,7 +265,7 @@ TEST_F(pcmtest, ni_capture) {
snd_pcm_close(handle);
for (i = 0; i < CH_NUM; i++) {
for (j = 0; j < params.rate * params.time; j++)
for (j = 0; j < params.rate * params.time * params.sample_size; j++)
ASSERT_EQ(chan_samples[i][j], patterns[i].buf[j % patterns[i].len]);
free(chan_samples[i]);
}