[tip: timers/vdso] selftests: vDSO: vdso_test_abi: Also test ALARM clocks

From: tip-bot2 for Thomas Weißschuh

Date: Mon Nov 30 2026 - 15:28:20 EST


The following commit has been merged into the timers/vdso branch of tip:

Commit-ID: befb4225588c93796054be49dc589c20ad848ce5
Gitweb: https://git.kernel.org/tip/befb4225588c93796054be49dc589c20ad848ce5
Author: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
AuthorDate: Tue, 10 Nov 2026 13:19:32
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 30 Nov 2026 18:05:18 +01:00

selftests: vDSO: vdso_test_abi: Also test ALARM clocks

Extend the tests to also handle CLOCK_REALTIME_ALARM and
CLOCK_BOOTTIME_ALARM. These are currently not handled by the vDSO,
so will fall through to the system call and succeed.

The tests will become useful when the vDSO will start handling these
clocks in later patches.

[ tglx: Skip the tests when the syscall fallback returns -EINVAL, which
means that no RTC is available or posix timers are disabled in
Kconfig ]

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Link: https://patch.msgid.link/20261110-vdso-alarm-clocks-v3-1-8f3c0c5b5a11@xxxxxxxxxxxxxx
---
tools/testing/selftests/vDSO/vdso_test_abi.c | 23 +++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index b162a4b..b98ede0 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -126,7 +126,24 @@ static void vdso_test_clock_gettime(clockid_t clk_id)
(long long)ts.tv_sec, (long long)ts.tv_nsec);
ksft_test_result_pass("%s %s\n", name[1],
vdso_clock_name[clk_id]);
- } else {
+ return;
+ }
+
+ switch (clk_id) {
+ case CLOCK_REALTIME_ALARM:
+ case CLOCK_BOOTTIME_ALARM:
+ /*
+ * If no RTC device available or disabled in Kconfig
+ * the syscall fallback returns -EINVAL.
+ */
+ if (ret == -EINVAL) {
+ ksft_test_result_skip("%s %s\n", name[1],
+ vdso_clock_name[clk_id]);
+ return;
+ }
+
+ /* fallthrough; */
+ default:
ksft_test_result_fail("%s %s\n", name[1],
vdso_clock_name[clk_id]);
}
@@ -261,7 +278,7 @@ static inline void vdso_test_clock(clockid_t clock_id)
vdso_test_clock_getres_time64(clock_id);
}

-#define VDSO_TEST_PLAN 38
+#define VDSO_TEST_PLAN 46

int main(int argc, char **argv)
{
@@ -284,7 +301,9 @@ int main(int argc, char **argv)
vdso_test_gettimeofday();

vdso_test_clock(CLOCK_REALTIME);
+ vdso_test_clock(CLOCK_REALTIME_ALARM);
vdso_test_clock(CLOCK_BOOTTIME);
+ vdso_test_clock(CLOCK_BOOTTIME_ALARM);
vdso_test_clock(CLOCK_TAI);
vdso_test_clock(CLOCK_REALTIME_COARSE);
vdso_test_clock(CLOCK_MONOTONIC);