[igt-dev] [PATCH i-g-t 1/9] lib/tests: Drop NIH exit status handling

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 13 10:51:56 UTC 2019


Quoting Chris Wilson (2019-02-13 10:49:42)
> Quoting Daniel Vetter (2019-02-13 10:35:43)
> > Spotted by Chris.
> > 
> > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> > ---
> >  lib/tests/igt_assert.c     |  9 +++------
> >  lib/tests/igt_segfault.c   |  8 ++++----
> >  lib/tests/igt_simulation.c | 39 +++++++++++++++++++++++---------------
> >  3 files changed, 31 insertions(+), 25 deletions(-)
> > 
> > diff --git a/lib/tests/igt_assert.c b/lib/tests/igt_assert.c
> > index 306b1fb8533c..0082fda14851 100644
> > --- a/lib/tests/igt_assert.c
> > +++ b/lib/tests/igt_assert.c
> > @@ -79,10 +79,7 @@ static int do_fork(void)
> >                        errno == EINTR)
> >                         ;
> >  
> > -               if(WIFSIGNALED(status))
> > -                       return WTERMSIG(status) + 128;
> > -
> > -               return WEXITSTATUS(status);
> > +               return status;
> >         }
> >  }
> >  
> > @@ -161,7 +158,7 @@ igt_main
> >         test_to_run = test_cmpint_negative;
> >         ret = do_fork();
> >         igt_subtest("igt_cmpint_negative")
> > -               internal_assert(ret == IGT_EXIT_FAILURE);
> > +               internal_assert(WEXITSTATUS(ret) == IGT_EXIT_FAILURE);
> 
> I don't think we can get away with plain WEXITSTATUS/WTERMSIG as they
> are simple shifts and masks.
> 
> I think we need
> 
> bool wexited(int status, int exitcode)
> {
>         return WIFEXITED(status) && WEXITSTATUS(status) == exitcode;
> }
> 
> bool wsignaled(int status, int sig)
> {
>         return WIFSIGNALED(status) && WTERMSIG(status) == sig;
> }

I think it's worthwhile to follow through on that change, but the series
looks good
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list