From: Henrik Enquist via B4 Relay <devnull+henrik.enquist.gmail.com@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Mark Brown <broonie@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Henrik Enquist <henrik.enquist@gmail.com>
Subject: [PATCH 2/2] selftests/alsa: Check the aloop PCM Slave controls for a matching playback
Date: Wed, 21 Oct 2026 09:46:46 +0200 [thread overview]
Message-ID: <20261021-aloop-slave-controls-v1-2-62297727177f@gmail.com> (raw)
In-Reply-To: <20261021-aloop-slave-controls-v1-0-62297727177f@gmail.com>
From: Henrik Enquist <henrik.enquist@gmail.com>
Add a test that starts a playback with the same parameters as a running
capture, and checks that the capture keeps running and that the
"PCM Slave" controls report the playback's parameters, with a value
event for each control that changed. Before the previous patch, the
controls keep the parameters of the earlier stream and the test fails.
Signed-off-by: Henrik Enquist <henrik.enquist@gmail.com>
---
tools/testing/selftests/alsa/aloop-test.c | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/tools/testing/selftests/alsa/aloop-test.c b/tools/testing/selftests/alsa/aloop-test.c
index a58b9fdbdc..74d6ccc127 100644
--- a/tools/testing/selftests/alsa/aloop-test.c
+++ b/tools/testing/selftests/alsa/aloop-test.c
@@ -323,6 +323,46 @@ TEST_F(aloop, params_change_stops_capture_with_notify) {
snd_pcm_close(capt);
}
+/*
+ * A playback that joins a running capture with the same parameters doesn't
+ * stop it, and the "PCM Slave" controls still report the playback's
+ * parameters rather than those of an earlier stream.
+ */
+TEST_F(aloop, matching_playback_updates_controls) {
+ snd_pcm_t *capt, *play;
+ unsigned int events;
+
+ /* Leave the controls at other parameters than the ones used below. */
+ ASSERT_EQ(open_pcm(&play, self->play_name, SND_PCM_STREAM_PLAYBACK, &playback_params), 0);
+ ASSERT_EQ(start_playback(play, &playback_params), 0);
+ snd_pcm_close(play);
+
+ ASSERT_EQ(set_notify(self->ctl, false), 0);
+ ASSERT_EQ(open_pcm(&capt, self->capt_name, SND_PCM_STREAM_CAPTURE, &capture_params), 0);
+ ASSERT_EQ(snd_pcm_start(capt), 0);
+ read_events(self->ctl);
+
+ ASSERT_EQ(open_pcm(&play, self->play_name, SND_PCM_STREAM_PLAYBACK, &capture_params), 0);
+ ASSERT_EQ(start_playback(play, &capture_params), 0);
+
+ EXPECT_EQ(snd_pcm_state(capt), SND_PCM_STATE_RUNNING);
+
+ EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Active"), 1);
+ EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Format"), capture_params.format);
+ EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Rate"), capture_params.rate);
+ EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Channels"), capture_params.channels);
+ EXPECT_EQ(cable_ctl_get(self->ctl, "PCM Slave Access Mode"), 0);
+
+ events = read_events(self->ctl);
+ EXPECT_TRUE(events & EV_FORMAT);
+ EXPECT_TRUE(events & EV_RATE);
+ EXPECT_TRUE(events & EV_CHANNELS);
+ EXPECT_TRUE(events & EV_ACCESS);
+
+ snd_pcm_close(play);
+ snd_pcm_close(capt);
+}
+
/* With notify, a capture opened second is still pinned to the playback's parameters. */
TEST_F(aloop, capture_constrained_with_notify) {
struct probe_result res;
--
2.53.0
next prev parent reply other threads:[~2026-10-21 7:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 7:46 [PATCH 0/2] ALSA: aloop: Update the " Henrik Enquist via B4 Relay
2026-10-21 7:46 ` [PATCH 1/2] " Henrik Enquist via B4 Relay
2026-10-21 7:46 ` Henrik Enquist via B4 Relay [this message]
2026-10-21 12:56 ` [PATCH 0/2] " Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261021-aloop-slave-controls-v1-2-62297727177f@gmail.com \
--to=devnull+henrik.enquist.gmail.com@kernel.org \
--cc=broonie@kernel.org \
--cc=henrik.enquist@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®