[PATCH 2/5] selftests: vDSO: vdso_test_correctness: Use symbolic clock IDs

From: Thomas Weißschuh

Date: Tue Jul 28 2026 - 03:59:16 EST


While the hardcoded constants are correct, they are not obvious when
reading the code.

Switch to symbolic identifiers.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
.../testing/selftests/vDSO/vdso_test_correctness.c | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index bcce5053e822..3671ea815823 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -255,18 +255,18 @@ static const struct {
clockid_t id;
const char *const name;
} clocks[] = {
- { 0, "CLOCK_REALTIME"},
- { 1, "CLOCK_MONOTONIC"},
- { 2, "CLOCK_PROCESS_CPUTIME_ID"},
- { 3, "CLOCK_THREAD_CPUTIME_ID"},
- { 4, "CLOCK_MONOTONIC_RAW"},
- { 5, "CLOCK_REALTIME_COARSE"},
- { 6, "CLOCK_MONOTONIC_COARSE"},
- { 7, "CLOCK_BOOTTIME"},
- { 8, "CLOCK_REALTIME_ALARM"},
- { 9, "CLOCK_BOOTTIME_ALARM"},
- { 10, "CLOCK_SGI_CYCLE"},
- { 11, "CLOCK_TAI"},
+ { CLOCK_REALTIME, "CLOCK_REALTIME"},
+ { CLOCK_MONOTONIC, "CLOCK_MONOTONIC"},
+ { CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID"},
+ { CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID"},
+ { CLOCK_MONOTONIC_RAW, "CLOCK_MONOTONIC_RAW"},
+ { CLOCK_REALTIME_COARSE, "CLOCK_REALTIME_COARSE"},
+ { CLOCK_MONOTONIC_COARSE, "CLOCK_MONOTONIC_COARSE"},
+ { CLOCK_BOOTTIME, "CLOCK_BOOTTIME"},
+ { CLOCK_REALTIME_ALARM, "CLOCK_REALTIME_ALARM"},
+ { CLOCK_BOOTTIME_ALARM, "CLOCK_BOOTTIME_ALARM"},
+ { 10, "CLOCK_SGI_CYCLE"},
+ { CLOCK_TAI, "CLOCK_TAI"},
};

static void test_one_clock_gettime(int clock, const char *name)

--
2.55.0