[LTP] [PATCH v5 1/2] ptrace05: Refactor the test using new LTP API

Cyril Hrubis chrubis@suse.cz
Tue Jan 14 10:25:35 CET 2025


Hi!
> > diff --git a/lib/tests/tst_strsig.c b/lib/tests/tst_strsig.c
> > index 9a5ca80aa..ed5be3f00 100644
> > --- a/lib/tests/tst_strsig.c
> > +++ b/lib/tests/tst_strsig.c
> > @@ -29,6 +29,7 @@ int TST_TOTAL = 1;
> 
> >  int main(void)
> >  {
> > +       fprintf(stderr, "0 = %s\n", tst_strsig(0));
> >         fprintf(stderr, "SIGKILL = %s\n", tst_strsig(SIGKILL));
> >         fprintf(stderr, "SIGALRM = %s\n", tst_strsig(SIGALRM));
> >         return 0;
> > diff --git a/lib/tst_res.c b/lib/tst_res.c
> > index 7c66d2f6c..90403bc67 100644
> > --- a/lib/tst_res.c
> > +++ b/lib/tst_res.c
> > @@ -141,11 +141,14 @@ struct pair {
> >  #define PAIR(def) [def] = {.name = #def, .val = def},
> >  #define STRPAIR(key, value) [key] = {.name = value, .val = key},
> 
> > -#define PAIR_LOOKUP(pair_arr, idx) do {                       \
> > -       if (idx < 0 || (size_t)idx >= ARRAY_SIZE(pair_arr) || \
> > -           pair_arr[idx].name == NULL)                       \
> > -               return "???";                                 \
> > -       return pair_arr[idx].name;                            \
> > +#define PAIR_LOOKUP(pair_arr, idx) do {                                    \
> > +       static char par_str_buf__[16];                                     \
> > +       if (idx < 0 || (size_t)idx >= ARRAY_SIZE(pair_arr) ||              \
> > +           pair_arr[idx].name == NULL) {                                  \
> > +               snprintf(par_str_buf__, sizeof(par_str_buf__), "%i", idx); \
> > +               return par_str_buf__;                                      \
> > +       }                                                                  \
> > +       return pair_arr[idx].name;                                         \
> >  } while (0)
> 
> For this library change:
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> This makes sense. Could you please for speedup merge this library change,
> so that Wei can base v6 on it?

Pushed, thanks for the review.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list