mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Weizhao Ouyang <o451686892@gmail.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Shuah Khan <shuah@kernel.org>
Cc: linux-rtc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Weizhao Ouyang <o451686892@gmail.com>
Subject: [PATCH] selftest: rtc: skip alarm test if RTC is minute resolution
Date: Tue,  1 Apr 2025 20:29:23 +0800	[thread overview]
Message-ID: <20250401122923.10848-1-o451686892@gmail.com> (raw)

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


                 reply	other threads:[~2025-04-01 12:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250401122923.10848-1-o451686892@gmail.com \
    --to=o451686892@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®