Re: [PATCH testsuite] Makefile: unload policy when testsuite fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 19, 2021 at 5:10 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> On Tue, Jan 19, 2021 at 8:24 AM Ondrej Mosnacek <omosnace@xxxxxxxxxx> wrote:
> >
> > Make sure that the test policy is properly unloaded when `make test`
> > fails, to prevent it from accidentally lingering on the system after a
> > failed test.
> >
> > Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
> > ---
> >  Makefile | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 9081406..8efe15c 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -5,7 +5,11 @@ all:
> >
> >  test:
> >         make -C policy load
> > -       make -C tests test
> > +       make -C tests test || { \
> > +               res=$$?; \
> > +               make -C policy unload; \
> > +               exit $$res; \
> > +       }
> >         make -C policy unload
>
> Why not just do '-make -C tests test' instead?

Then the exit code would be 0 regardless of whether the tests passed or failed.

-- 
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux