[LTP] [PATCH] lib/tst_test.c: Fix tst_brk() handling
Petr Vorel
pvorel@suse.cz
Thu Apr 3 14:36:10 CEST 2025
Hi all,
[ Cc Jan and Li s there can be some hidden problems. ]
> 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.
> and exit current process
> - all other tst_brk() variants will just increments the countes and
> exits the current process
> This makes the tst_brk() behavior well defined so we can now even call
> tst_brk() with TFAIL and TPASS as well.
+1. As a separate effort we can replace with coccinelle
tst_res(TFAIL or TPASS) followed by return by tst_brk(TFAIL or TPASS).
> And since TBROK is supposed to exit the test immediatelly (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 he 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.
+1
Also thanks for doing tests.
Generally LGTM.
One thing I'm worried is the fact that some shell loader tests core dumped in CI:
https://github.com/pevik/ltp/actions/runs/14242818586/job/39916477770
e.g. these which are supposed to TBROK due broken metadata:
shell_loader_invalid_block.sh, shell_loader_no_metadata.sh,
shell_loader_wrong_metadata.sh:
Segmentation fault (core dumped)
I also wonder if tst_brk() related doc should be updated.
Isn't there anything which should be updated in doc/old/C-Test-API.asciidoc ?
This docs will stay with us for some time, the conversion to kerneldoc takes
time, it'd be good to keep it updated (valuable texts will be migrated to
kerneldoc).
Maybe parts:
1.8 Doing the test in the child process
1.9 Fork() and Parent-child synchronization
(both code examples and the description).
very nit: please before merge fix typos in both code and commit message:
exitting => exiting
countes|countes => counters
immediatelly => immediately
filtesystem => filesystem
NOTE: test_brk_pass could be added to lib/newlib_tests/runtest.sh. I would also
prefer, if we changed tests to behave like testcases/lib/run_tests.sh, i.e.
allow to run all tests and check exit code (intermediate step before we compare
the test output).
Kind regards,
Petr
More information about the ltp
mailing list