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

Li Wang liwang@redhat.com
Fri Jan 7 04:54:53 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.

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

-- 
Regards,
Li Wang



More information about the ltp mailing list