Re: [PATCH -next] lib: TEST_REF_TRACKER should depend on REF_TRACKER instead of selecting it

From: Geert Uytterhoeven
Date: Wed Dec 15 2021 - 05:10:58 EST


Hi Eric,

On Wed, Dec 15, 2021 at 10:51 AM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
> On Wed, Dec 15, 2021 at 1:36 AM Geert Uytterhoeven
> <geert+renesas@xxxxxxxxx> wrote:
> > TEST_REF_TRACKER selects REF_TRACKER, thus enabling an optional feature
> > the user may not want to have enabled. Fix this by making the test
> > depend on REF_TRACKER instead.
>
> I do not understand this.

The issue is that merely enabling tests should not enable optional
features, to prevent unwanted features sneaking into a product.
If tests depend on features, all tests for features that are enabled can
still be enabled (e.g. made modular, so they can be loaded when needed).

> How can I test this infra alone, without any ref_tracker being selected ?
>
> I have in my configs
>
> CONFIG_TEST_REF_TRACKER=m
> # CONFIG_NET_DEV_REFCNT_TRACKER is not set
> # CONFIG_NET_NS_REFCNT_TRACKER is not set
>
> This should work.

So you want to test the reference tracker, without having any actual
users of the reference tracker enabled?

Perhaps REF_TRACKER should become visible, cfr. CRC32 and
the related CRC32_SELFTEST?

> I would not have sent patches built around ref_tracker if I had no
> ways of testing the base infrastructure.

> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -2114,8 +2114,7 @@ config BACKTRACE_SELF_TEST
> >
> > config TEST_REF_TRACKER
> > tristate "Self test for reference tracker"
> > - depends on DEBUG_KERNEL && STACKTRACE_SUPPORT
> > - select REF_TRACKER
> > + depends on DEBUG_KERNEL && STACKTRACE_SUPPORT && REF_TRACKER
> > help
> > This option provides a kernel module performing tests
> > using reference tracker infrastructure.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds