All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim.Bird@sony.com <Tim.Bird@sony.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] lib: Add library function for parsing kernel config
Date: Thu, 15 Nov 2018 20:43:57 +0000	[thread overview]
Message-ID: <ECADFF3FD767C149AD96A924E7EA6EAF88A40FCE@USCULXMSG01.am.sony.com> (raw)
In-Reply-To: <20181115134441.27359-1-chrubis@suse.cz>

> -----Original Message-----
> From: Cyril Hrubis on  Thursday, November 15, 2018 5:45 AM
> 
...

> The required kernel options are passed as an array of strings via the
> .needs_kconfigs pointer in the tst_test structure. The purpose of this
> is twofold, one is that the test can disable itself at runtime if given
> functionality is missing from kernel .config and second is about being
> able to propagate this information to the testrunner (this could be done
> once we figure out how export the information from the structure to the
> test runner) then we can avoid running tests on unsuitable
> configurations from the start.
> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> CC: Pengfei Xu <pengfei.xu@intel.com>
> CC: automated-testing@yoctoproject.org
> ---
>  doc/test-writing-guidelines.txt |  32 +++++++
>  include/tst_kconfig.h           |  34 ++++++++
>  include/tst_test.h              |   6 ++
>  lib/newlib_tests/.gitignore     |   1 +
>  lib/newlib_tests/tst_kconfig.c  |  24 ++++++
>  lib/tst_kconfig.c               | 183
> ++++++++++++++++++++++++++++++++++++++++
>  lib/tst_test.c                  |   4 +
>  7 files changed, 284 insertions(+)
>  create mode 100644 include/tst_kconfig.h
>  create mode 100644 lib/newlib_tests/tst_kconfig.c
>  create mode 100644 lib/tst_kconfig.c
> 
> diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
> index d0b91c362..846c39532 100644
> --- a/doc/test-writing-guidelines.txt
> +++ b/doc/test-writing-guidelines.txt
> @@ -1504,6 +1504,38 @@ static struct tst_test test = {
>  	.save_restore = save_restore,
>  };
> 
> +2.2.28 Parsing kernel .config
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Generally testcases should attempt to autodetect as much kernel features
> as
> +possible based on the currently running kernel. We do have
> tst_check_driver()
> +to check if functionality that could be compiled as kernel module is present
> +on the system, disabled syscalls can be detected by checking for 'ENOSYS'
> +errno etc.
> +
> +However in rare cases core kernel features couldn't be detected based on
> the
> +kernel userspace API and we have to resort on kernel .config parsing.
> +
> +For this cases the test should set the 'NULL' terminated needs_kconfig array
> +of kernel config options required for the test. The test will exit with
> +'TCONF' if any of the required options wasn't set to 'y' or 'm'.

This is good.  Just a comment on the proposed syntax and options.
Fuego uses NEED_KCONFIG (upper-case because it's a shell global variable),
and 0-day uses need_kconfig.

There are a few slight differences in syntax between different systems.
(I'm making no judgements, just noting the differences).

Fuego and 0day also support a string including the option value, such
as:
 CONFIG_PRINTK=y
 CONFIG_LOCKDEP_SUPPORT=n
 CONFIG_CAN=m

See https://elinux.org/Test_Dependencies

where I've started collecting some of these different syntaxes.
 -- Tim



  parent reply	other threads:[~2018-11-15 20:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15 13:44 [LTP] [PATCH] lib: Add library function for parsing kernel config Cyril Hrubis
2018-11-15 18:57 ` Cristian Marussi
2018-11-16 13:53   ` Cyril Hrubis
2018-11-15 20:16 ` Tim.Bird
2018-11-16 13:59   ` Cyril Hrubis
2018-11-21 19:53     ` Tim.Bird
2018-11-15 20:43 ` Tim.Bird [this message]
2018-11-16 13:57   ` Cyril Hrubis
2018-11-16  3:54 ` Pengfei Xu
2018-11-16  4:03   ` Tim.Bird
2018-11-16  4:57     ` Pengfei Xu
2018-11-16 14:00   ` Cyril Hrubis
2018-11-17  5:41     ` Pengfei Xu
2018-11-23  4:56 ` Sandeep Patil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ECADFF3FD767C149AD96A924E7EA6EAF88A40FCE@USCULXMSG01.am.sony.com \
    --to=tim.bird@sony.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.