linux/tools/testing/selftests/rtc
Mateusz Jończyk 2aaa36e95e selftests/rtc: continuously read RTC in a loop for 30s
Some problems with reading the RTC time may happen rarely, for example
while the RTC is updating. So read the RTC many times to catch these
problems. For example, a previous attempt for my
commit ea6fa4961a ("rtc: mc146818-lib: fix RTC presence check")
was incorrect and would have triggered this selftest.

To avoid the risk of damaging the hardware, wait 11ms before consecutive
reads.

In rtc_time_to_timestamp I copied values manually instead of casting -
just to be on the safe side. The 11ms wait period was chosen so that it is
not a divisor of 1000ms.

Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2022-02-25 17:00:51 -07:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile selftests: Install settings files to fix TIMEOUT failures 2020-02-20 08:56:42 -07:00
rtctest.c selftests/rtc: continuously read RTC in a loop for 30s 2022-02-25 17:00:51 -07:00
setdate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
settings selftests/rtc: continuously read RTC in a loop for 30s 2022-02-25 17:00:51 -07:00