From 368e5d4d12a802ee3708800319cd13904721286f Mon Sep 17 00:00:00 2001 From: Anirudh Srinivasan Date: Fri, 2 Oct 2026 16:54:46 -0500 Subject: [PATCH] selftests: breakpoints: Skip step_after_suspend_test on systems without a wakeup capable RTC This test puts a system into suspend state and uses CLOCK_BOOTTIME_ALARM to wake the system up. This alarm can only wake up systems that have a wakeup capable RTC source. On systems without such an RTC (for example, most RISC-V boards), this test puts the system into suspend and just hangs, requiring power cycling. clock_getres(CLOCK_BOOTTIME_ALARM) fails with EINVAL on such systems, so add a check based on that to skip this test on systems without a wakeup capable RTC source. Link: https://lore.kernel.org/r/20261002-breakpoints_rtc-v1-1-a3b6542a0fdf@oss.tenstorrent.com Signed-off-by: Anirudh Srinivasan Signed-off-by: Shuah Khan --- .../selftests/breakpoints/step_after_suspend_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c index ca2aaab9e4ca..727790259429 100644 --- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c +++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "kselftest.h" @@ -158,11 +159,21 @@ void suspend(void) int err; int count_before; int count_after; + struct timespec res; struct itimerspec spec = {}; if (getuid() != 0) ksft_exit_skip("Please run the test as root - Exiting.\n"); + /* + * CLOCK_BOOTTIME_ALARM cannot wake up systems that don't have a + * wakeup capable RTC from suspend. Check if we have a wakeup-capable + * RTC to prevent this test from causing the system to hang after + * it suspends. + */ + if (clock_getres(CLOCK_BOOTTIME_ALARM, &res) != 0) + ksft_exit_skip("No wakeup-capable RTC for CLOCK_BOOTTIME_ALARM\n"); + timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0); if (timerfd < 0) ksft_exit_fail_msg("timerfd_create() failed\n");