All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Cc: Hiroyuki Yasuhara <hyasuhar@redhat.com>
Subject: [LTP] [PATCH 1/3] rtc02: skip test with unsupport set RTC platform
Date: Thu, 28 Apr 2022 21:26:54 +0800	[thread overview]
Message-ID: <20220428132656.11075-2-liwang@redhat.com> (raw)
In-Reply-To: <20220428132656.11075-1-liwang@redhat.com>

Some hardware(e.g. Fujisu FX700) does not provides a feature to set the
RTC clock, thus test failed with EINVAL from ioctl(RTC_SET_TIME).

  tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s
  rtc02.c:66: TINFO: To set RTC date/time is: 2020-10-09 13:23:30
  rtc02.c:70: TFAIL: ioctl() RTC_SET_TIME: EINVAL (22)
  tst_rtctime.c:116: TWARN: open(/dev/rtc,0,7020) failed: EBUSY (16)
  tst_wallclock.c:117: TWARN: tst_rtc_settime() realtime failed: EBADF (9)

Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Hiroyuki Yasuhara <hyasuhar@redhat.com>
---
 testcases/kernel/device-drivers/rtc/rtc02.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/device-drivers/rtc/rtc02.c b/testcases/kernel/device-drivers/rtc/rtc02.c
index ef83aad89..8484a0074 100644
--- a/testcases/kernel/device-drivers/rtc/rtc02.c
+++ b/testcases/kernel/device-drivers/rtc/rtc02.c
@@ -22,6 +22,7 @@
 #include "tst_wallclock.h"
 #include "tst_test.h"
 
+static int rtc_unsupport;
 static char *rtc_dev = "/dev/rtc";
 
 static char *rtctime_to_str(struct rtc_time *tm)
@@ -67,6 +68,10 @@ static void set_rtc_test(void)
 
 	ret = tst_rtc_settime(rtc_dev, &set_tm);
 	if (ret != 0) {
+		if (errno == EINVAL) {
+			rtc_unsupport = 1;
+			tst_brk(TCONF, "RTC may not support be set via ioctl(RTC_SET_TIME)");
+		}
 		tst_res(TFAIL | TERRNO, "ioctl() RTC_SET_TIME");
 		return;
 	}
@@ -99,7 +104,8 @@ static void rtc_setup(void)
 
 static void rtc_cleanup(void)
 {
-	tst_rtc_clock_restore(rtc_dev);
+	if (!rtc_unsupport)
+		tst_rtc_clock_restore(rtc_dev);
 }
 
 static struct tst_test test = {
-- 
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-04-28 13:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 13:26 [LTP] [PATCH 0/3] fix some bugs in rct02 Li Wang
2022-04-28 13:26 ` Li Wang [this message]
2022-04-29 11:07   ` [LTP] [PATCH 1/3] rtc02: skip test with unsupport set RTC platform Cyril Hrubis
2022-04-29 11:12     ` Li Wang
2022-04-28 13:26 ` [LTP] [PATCH 2/3] rtc02: reset backward 1 hour to RTC time Li Wang
2022-04-29 11:09   ` Cyril Hrubis
2022-04-28 13:26 ` [LTP] [PATCH 3/3] rtc02: loosen the compare precision with few seconds Li Wang
2022-05-05 14:05   ` Cyril Hrubis
2022-05-08  2:22     ` Li Wang
2022-05-08  3:05       ` [LTP] [PATCH v2] " Li Wang
2022-05-08  4:19         ` Li Wang
2022-05-10 14:08         ` Cyril Hrubis
2022-05-11  1:54           ` Li Wang

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=20220428132656.11075-2-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=hyasuhar@redhat.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.