[LTP] [PATCH v2 3/4] shell: add kconfig parse api

Petr Vorel pvorel@suse.cz
Fri Jan 7 08:33:26 CET 2022


> Hi all,

> On Thu, Jan 6, 2022 at 7:17 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> > > +| 'TST_NEEDS_KCONFIGS'     | Checks kernel kconfigs support for the test (see below).

> > > +| 'TST_NEEDS_KCONFIGS_IFS' | Used for splitting '$TST_NEEDS_KCONFIGS' variable,
> > > +                             default value is comma.


> > > +     for kconfig_i in $(seq $kconfig_max); do
> > > +             eval "local kconfig$kconfig_i"
> > > +             eval "kconfig$kconfig_i='$(echo "$kconfigs" | cut -d"$TST_NEEDS_KCONFIGS_IFS" -f$kconfig_i)'"
> > > +     done

> > This part is a bit ugly, I guess that it may as well be easier to
> > process in C. A long as we pass it as:

> > tst_check_kconfigs "$TST_NEEDS_KCONFIGS_IFS" "$TST_NEEDS_KCONFIGS"

> > We can easily split the TST_NEEDS_KCONFIGS with strchr() and single
> > loop.

> +1

> I even don't think we need that 'TST_NEEDS_KCONFIGS_IFS'
> variable for users. More flexible means more complicated to some
> degree, if achieve a C process,  we can handle that by accepting
> whatever the delimiter.
I suppose any string can be part of kconfig, thus it'd be safer to be able to
redefine delimiter. But yes, TST_NEEDS_KCONFIGS_IFS should be for using in tests
(thus TST_ prefix).

Kind regards,
Petr

> But strictly usage with a comma is enough for current kernel configs
> parsing I guess.


More information about the ltp mailing list