public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Lukasz Majewski <lukma@denx.de>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 1/3] tst: Modify tst-clock_adjtime to allow reuse of its code
Date: Tue, 2 Mar 2021 09:23:30 -0300	[thread overview]
Message-ID: <f0ca1d04-ba2c-caab-af7b-0798308871ab@linaro.org> (raw)
In-Reply-To: <20210228223938.8304-1-lukma@denx.de>



On 28/02/2021 19:39, Lukasz Majewski wrote:
> The tst-clock_adjtime can be adjusted to be reused for also testing
> adjtimex.

LGTM, although below there is a suggestion than simplifies the code a bit.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/tst-clock_adjtime.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-clock_adjtime.c b/sysdeps/unix/sysv/linux/tst-clock_adjtime.c
> index 6b9bb9940c..84a3f19504 100644
> --- a/sysdeps/unix/sysv/linux/tst-clock_adjtime.c
> +++ b/sysdeps/unix/sysv/linux/tst-clock_adjtime.c
> @@ -22,6 +22,11 @@
>  #include <support/check.h>
>  #include <support/timespec.h>
>  
> +#ifndef TST_ADJTIME_SYSCALL
> +#define TST_ADJTIME_SYSCALL clock_adjtime
> +#define TST_ADJTIME_ARGS (CLOCK_REALTIME, &delta)
> +#endif
> +

It would be simpler to just do:

#ifndef ADJTIME_CALL
# define ADJTIME_CALL(__clock, __timex) clock_adjtime (__clock, __timex)
#endif

and then for adjtimex test define:

#define ADJTIME_CALL(__clock, __timex) adjtimex (__timex)

>  static int
>  do_test (void)
>  {
> @@ -40,7 +45,7 @@ do_test (void)
>    delta.time.tv_usec = 0;
>    delta.modes = ADJ_SETOFFSET;
>  
> -  int ret = clock_adjtime (CLOCK_REALTIME, &delta);
> +  int ret = TST_ADJTIME_SYSCALL TST_ADJTIME_ARGS;
>    if (ret == -1)
>      FAIL_EXIT1 ("clock_adjtime failed: %m\n");
>  
> 

  parent reply	other threads:[~2021-03-02 12:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 22:39 Lukasz Majewski
2021-02-28 22:39 ` [PATCH 2/3] tst: Add test for adjtimex Lukasz Majewski
2021-03-02 12:24   ` Adhemerval Zanella
2021-02-28 22:39 ` [PATCH 3/3] tst: Add test for ntp_adjtime Lukasz Majewski
2021-03-02 12:25   ` Adhemerval Zanella
2021-03-02 12:23 ` Adhemerval Zanella [this message]
2021-03-02 13:23   ` [PATCH 1/3] tst: Modify tst-clock_adjtime to allow reuse of its code Lukasz Majewski

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=f0ca1d04-ba2c-caab-af7b-0798308871ab@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).