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

Petr Vorel pvorel@suse.cz
Mon Mar 23 14:29:35 CET 2026


> Hi!
> > > > 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"?

> Same as the test results the enum would have to be stored in shared
> memory and updated with atomic operations.

Thanks for a hint, I should have figure this myself.

Anyway shell loader uses C API helper tst_res_.c anyway, shared memory is
directly available. But for the iterations (recently discussed) tst_run.sh will
need to have a simple C API helper to get required info.

Kind regards,
Petr


More information about the ltp mailing list