From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Joseph Jang <jjang@nvidia.com>
Cc: shuah@kernel.org, avagin@google.com, amir73il@gmail.com,
brauner@kernel.org, mochs@nvidia.com,
linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org,
linux-kselftest@vger.kernel.org, sdonthineni@nvidia.com,
treding@nvidia.com, linux-tegra@vger.kernel.org
Subject: Re: [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
Date: Fri, 3 May 2024 08:49:15 +0200 [thread overview]
Message-ID: <202405030649157e9de2ac@mail.local> (raw)
In-Reply-To: <20240503014102.3568130-2-jjang@nvidia.com>
On 02/05/2024 18:41:02-0700, Joseph Jang wrote:
> Some platforms do not support WAKEUP service by default, we use a shell
> script to check the absence of alarm content in /proc/driver/rtc.
procfs for the RTC has been deprecated for a while, don't use it.
Instead, you can use the RTC_PARAM_GET ioctl to get RTC_PARAM_FEATURES
and then look at RTC_FEATURE_ALARM.
See https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git/tree/rtc.c
>
> The script will validate /proc/driver/rtc when it is not empty and then
> check if could find alarm content in it according to the rtc wakealarm
> is supported or not.
>
> Requires commit 101ca8d05913b ("rtc: efi: Enable SET/GET WAKEUP services
> as optional")
>
> Reviewed-by: Matthew R. Ochs <mochs@nvidia.com>
> Signed-off-by: Joseph Jang <jjang@nvidia.com>
> ---
> tools/testing/selftests/Makefile | 1 +
> tools/testing/selftests/rtc/property/Makefile | 5 ++++
> .../selftests/rtc/property/rtc-alarm-test.sh | 27 +++++++++++++++++++
> 3 files changed, 33 insertions(+)
> create mode 100644 tools/testing/selftests/rtc/property/Makefile
> create mode 100755 tools/testing/selftests/rtc/property/rtc-alarm-test.sh
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index e1504833654d..f5d43e2132e8 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -80,6 +80,7 @@ TARGETS += riscv
> TARGETS += rlimits
> TARGETS += rseq
> TARGETS += rtc
> +TARGETS += rtc/property
> TARGETS += rust
> TARGETS += seccomp
> TARGETS += sgx
> diff --git a/tools/testing/selftests/rtc/property/Makefile b/tools/testing/selftests/rtc/property/Makefile
> new file mode 100644
> index 000000000000..c6f7aa4f0e29
> --- /dev/null
> +++ b/tools/testing/selftests/rtc/property/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0
> +TEST_PROGS := rtc-alarm-test.sh
> +
> +include ../../lib.mk
> +
> diff --git a/tools/testing/selftests/rtc/property/rtc-alarm-test.sh b/tools/testing/selftests/rtc/property/rtc-alarm-test.sh
> new file mode 100755
> index 000000000000..3bee1dd5fbd0
> --- /dev/null
> +++ b/tools/testing/selftests/rtc/property/rtc-alarm-test.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +if [ ! -f /proc/driver/rtc ]; then
> + echo "SKIP: the /proc/driver/rtc is empty."
> + exit 4
> +fi
> +
> +# Check if could find alarm content in /proc/driver/rtc according to
> +# the rtc wakealarm is supported or not.
> +if [ -n "$(ls /sys/class/rtc/rtc* | grep -i wakealarm)" ]; then
> + if [ -n "$(grep -i alarm /proc/driver/rtc)" ]; then
> + exit 0
> + else
> + echo "ERROR: The alarm content is not found."
> + cat /proc/driver/rtc
> + exit 1
> + fi
> +else
> + if [ -n "$(grep -i alarm /proc/driver/rtc)" ]; then
> + echo "ERROR: The alarm content is found."
> + cat /proc/driver/rtc
> + exit 1
> + else
> + exit 0
> + fi
> +fi
> --
> 2.34.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-05-03 7:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 1:41 [PATCH 0/1] selftest: rtc: Add support rtc alarm content check Joseph Jang
2024-05-03 1:41 ` [PATCH 1/1] " Joseph Jang
2024-05-03 6:49 ` Alexandre Belloni [this message]
2024-05-03 10:47 ` Joseph Jang
2024-05-03 11:21 ` Joseph Jang
[not found] ` <IA0PR12MB83745321F32B6FA0DE041D10C01F2@IA0PR12MB8374.namprd12.prod.outlook.com>
2024-05-03 12:23 ` Joseph Jang
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=202405030649157e9de2ac@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=amir73il@gmail.com \
--cc=avagin@google.com \
--cc=brauner@kernel.org \
--cc=jjang@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=sdonthineni@nvidia.com \
--cc=shuah@kernel.org \
--cc=treding@nvidia.com \
/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.