[LTP] [PATCH v2] lib/tst_test.c: Fix tst_brk() handling

Jan Stancek jstancek@redhat.com
Tue Apr 8 12:07:08 CEST 2025


On Fri, Apr 4, 2025 at 4:34 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> This makes the tst_brk() handling cleaner and saner as instead of
> propagating the tst_brk() result in a return value an abort flag is
> introduced into the shared memory.
>
> Now:
>
> - All the processes but the library one that reports the results exit
>   with 0
>
> - tst_brk(TBROK, ...) increments result conters, sets the abort flag,
>   exit current process and makes sure all process group processes are
>   terminated
>
> - all other tst_brk() variants will just increments the counters and
>   exits the current process (which is current iteration for
>   .all_filesysstems, .test_variants, etc.)
>
> This makes the tst_brk() behavior well defined so we can now even call
> tst_brk() with TFAIL and TPASS as well. And since TBROK is supposed to
> exit the test immediately (i.e.  unrecoverable error) we are now
> properly doing so.
>
> The case that main test pid called TBROK was working correctly before
> this patch, since send the SIGKILL signal to the process group after we
> waited for the main test pid. All that was missing is a code that sends
> a signal to the main test pid in the case that TBROK was triggered by
> one of it's children and now we properly kill all test processes in that
> case as well.
>
> There is also special case where we call tst_brk() before the test
> library has been initialized (mostly done by the C shell helpers) in
> that case we have to exit with a proper return value, which is normally
> done by the test library process.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>

Acked-by: Jan Stancek <jstancek@redhat.com>



More information about the ltp mailing list