mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable
@ 2026-09-27  6:44 Alireza Feyzabadi Farahani
  2026-09-28 11:13 ` Mark Brown
  2026-09-28 12:22 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Alireza Feyzabadi Farahani @ 2026-09-27  6:44 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, Shuah Khan, linux-sound,
	linux-kselftest, linux-kernel, Alireza Feyzabadi Farahani

When CONFIG_SND is disabled, opening /dev/snd/timer fails and the
userspace timer tests report failures even though the test environment
does not support ALSA timers.

Skip the affected tests when opening the timer device fails because the
device is unavailable. Continue to report unexpected open failures as
test failures.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218479
Signed-off-by: Alireza Feyzabadi Farahani <arfa79lg@gmail.com>
---
Changes in v2:
- Limit the change to the timer tests, leaving the PCM and mixer tests
  unchanged, as suggested by Mark Brown.

 tools/testing/selftests/alsa/utimer-test.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/alsa/utimer-test.c b/tools/testing/selftests/alsa/utimer-test.c
index 1a9ff010c..07aeaa777 100644
--- a/tools/testing/selftests/alsa/utimer-test.c
+++ b/tools/testing/selftests/alsa/utimer-test.c
@@ -51,6 +51,9 @@ FIXTURE_SETUP(timer_f) {
 	self->utimer_info->resolution = (NANO / FRAME_RATE * PERIOD_SIZE);
 
 	timer_dev_fd = open("/dev/snd/timer", O_RDONLY);
+	if (timer_dev_fd < 0 &&
+	    (errno == ENOENT || errno == ENODEV || errno == ENXIO))
+		SKIP(return, "ALSA timer device unavailable");
 	ASSERT_GE(timer_dev_fd, 0);
 
 	if (ioctl(timer_dev_fd, SNDRV_TIMER_IOCTL_CREATE, self->utimer_info) < 0) {
@@ -156,6 +159,9 @@ TEST(wrong_timers_test) {
 	};
 
 	timer_dev_fd = open("/dev/snd/timer", O_RDONLY);
+	if (timer_dev_fd < 0 &&
+	    (errno == ENOENT || errno == ENODEV || errno == ENXIO))
+		SKIP(return, "ALSA timer device unavailable");
 	ASSERT_GE(timer_dev_fd, 0);
 
 	utimer_fd = ioctl(timer_dev_fd, SNDRV_TIMER_IOCTL_CREATE, &wrong_timer);
-- 
2.34.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable
  2026-09-27  6:44 [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable Alireza Feyzabadi Farahani
@ 2026-09-28 11:13 ` Mark Brown
  2026-09-28 12:22 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-28 11:13 UTC (permalink / raw)
  To: Alireza Feyzabadi Farahani
  Cc: Jaroslav Kysela, Takashi Iwai, Shuah Khan, linux-sound,
	linux-kselftest, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

On Sun, Sep 27, 2026 at 06:44:30AM +0000, Alireza Feyzabadi Farahani wrote:
> When CONFIG_SND is disabled, opening /dev/snd/timer fails and the
> userspace timer tests report failures even though the test environment
> does not support ALSA timers.
> 
> Skip the affected tests when opening the timer device fails because the
> device is unavailable. Continue to report unexpected open failures as
> test failures.

Reviewed-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable
  2026-09-27  6:44 [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable Alireza Feyzabadi Farahani
  2026-09-28 11:13 ` Mark Brown
@ 2026-09-28 12:22 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2026-09-28 12:22 UTC (permalink / raw)
  To: Alireza Feyzabadi Farahani
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Shuah Khan,
	linux-sound, linux-kselftest, linux-kernel

On Sun, 27 Sep 2026 08:44:30 +0200,
Alireza Feyzabadi Farahani wrote:
> 
> When CONFIG_SND is disabled, opening /dev/snd/timer fails and the
> userspace timer tests report failures even though the test environment
> does not support ALSA timers.
> 
> Skip the affected tests when opening the timer device fails because the
> device is unavailable. Continue to report unexpected open failures as
> test failures.
> 
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218479
> Signed-off-by: Alireza Feyzabadi Farahani <arfa79lg@gmail.com>

Applied to for-next branch.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-28 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27  6:44 [PATCH v2] selftests: ALSA: Skip timer tests when device is unavailable Alireza Feyzabadi Farahani
2026-09-28 11:13 ` Mark Brown
2026-09-28 12:22 ` Takashi Iwai

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®