Re: [LTP] [PATCH 1/1] ns_ifmove.c: Rewrite to new API

Petr Vorel
2023-03-15T10:35:36Z

Hi Wei,

> > > should we use tst_res(TINFO) instead of printf?

> > NO. If you look into testcases/lib/, none of *.c tools use tst_res().
> > The only separation between API for tests and API for tools / library
> > than TST_NO_DEFAULT_MAIN.
> Got it, this is lib API. Why ns_ifmove.c's parent directory name is
> "share" instead of "lib" or at least contain "lib" key word?

The move is in another patchset:
https://lore.kernel.org/ltp/20230310124125.14279-1-pvorel@suse.cz/

> > Actually, unless SAFE_*() are useful to use (here SAFE_SOCKET() and
> > SAFE_IOCTL()), we prefer to not use tst_test.h at all (see tst_cgctl.c,
> > tst_device.c, ...)

> > I also think that tst_get_free_pids.c does not need TST_NO_DEFAULT_MAIN and
> > tst_test workarounds.
> Is there possible split current tst_test.h to two files and remove
> TST_NO_DEFAULT_MAIN workaround? Such as tst_tools.h(include SAFE*) for lib api
> and main.h for testcase.

IMHO that would not be trivial, i.e. not worth of the effort.