[LTP] [RFC PATCH 1/1] lib: Print tcnt in tst_{brk,res}()

Petr Vorel pvorel@suse.cz
Fri Mar 20 15:18:59 CET 2026


> Hi!
> > > tst_test.c:1887: [lib] TINFO: Overall timeout per run is 0h 00m 30s
> > > test04.c:26: [setup] TINFO: setup() executed by pid 147535
> > > test04.c:16: [test 1] TPASS: PASSED message
> > > test04.c:19: [test 2] TBROK: BROKEN message
> > > tst_test.c:479: [lib] TINFO: Child process reported TBROK killing the test
> > > tst_test.c:1950: [lib]  TINFO: Killed the leftover descendant processes

> > This looks good to me. Maybe we can also color the setup/lib/test
> > differently if the output goes into the terminal.


> And in order to make it work in the shell as well we would need a
> function tst_set_context() that would set the current context so that we
> can call it from shell. I suppose that this needs to be designed
> carefuly in order to make ti work properly with threads/forked
> processes.

How about having enum with few states (lib, setup, test, cleanup), which would
be switched when context switches (and test_get_state() would just print the
string). And test would get the number (idea from this patch).

I'm still missing how to call C API code from shell test, because C API code
forks child and execute the script, how it could "talk back"?
The question I have asked in du01.sh rewrite:
https://lore.kernel.org/ltp/20260318154019.GE31214@pevik/

Kind regards,
Petr


More information about the ltp mailing list