From 3e9c6464dadd52334abc22bc089cc5307d46314a Mon Sep 17 00:00:00 2001 From: Alireza Feyzabadi Farahani Date: Sun, 27 Sep 2026 06:44:30 +0000 Subject: [PATCH] selftests: ALSA: Skip timer tests when device is unavailable 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 Reviewed-by: Mark Brown Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/20260927064430.2112688-1-arfa79lg@gmail.com --- 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 1a9ff010cb11..07aeaa777649 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);