All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] rtc: rtctest: Support opal-rtc and rtc-generic
@ 2017-08-11  9:14 Lukáš Doktor
  2017-08-11  9:14 ` [PATCH] rtc: rtctest: Improve support detection Lukáš Doktor
  0 siblings, 1 reply; 4+ messages in thread
From: Lukáš Doktor @ 2017-08-11  9:14 UTC (permalink / raw)
  To: ldoktor, a.zummo, alexandre.belloni, john.stultz, tglx, sboyd,
	shuah, linux-rtc, linux-kernel, linux-kselftest, linuxppc-dev

On ppc64le machines the opal-rtc, resp rtc-generic in guest is used. They only
support minimal set of functionality and fail this test in not-yet treated
way. This extends the checks and skips to the next test when feature is not
supported.

Lukáš Doktor (1):
  rtc: rtctest: Improve support detection

 tools/testing/selftests/timers/rtctest.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.9.4

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

* [PATCH] rtc: rtctest: Improve support detection
  2017-08-11  9:14 [PATCH 0/1] rtc: rtctest: Support opal-rtc and rtc-generic Lukáš Doktor
@ 2017-08-11  9:14 ` Lukáš Doktor
  2017-08-12 20:22   ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Lukáš Doktor @ 2017-08-11  9:14 UTC (permalink / raw)
  To: ldoktor, a.zummo, alexandre.belloni, john.stultz, tglx, sboyd,
	shuah, linux-rtc, linux-kernel, linux-kselftest, linuxppc-dev

The rtc-generic and opal-rtc are failing to run this test as they do not
support all the features. Let's treat the error returns and skip to the
following test.

Theoretically the test_DATE should be also adjusted, but as it's enabled
on demand I think it makes sense to fail in such case.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
---
 tools/testing/selftests/timers/rtctest.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/timers/rtctest.c b/tools/testing/selftests/timers/rtctest.c
