mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftest: rtc: skip alarm test if RTC is minute resolution
@ 2025-04-01 12:29 Weizhao Ouyang
  0 siblings, 0 replies; only message in thread
From: Weizhao Ouyang @ 2025-04-01 12:29 UTC (permalink / raw)
  To: Alexandre Belloni, Shuah Khan
  Cc: linux-rtc, linux-kselftest, linux-kernel, Weizhao Ouyang

Skip second resolution alarm test if RTC is minute resolution.

Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
---
 tools/testing/selftests/rtc/rtctest.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c
index e103097d0b5b..b8d196f1c5f6 100644
--- a/tools/testing/selftests/rtc/rtctest.c
+++ b/tools/testing/selftests/rtc/rtctest.c
@@ -28,6 +28,7 @@ static char *rtc_file = "/dev/rtc0";
 enum rtc_alarm_state {
 	RTC_ALARM_UNKNOWN,
 	RTC_ALARM_ENABLED,
+	RTC_ALARM_MINUTE,
 	RTC_ALARM_DISABLED,
 };
 
@@ -100,6 +101,9 @@ static enum rtc_alarm_state get_rtc_alarm_state(int fd)
 	if (rc < 0)
 		return RTC_ALARM_UNKNOWN;
 
+	if (param.uvalue & _BITUL(RTC_FEATURE_ALARM_RES_MINUTE))
+		return RTC_ALARM_MINUTE;
+
 	if ((param.uvalue & _BITUL(RTC_FEATURE_ALARM)) == 0)
 		return RTC_ALARM_DISABLED;
 
@@ -230,6 +234,8 @@ TEST_F(rtc, alarm_alm_set) {
 	alarm_state = get_rtc_alarm_state(self->fd);
 	if (alarm_state == RTC_ALARM_DISABLED)
 		SKIP(return, "Skipping test since alarms are not supported.");
+	if (alarm_state == RTC_ALARM_MINUTE)
+		SKIP(return, "Skipping test since alarms have minute resolution.");
 
 	rc = ioctl(self->fd, RTC_RD_TIME, &tm);
 	ASSERT_NE(-1, rc);
@@ -298,6 +304,8 @@ TEST_F(rtc, alarm_wkalm_set) {
 	alarm_state = get_rtc_alarm_state(self->fd);
 	if (alarm_state == RTC_ALARM_DISABLED)
 		SKIP(return, "Skipping test since alarms are not supported.");
+	if (alarm_state == RTC_ALARM_MINUTE)
+		SKIP(return, "Skipping test since alarms have minute resolution.");
 
 	rc = ioctl(self->fd, RTC_RD_TIME, &alarm.time);
 	ASSERT_NE(-1, rc);
-- 
2.45.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-04-01 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-01 12:29 [PATCH] selftest: rtc: skip alarm test if RTC is minute resolution Weizhao Ouyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®