linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] selftest: rtc: Add support rtc alarm content check
@ 2024-05-03  1:41 Joseph Jang
  2024-05-03  1:41 ` [PATCH 1/1] " Joseph Jang
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Jang @ 2024-05-03  1:41 UTC (permalink / raw)
  To: shuah, alexandre.belloni, avagin, jjang, amir73il, brauner,
	mochs, linux-kernel, linux-rtc, linux-kselftest
  Cc: sdonthineni, treding, linux-tegra

In order to make sure SET/GET WAKEUP services as optional patch has been
integrated correctly, we have created a shell script to validate
/proc/driver/rtc when it is not empty and then check the absence of alarm
content in RTC metadata according to the rtc wakealarm is supported or not.

Joseph Jang (1):
  selftest: rtc: Add support rtc alarm content check

 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

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
  2024-05-03  1:41 [PATCH 0/1] selftest: rtc: Add support rtc alarm content check Joseph Jang
@ 2024-05-03  1:41 ` Joseph Jang
  2024-05-03  6:49   ` Alexandre Belloni
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Jang @ 2024-05-03  1:41 UTC (permalink / raw)
  To: shuah, alexandre.belloni, avagin, jjang, amir73il, brauner,
	mochs, linux-kernel, linux-rtc, linux-kselftest
  Cc: sdonthineni, treding, linux-tegra

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.

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
  2024-05-03  1:41 ` [PATCH 1/1] " Joseph Jang
@ 2024-05-03  6:49   ` Alexandre Belloni
  2024-05-03 10:47     ` Joseph Jang
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandre Belloni @ 2024-05-03  6:49 UTC (permalink / raw)
  To: Joseph Jang
  Cc: shuah, avagin, amir73il, brauner, mochs, linux-kernel, linux-rtc,
	linux-kselftest, sdonthineni, treding, linux-tegra

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
  2024-05-03  6:49   ` Alexandre Belloni
@ 2024-05-03 10:47     ` Joseph Jang
  2024-05-03 11:21     ` Joseph Jang
       [not found]     ` <IA0PR12MB83745321F32B6FA0DE041D10C01F2@IA0PR12MB8374.namprd12.prod.outlook.com>
  2 siblings, 0 replies; 6+ messages in thread
From: Joseph Jang @ 2024-05-03 10:47 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: shuah, avagin, amir73il, brauner, mochs, linux-kernel, linux-rtc,
	linux-kselftest, sdonthineni, treding, linux-tegra



On 2024/5/3 2:49 PM, Alexandre Belloni wrote:
> 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
>

I found old version kernel doesn't support RTC_PARAM_GET ioctl. In order 
support old version kernel testing, is it possible to use rtc procfs to 
validate wakealarm function for old version kernel ?

Can I move this rtc alarm validation to 
<linux_root>/tools/testing/selftests/rtc/rtctest.c ? So we could try to 
use RTC_PARAM_GET ioctl
first and then roll back to use rtc procfs if RTC_PARAM_GET ioctl was 
not supported.

Thank you,
Joseph.

>>
>> 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
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
  2024-05-03  6:49   ` Alexandre Belloni
  2024-05-03 10:47     ` Joseph Jang
@ 2024-05-03 11:21     ` Joseph Jang
       [not found]     ` <IA0PR12MB83745321F32B6FA0DE041D10C01F2@IA0PR12MB8374.namprd12.prod.outlook.com>
  2 siblings, 0 replies; 6+ messages in thread
From: Joseph Jang @ 2024-05-03 11:21 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: shuah, avagin, amir73il, brauner, mochs, linux-kernel, linux-rtc,
	linux-kselftest, sdonthineni, treding, linux-tegra

Hi Alexandre,

Thanks for your promptly response, I try to re-send the email again and 
avoid the security scanner to disrupt the external link.


 > 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.

I found old version kernel doesn't support RTC_PARAM_GET ioctl. In order
support old version kernel testing, is it possible to use rtc procfs to
validate wakealarm function for old version kernel ?

Can I move this rtc alarm validation to
<linux_root>/tools/testing/selftests/rtc/rtctest.c ? So we could try to
use RTC_PARAM_GET ioctl first and then roll back to use rtc procfs if 
RTC_PARAM_GET ioctl was not supported.

Thank you,
Joseph.



On 2024/5/3 2:49 PM, Alexandre Belloni wrote:
> 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
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] selftest: rtc: Add support rtc alarm content check
       [not found]     ` <IA0PR12MB83745321F32B6FA0DE041D10C01F2@IA0PR12MB8374.namprd12.prod.outlook.com>
@ 2024-05-03 12:23       ` Joseph Jang
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Jang @ 2024-05-03 12:23 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: shuah, avagin, amir73il, brauner, Matt Ochs, linux-kernel,
	linux-rtc, linux-kselftest, Shanker Donthineni, Thierry Reding,
	linux-tegra

Hi Alexandre,

Thanks for your promptly response, I try to remove all HTML links and
resend the email again to avoid the security scanner to disrupt the 
external link. Hope you can see this email without problems.


On 2024/5/3 8:20 PM, Joseph Jang wrote:
> 
> 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.
> 
I found old version kernel doesn't support RTC_PARAM_GET ioctl. In order
support old version kernel testing, is it possible to use rtc procfs to
validate wakealarm function for old version kernel ?

Can I move this rtc alarm validation to
<linux_root>/tools/testing/selftests/rtc/rtctest.c ? So, we could try to
use RTC_PARAM_GET ioctl first and then roll back to use rtc procfs if
new RTC_PARAM_GET ioctl was not supported.


Thank you,
Joseph

>   >
>   > 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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-03 12:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).