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

Jan Stancek
2017-02-09T13:24:10Z

----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Thursday, 9 February, 2017 1:02:45 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?

diff --git a/lib/tst_test.c b/lib/tst_test.c
index e78b412cbd9b..52f85c7af891 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -146,10 +146,8 @@ void tst_reinit(void)

static void update_results(const char *file, unsigned int lineno, int ttype)
{
- if (!results) {
- tst_brk(TBROK,
- "%s: %d: Results IPC not initialized!", file, lineno);
- }
+ if (!results)
+ return;

switch (ttype) {
case TCONF:

There's no way "results" can be NULL when in test:
main
tst_run_tcases
do_setup
setup_ipc
SAFE_MMAP

> 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.

Regards,
Jan