public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 14:23:05 +0100	[thread overview]
Message-ID: <20210302142305.047515bd@jawa> (raw)
In-Reply-To: <f0ca1d04-ba2c-caab-af7b-0798308871ab@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]

Hi Adhemerval,

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

Yes, this approach is far more clear. I will use it.

> >  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");
> >  
> >   




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

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

      reply	other threads:[~2021-03-02 13: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 ` [PATCH 1/3] tst: Modify tst-clock_adjtime to allow reuse of its code Adhemerval Zanella
2021-03-02 13:23   ` Lukasz Majewski [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=20210302142305.047515bd@jawa \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /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).