index f61170f..6344842 100644
--- a/tools/testing/selftests/timers/rtctest.c
+++ b/tools/testing/selftests/timers/rtctest.c
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
 	/* Turn on update interrupts (one per second) */
 	retval = ioctl(fd, RTC_UIE_ON, 0);
 	if (retval == -1) {
-		if (errno == EINVAL) {
+		if (errno == EINVAL || errno == EINVAL) {
 			fprintf(stderr,
 				"\n...Update IRQs not supported.\n");
 			goto test_READ;
@@ -221,6 +221,11 @@ int main(int argc, char **argv)
 	/* Read the current alarm settings */
 	retval = ioctl(fd, RTC_ALM_READ, &rtc_tm);
 	if (retval == -1) {
+		if (errno == EINVAL) {
+			fprintf(stderr,
+					"\n...EINVAL reading current alarm setting.\n");
+			goto test_PIE;
+		}
 		perror("RTC_ALM_READ ioctl");
 		exit(errno);
 	}
@@ -231,7 +236,7 @@ int main(int argc, char **argv)
 	/* Enable alarm interrupts */
 	retval = ioctl(fd, RTC_AIE_ON, 0);
 	if (retval == -1) {
-		if (errno == EINVAL) {
+		if (errno == EINVAL || errno ==EIO) {
 			fprintf(stderr,
 				"\n...Alarm IRQs not supported.\n");
 			goto test_PIE;
-- 
2.9.4

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

* Re: [PATCH] rtc: rtctest: Improve support detection
  2017-08-11  9:14 ` [PATCH] rtc: rtctest: Improve support detection Lukáš Doktor
@ 2017-08-12 20:22   ` Alexandre Belloni
  2017-08-15  8:20     ` Lukáš Doktor
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2017-08-12 20:22 UTC (permalink / raw)
  To: Lukáš Doktor
  Cc: a.zummo, john.stultz, tglx, sboyd, shuah, linux-rtc,
	linux-kernel, linux-kselftest, linuxppc-dev

Hi,

On 11/08/2017 at 11:14:55 +0200, Lukáš Doktor wrote:
> The rtc-generic and opal-rtc are failing to run this test as they do not
> support all the features. Let's treat the error returns and skip to the
> following test.
> 
> Theoretically the test_DATE should be also adjusted, but as it's enabled
> on demand I think it makes sense to fail in such case.
> 
> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
> ---
>  tools/testing/selftests/timers/rtctest.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/timers/rtctest.c b/tools/testing/selftests/timers/rtctest.c
> index f61170f..6344842 100644
> --- a/tools/testing/selftests/timers/rtctest.c
> +++ b/tools/testing/selftests/timers/rtctest.c
> @@ -125,7 +125,7 @@ int main(int argc, char **argv)
>  	/* Turn on update interrupts (one per second) */
>  	retval = ioctl(fd, RTC_UIE_ON, 0);
>  	if (retval == -1) {
> -		if (errno == EINVAL) {
> +		if (errno == EINVAL || errno == EINVAL) {

Well, this needs to be fixed.

>  			fprintf(stderr,
>  				"\n...Update IRQs not supported.\n");
>  			goto test_READ;
> @@ -221,6 +221,11 @@ int main(int argc, char **argv)
>  	/* Read the current alarm settings */
>  	retval = ioctl(fd, RTC_ALM_READ, &rtc_tm);
>  	if (retval == -1) {
> +		if (errno == EINVAL) {
> +			fprintf(stderr,
> +					"\n...EINVAL reading current alarm setting.\n");
> +			goto test_PIE;
> +		}
>  		perror("RTC_ALM_READ ioctl");
>  		exit(errno);
>  	}
> @@ -231,7 +236,7 @@ int main(int argc, char **argv)
>  	/* Enable alarm interrupts */
>  	retval = ioctl(fd, RTC_AIE_ON, 0);
>  	if (retval == -1) {
> -		if (errno == EINVAL) {
> +		if (errno == EINVAL || errno ==EIO) {
>  			fprintf(stderr,
>  				"\n...Alarm IRQs not supported.\n");
>  			goto test_PIE;
> -- 
> 2.9.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH] rtc: rtctest: Improve support detection
  2017-08-12 20:22   ` Alexandre Belloni
@ 2017-08-15  8:20     ` Lukáš Doktor
  0 siblings, 0 replies; 4+ messages in thread
From: Lukáš Doktor @ 2017-08-15  8:20 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: a.zummo, john.stultz, tglx, sboyd, shuah, linux-rtc,
	linux-kernel, linux-kselftest, linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 2200 bytes --]

Dne 12.8.2017 v 22:22 Alexandre Belloni napsal(a):
> Hi,
> 
> On 11/08/2017 at 11:14:55 +0200, Lukáš Doktor wrote:
>> The rtc-generic and opal-rtc are failing to run this test as they do not
>> support all the features. Let's treat the error returns and skip to the
>> following test.
>>
>> Theoretically the test_DATE should be also adjusted, but as it's enabled
>> on demand I think it makes sense to fail in such case.
>>
>> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
>> ---
>>  tools/testing/selftests/timers/rtctest.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/timers/rtctest.c b/tools/testing/selftests/timers/rtctest.c
>> index f61170f..6344842 100644
>> --- a/tools/testing/selftests/timers/rtctest.c
>> +++ b/tools/testing/selftests/timers/rtctest.c
>> @@ -125,7 +125,7 @@ int main(int argc, char **argv)
>>  	/* Turn on update interrupts (one per second) */
>>  	retval = ioctl(fd, RTC_UIE_ON, 0);
>>  	if (retval == -1) {
>> -		if (errno == EINVAL) {
>> +		if (errno == EINVAL || errno == EINVAL) {
> 
> Well, this needs to be fixed.
> 

Yes, this chunk is actually not needed anymore (it was based on outdated copy we use in Autotest which had ENOTTY which is probably not needed nowadays). Let me send v2 without this.

Regards,
Lukáš

>>  			fprintf(stderr,
>>  				"\n...Update IRQs not supported.\n");
>>  			goto test_READ;
>> @@ -221,6 +221,11 @@ int main(int argc, char **argv)
>>  	/* Read the current alarm settings */
>>  	retval = ioctl(fd, RTC_ALM_READ, &rtc_tm);
>>  	if (retval == -1) {
>> +		if (errno == EINVAL) {
>> +			fprintf(stderr,
>> +					"\n...EINVAL reading current alarm setting.\n");
>> +			goto test_PIE;
>> +		}
>>  		perror("RTC_ALM_READ ioctl");
>>  		exit(errno);
>>  	}
>> @@ -231,7 +236,7 @@ int main(int argc, char **argv)
>>  	/* Enable alarm interrupts */
>>  	retval = ioctl(fd, RTC_AIE_ON, 0);
>>  	if (retval == -1) {
>> -		if (errno == EINVAL) {
>> +		if (errno == EINVAL || errno ==EIO) {
>>  			fprintf(stderr,
>>  				"\n...Alarm IRQs not supported.\n");
>>  			goto test_PIE;
>> -- 
>> 2.9.4
>>
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 502 bytes --]

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

end of thread, other threads:[~2017-08-15  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11  9:14 [PATCH 0/1] rtc: rtctest: Support opal-rtc and rtc-generic Lukáš Doktor
2017-08-11  9:14 ` [PATCH] rtc: rtctest: Improve support detection Lukáš Doktor
2017-08-12 20:22   ` Alexandre Belloni
2017-08-15  8:20     ` Lukáš Doktor

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.