Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: Andrei Vagin <avagin@gmail.com>, Shuah Khan <shuah@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	linux-kselftest@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] selftests/timens: handle a case when alarm clocks are not supported
Date: Wed, 20 May 2020 12:55:40 +0100	[thread overview]
Message-ID: <5c9d2f75-d20a-d74a-f72a-94f3fa69bc16@arm.com> (raw)
In-Reply-To: <20200415061802.722485-1-avagin@gmail.com>

Hi Andrei,

thanks for this.

On 4/15/20 7:18 AM, Andrei Vagin wrote:
> This can happen if a testing node doesn't have RTC (real time clock)
> hardware or it doesn't support alarms.
> 

Could you please add the "Reported-by:" tag and the "Fixes:" one?

With this:

Acked-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> ---
>  tools/testing/selftests/timens/clock_nanosleep.c |  2 +-
>  tools/testing/selftests/timens/timens.c          |  2 +-
>  tools/testing/selftests/timens/timens.h          | 13 ++++++++++++-
>  3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/timens/clock_nanosleep.c b/tools/testing/selftests/timens/clock_nanosleep.c
> index 8e7b7c72ef65..72d41b955fb2 100644
> --- a/tools/testing/selftests/timens/clock_nanosleep.c
> +++ b/tools/testing/selftests/timens/clock_nanosleep.c
> @@ -119,7 +119,7 @@ int main(int argc, char *argv[])
>  
>  	ksft_set_plan(4);
>  
> -	check_config_posix_timers();
> +	check_supported_timers();
>  
>  	if (unshare_timens())
>  		return 1;
> diff --git a/tools/testing/selftests/timens/timens.c b/tools/testing/selftests/timens/timens.c
> index 559d26e21ba0..07feebe8e53e 100644
> --- a/tools/testing/selftests/timens/timens.c
> +++ b/tools/testing/selftests/timens/timens.c
> @@ -156,7 +156,7 @@ int main(int argc, char *argv[])
>  
>  	nscheck();
>  
> -	check_config_posix_timers();
> +	check_supported_timers();
>  
>  	ksft_set_plan(ARRAY_SIZE(clocks) * 2);
>  
> diff --git a/tools/testing/selftests/timens/timens.h b/tools/testing/selftests/timens/timens.h
> index e09e7e39bc52..d4fc52d47146 100644
> --- a/tools/testing/selftests/timens/timens.h
> +++ b/tools/testing/selftests/timens/timens.h
> @@ -14,15 +14,26 @@
>  #endif
>  
>  static int config_posix_timers = true;
> +static int config_alarm_timers = true;
>  
> -static inline void check_config_posix_timers(void)
> +static inline void check_supported_timers(void)
>  {
> +	struct timespec ts;
> +
>  	if (timer_create(-1, 0, 0) == -1 && errno == ENOSYS)
>  		config_posix_timers = false;
> +
> +	if (clock_gettime(CLOCK_BOOTTIME_ALARM, &ts) == -1 && errno == EINVAL)
> +		config_alarm_timers = false;
>  }
>  
>  static inline bool check_skip(int clockid)
>  {
> +	if (!config_alarm_timers && clockid == CLOCK_BOOTTIME_ALARM) {
> +		ksft_test_result_skip("CLOCK_BOOTTIME_ALARM isn't supported\n");
> +		return true;
> +	}
> +
>  	if (config_posix_timers)
>  		return false;
>  
> 

-- 
Regards,
Vincenzo

      parent reply	other threads:[~2020-05-20 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  6:18 [PATCH] selftests/timens: handle a case when alarm clocks are not supported Andrei Vagin
2020-04-17  9:28 ` [PATCH v2] " Andrei Vagin
2020-05-20 11:55 ` Vincenzo Frascino [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=5c9d2f75-d20a-d74a-f72a-94f3fa69bc16@arm.com \
    --to=vincenzo.frascino@arm.com \
    --cc=0x7f454c46@gmail.com \
    --cc=avagin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /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