Re: [LTP] [PATCH] lib: add TST_NO_SLOW_KCONFIG_CHECK macro for testcase tools

Li Wang
2025-01-17T08:20:58Z

On Fri, Jan 17, 2025 at 4:15 PM Petr Vorel <pvorel@suse.cz> wrote:

> > On Fri, Jan 17, 2025 at 4:05 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> > > Hi Li,
>
> > > > Hi Li,
>
> > > > > The macro TST_NO_SLOW_KCONFIG_CHECK is added to control whether
> > > > > the tst_has_slow_kconfig() function (which presumably checks for
> > > > > slow kernel configurations) should be executed.
>
> > > > That was quick, thanks a lot!
>
> > > > But unfortunately the patch does not help to avoid printing TINFO
> > > > (tested on a fresh clone):
>
> > > > # make && ./tst_ns_exec 14536 net,mnt sh -c " cat
> > > /proc/sys/net/ipv6/conf/ltp_ns_veth1/disable_ipv6"
> > > > CC testcases/lib/tst_ns_exec
> > > > make[1]: Nothing to be done for 'all'.
> > > > tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
> > > > tst_kconfig.c:667: TINFO: CONFIG_LATENCYTOP kernel option detected
> which
> > > might slow the execution
> > > > 0
>
> > > > Maybe it's because safe_clone() triggers it? Or what am I missing?
>
> > > The problem why it does not work is that it uses lib/tst_test.o via
> > > lib/libltp.a, which was compiled without TST_NO_SLOW_KCONFIG_CHECK.
>
>
> > Really? How does that TST_NO_DEFAULT_MAIN work?
> > Reading the code...
>
> I guess the code which evaluates TST_NO_DEFAULT_MAIN must be in static
> inline
> function in tst_test.h header. Then it will work.
>

Seems not, the TST_NO_DEFAULT_MAIN is defined in tst_test.c directly,
so base on that, all the TST_NO_* macros in testcase/lib/* is redundant.

That mislead us the correct way.

>
> Kind regards,
> Petr
>
> > > IMHO We cannot easily solve this with preprocessor definition.
>
> > > Kind regards,
> > > Petr
>
> > > > Kind regards,
> > > > Petr
>
> > > > > This allows test cases and tools to opt out of this additional
> > > > > check, enabling more flexible and faster test execution in
> > > > > certain scenarios.
>
>

--
Regards,
Li Wang