[PATCH 1/3] tst: Modify tst-clock_adjtime to allow reuse of its code

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Mar 2 12:23:30 GMT 2021



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


More information about the Libc-alpha mailing list