linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Naresh Kamboju <naresh.kamboju@linaro.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: "open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	lkft-triage@lists.linaro.org, "Shuah Khan" <shuah@kernel.org>,
	"Mateusz Jończyk" <mat.jonczyk@o2.pl>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Daniel Díaz" <daniel.diaz@linaro.org>
Subject: Re: kselftest rtctests failed on arm64 Raspberry Pi 4 - rtctest.c:34:date_read:Expected -1 (-1) != self->fd (-1)
Date: Thu, 10 Nov 2022 13:09:09 +0530	[thread overview]
Message-ID: <CA+G9fYtdy=yybGGdcpFWMoui0v57UwYrT-NP0pZvesURQU7BzA@mail.gmail.com> (raw)
In-Reply-To: <Y2rLm3O2mrG7PcZN@mail.local>

Hi Alexandre,

On Wed, 9 Nov 2022 at 03:05, Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> Hello,
>
> On 08/11/2022 15:17:04+0530, Naresh Kamboju wrote:
> > kselftest rtctests failed on arm64 Raspberry Pi 4 Model B device and
> > passed on other devices and qemu emulators. Please refer to the
> > full logs and test comparison results links.
> >
>
> It seems your board doesn't have an rtc at all, the tests will not run
> unless you add one.
>
> You can try the following patch:

Daniel Diaz tested the following patch and results were changed from
FAIL to SKIP [1].

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by:  Daniel Diaz <daniel.diaz@linaro.org>

[  241.791361] kselftest: Running tests in rtc
TAP version 13
1..1
# selftests: rtc: rtctest
# TAP version 13
# 1..8
# # Starting 8 tests from 2 test cases.
# #  RUN           rtc.date_read ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.date_read
# ok 1 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.date_read_loop ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.date_read_loop
# ok 2 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.uie_read ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.uie_read
# ok 3 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.uie_select ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.uie_select
# ok 4 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.alarm_alm_set ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.alarm_alm_set
# ok 5 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.alarm_wkalm_set ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.alarm_wkalm_set
# ok 6 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.alarm_alm_set_minute ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.alarm_alm_set_minute
# ok 7 # SKIP Skipping test since /dev/rtc0 does not exist
# #  RUN           rtc.alarm_wkalm_set_minute ...
# #      SKIP      Skipping test since /dev/rtc0 does not exist
# #            OK  rtc.alarm_wkalm_set_minute
# ok 8 # SKIP Skipping test since /dev/rtc0 does not exist
# # PASSED: 8 / 8 tests passed.
# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:8 error:0
ok 1 selftests: rtc: rtctest


>
> From e93ddc7046aba97b39b0ceffc53ebf1f10ad9868 Mon Sep 17 00:00:00 2001
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Date: Tue, 8 Nov 2022 22:18:55 +0100
> Subject: [PATCH] selftests: rtc: skip when RTC is not present
>
> There is not point in failing the tests when there the RTC is not present,
> simply skip the test.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  tools/testing/selftests/rtc/rtctest.c | 33 ++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c
> index 2b9d929a24ed..63ce02d1d5cc 100644
> --- a/tools/testing/selftests/rtc/rtctest.c
> +++ b/tools/testing/selftests/rtc/rtctest.c
> @@ -31,7 +31,6 @@ FIXTURE(rtc) {
>
>  FIXTURE_SETUP(rtc) {
>         self->fd = open(rtc_file, O_RDONLY);
> -       ASSERT_NE(-1, self->fd);
>  }
>
>  FIXTURE_TEARDOWN(rtc) {
> @@ -42,6 +41,10 @@ TEST_F(rtc, date_read) {
>         int rc;
>         struct rtc_time rtc_tm;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         /* Read the RTC time/date */
>         rc = ioctl(self->fd, RTC_RD_TIME, &rtc_tm);
>         ASSERT_NE(-1, rc);
> @@ -85,6 +88,10 @@ TEST_F_TIMEOUT(rtc, date_read_loop, READ_LOOP_DURATION_SEC + 2) {
>         struct rtc_time rtc_tm;
>         time_t start_rtc_read, prev_rtc_read;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         TH_LOG("Continuously reading RTC time for %ds (with %dms breaks after every read).",
>                READ_LOOP_DURATION_SEC, READ_LOOP_SLEEP_MS);
>
> @@ -119,6 +126,10 @@ TEST_F_TIMEOUT(rtc, uie_read, NUM_UIE + 2) {
>         int i, rc, irq = 0;
>         unsigned long data;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         /* Turn on update interrupts */
>         rc = ioctl(self->fd, RTC_UIE_ON, 0);
>         if (rc == -1) {
> @@ -144,6 +155,10 @@ TEST_F(rtc, uie_select) {
>         int i, rc, irq = 0;
>         unsigned long data;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         /* Turn on update interrupts */
>         rc = ioctl(self->fd, RTC_UIE_ON, 0);
>         if (rc == -1) {
> @@ -183,6 +198,10 @@ TEST_F(rtc, alarm_alm_set) {
>         time_t secs, new;
>         int rc;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         rc = ioctl(self->fd, RTC_RD_TIME, &tm);
>         ASSERT_NE(-1, rc);
>
> @@ -237,6 +256,10 @@ TEST_F(rtc, alarm_wkalm_set) {
>         time_t secs, new;
>         int rc;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         rc = ioctl(self->fd, RTC_RD_TIME, &alarm.time);
>         ASSERT_NE(-1, rc);
>
> @@ -285,6 +308,10 @@ TEST_F_TIMEOUT(rtc, alarm_alm_set_minute, 65) {
>         time_t secs, new;
>         int rc;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         rc = ioctl(self->fd, RTC_RD_TIME, &tm);
>         ASSERT_NE(-1, rc);
>
> @@ -339,6 +366,10 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
>         time_t secs, new;
>         int rc;
>
> +       if (self->fd == -1 && errno == ENOENT)
> +               SKIP(return, "Skipping test since %s does not exist", rtc_file);
> +       ASSERT_NE(-1, self->fd);
> +
>         rc = ioctl(self->fd, RTC_RD_TIME, &alarm.time);
>         ASSERT_NE(-1, rc);

[1] https://lkft.validation.linaro.org/scheduler/job/5831980#L1760


--
Linaro LKFT
https://lkft.linaro.org

      reply	other threads:[~2022-11-10  7:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  9:47 kselftest rtctests failed on arm64 Raspberry Pi 4 - rtctest.c:34:date_read:Expected -1 (-1) != self->fd (-1) Naresh Kamboju
2022-11-08 21:35 ` Alexandre Belloni
2022-11-10  7:39   ` Naresh Kamboju [this message]

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='CA+G9fYtdy=yybGGdcpFWMoui0v57UwYrT-NP0pZvesURQU7BzA@mail.gmail.com' \
    --to=naresh.kamboju@linaro.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=daniel.diaz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mat.jonczyk@o2.pl \
    --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;
as well as URLs for NNTP newsgroup(s).