[LTP] [PATCH] lib/tst_test.c: Fix tst_brk() handling
Petr Vorel
pvorel@suse.cz
Fri Apr 4 15:18:29 CEST 2025
Hi Cyril,
> Hi!
> > 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)
> Ah, that's because if we call tst_brk() before we finished
> initialization results is not defined. We need at least:
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index c6395a5eb..6b1100b09 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -407,7 +407,8 @@ void tst_vbrk_(const char *file, const int lineno, int ttype, const char *fmt,
> * current process.
> */
> if (TTYPE_RESULT(ttype) == TBROK) {
> - tst_atomic_inc(&results->abort_flag);
> + if (results)
> + tst_atomic_inc(&results->abort_flag);
> /*
> * If TBROK was called from one of the child processes we kill
> > I also wonder if tst_brk() related doc should be updated.
> I did update the documentation comment in the tst_test.h.
I'm sorry to overlook this. The description LGTM.
+ * runs for all filesystems and tst_brk() with TBROK is called, the test exits
+ * and does not attempt to continue a test iteration for the next filesystem.
I guess this part of the doc update is also applicable for the current master,
right? Quite important note, indeed TCONF does not quit testing on
all_filesystems. Probably not worth to have it as a separate commit (hopefully
this change will not get reverted).
> > 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).
> I will have a look.
Thanks!
> > very nit: please before merge fix typos in both code and commit message:
> > exitting => exiting
> > countes|countes => counters
> > immediatelly => immediately
> > filtesystem => filesyste
> Uff, will do.
Thanks. (I have spell checker on patches, thus I see it red.)
> > 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).
> Rewriting the tests is a more complex task that should be done in a
> separate patchset.
Sure, this was more sharing my idea (I planned to write "as a separate effort",
I see I forget).
Kind regards,
Petr
More information about the ltp
mailing list