diff options
| author | 2026-09-29 15:22:12 +0000 | |
|---|---|---|
| committer | 2026-10-19 22:08:21 +0200 | |
| commit | 82e7babfb39fc5a4f58f2fe725876363810f35bb (patch) | |
| tree | 77024bb43cf4dac43c0780c4d02203cad9bfb834 /scripts/Makefile.thinlto | |
| parent | rtc: pcf8563: pass the driver data to the alarm interrupt handler (diff) | |
selftests: rtc: fix flaky date_read_loop test
The test case rtc.date_read_loop in rtctest.c fails intermittently because
it checks that the RTC time does not advance by more than 1 second per loop
iteration. However, the loop sleeps for 11ms via nanosleep(), and if the
test thread is descheduled by the OS scheduler (e.g., under heavy system
load in a VM), more than 1 second can elapse between consecutive RTC reads.
This causes the next RTC time read to be 2 or more seconds ahead of the
previous read, triggering a test assertion failure.
To make the test more resilient against OS scheduling delays, measure the
real elapsed time between iterations using a monotonic clock
(clock_gettime(CLOCK_MONOTONIC)), and compute the actual number of seconds
elapsed (delta_s) between consecutive RTC reads. Then dynamically adjust
the assertion to:
ASSERT_GE(prev_rtc_read + delta_s + 1, rtc_read);
Signed-off-by: Wake Liu <wakel@google.com>
Link: https://patch.msgid.link/20260929152212.2092062-1-wakel@google.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
