[LTP] [PATCh v2] clock_gettime04: print more info to help debugging

Viresh Kumar viresh.kumar@linaro.org
Wed Mar 10 09:43:04 CET 2021


On 10-03-21, 16:34, Li Wang wrote:
> But we can put the printing behind the 'gettimeofday+CLOCK_REALTIME'
> checking.
> Just similar to what I did in patch V1, is that your mean, Petr?
> 
> --- a/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
> +++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
> @@ -108,6 +108,9 @@ static void run(unsigned int i)
>                         if (tv->clock_gettime == my_gettimeofday && clks[i]
> != CLOCK_REALTIME)
>                                 continue;
> 
> +                       if (count == 10000)
> +                                tst_res(TINFO, "\t- %s", tv->desc);
> +
>                         ret = tv->clock_gettime(clks[i], tst_ts_get(&ts));
>                         if (ret) {
>                                 /*
> @@ -139,8 +142,8 @@ static void run(unsigned int i)
> 
>                         diff = end + slack - start;
>                         if (diff < 0) {
> -                               tst_res(TFAIL, "%s: Time travelled
> backwards (%d): %lld ns",
> -                                       tst_clock_name(clks[i]), j, diff);
> +                               tst_res(TFAIL, "%s(%s): Time travelled
> backwards (%d): %lld ns",
> +                                       tst_clock_name(clks[i]), tv->desc,
> j, diff);
>                                 return;
>                         }

I think it would be worth keeping it simple then and just print all
variants only once from setup(). Leave the special case of REALTIME
clock.

-- 
viresh


More information about the ltp mailing list