[LTP] [PATCH] [RFC] zram01: Fix on ppc64le

Jan Stancek
2017-02-09T14:48:08Z

----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Thursday, 9 February, 2017 3:00:42 PM
> Subject: Re: [LTP] [PATCH] [RFC] zram01: Fix on ppc64le
>
> Hi!
> > > > There is still one unsolved problem since the TWARN messages from the
> > > > tst_device.c will trigger TBROK in tst_test.c since the IPC is not
> > > > initialized. I'm still unsure how to fix that, maybe we should allow to
> > > > allocate non-shared structure for the results in the special case that
> > > > the library code is being reused in shell helpers.
> > >
> > > Maybe we should just add an API to redirect tst_brk() and tst_res() so
> > > that we could use library code in the various non-test utilities.
> >
> > Or drop that TBROK?
>
> It's especially there for code that defines TST_NO_DEFAULT_MAIN but one
> can argue that this is special case and if you define that macro you
> should know what you are doing anyway...
>
> But still I prefer to throw error message instead of segfaulting while
> trying to deference NULL pointer.

I was suggesting we skip update_results(), not to let it segfault.

>
> > > Maybe
> > > we could patch things up so that we could use SAFE_MACROS() in cleanup
> > > as well...
> >
> > This should be doable with some flag we set in do_test_cleanup(), to skip
> > further calls.
>
> I'm nearly finished with RFC patch. The main problem is the
> __attribute__((noreturn)) that has been added for various tst_brk*
> variants. So in the end it looks like only solution is to do the
> tst_brk_() redirection in the safe_macros.c, since we cannot return from
> tst_brkm_() since the return address is not stored on stack because it
> has noreturn attribute. And dropping the noreturn attribute from
> tst_brkm_() is not an option either, since that generates a ton of
> "control reaches end of non-void function" warnings.

Vast majority is from single header file:

$ grep "reaches end of non-void" log.txt | sort | uniq | wc -l
328

$ grep "reaches end of non-void" log.txt | sort | uniq | grep compat_16.h | wc -l
289

>
> But it's quite easy to define a macro or two that does the same
> redirection as we do in tst_brkm_() so that we never reach the oldlib
> code from safe_macros.c if newlib test is running.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>