All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <ltp@lists.linux.it>
Subject: [LTP] [PATCH v4 2/5] lib: Introduce KCONFIG_SKIP_CHECK environment variable
Date: Tue, 11 Jan 2022 14:10:32 +0800	[thread overview]
Message-ID: <1641881435-2351-2-git-send-email-xuyang2018.jy@fujitsu.com> (raw)
In-Reply-To: <1641881435-2351-1-git-send-email-xuyang2018.jy@fujitsu.com>

This environment variable is designed to add kernel config check functionality
switch. So we can skip kconfig check completely and it is useful especially
for the embedded platforms that they don't have kernel config.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 doc/user-guide.txt |  1 +
 lib/tst_kconfig.c  | 20 ++++++++++++++++++++
 lib/tst_test.c     |  1 +
 3 files changed, 22 insertions(+)

diff --git a/doc/user-guide.txt b/doc/user-guide.txt
index 494652618..6b80bb699 100644
--- a/doc/user-guide.txt
+++ b/doc/user-guide.txt
@@ -10,6 +10,7 @@ For running LTP network tests see `testcases/network/README.md`.
 |==============================================================================
 | 'KCONFIG_PATH'        | The path to the kernel config file, (if not set, it tries
                           the usual paths '/boot/config-RELEASE' or '/proc/config.gz').
+| 'KCONFIG_SKIP_CHECK'  | Skip kernel config check, the default is empty (don't skip).
 | 'LTPROOT'             | Prefix for installed LTP, the default is '/opt/ltp'.
 | 'LTP_COLORIZE_OUTPUT' | Force colorized output behaviour. 'y' or '1': always colorize
                           'n' or '0': never colorize.
diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index 7d7aecfc1..d0c9b24c2 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -15,6 +15,16 @@
 #include "tst_kconfig.h"
 #include "tst_bool_expr.h"
 
+static int kconfig_skip_check(void)
+{
+	char *skipped = getenv("KCONFIG_SKIP_CHECK");
+
+	if (skipped)
+		return 1;
+
+	return 0;
+}
+
 static const char *kconfig_path(char *path_buf, size_t path_buf_len)
 {
 	const char *path = getenv("KCONFIG_PATH");
@@ -485,6 +495,11 @@ int tst_kconfig_check(const char *const kconfigs[])
 	unsigned int i, var_cnt;
 	int ret = 0;
 
+	if (kconfig_skip_check()) {
+		tst_res(TINFO, "Skipping kernel config check as requested");
+		return 0;
+	}
+
 	for (i = 0; i < expr_cnt; i++) {
 		exprs[i] = tst_bool_expr_parse(kconfigs[i]);
 
@@ -526,6 +541,11 @@ char tst_kconfig_get(const char *confname)
 {
 	struct tst_kconfig_var var;
 
+	if (kconfig_skip_check()) {
+		tst_res(TINFO, "Skipping kernel config check as requested");
+		return 0;
+	}
+
 	var.id_len = strlen(confname);
 
 	if (var.id_len >= sizeof(var.id))
diff --git a/lib/tst_test.c b/lib/tst_test.c
index d5cefadaa..db19d0d68 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -479,6 +479,7 @@ static void print_help(void)
 	fprintf(stderr, "Environment Variables\n");
 	fprintf(stderr, "---------------------\n");
 	fprintf(stderr, "KCONFIG_PATH         Specify kernel config file\n");
+	fprintf(stderr, "KCONFIG_SKIP_CHECK   Skip kernel config check (the default is empty means don't skip)\n");
 	fprintf(stderr, "LTPROOT              Prefix for installed LTP (default: /opt/ltp)\n");
 	fprintf(stderr, "LTP_COLORIZE_OUTPUT  Force colorized output behaviour (y/1 always, n/0: never)\n");
 	fprintf(stderr, "LTP_DEV              Path to the block device to be used (for .needs_device)\n");
-- 
2.23.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-01-11  6:11 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  6:57 [LTP] [PATCH v1 1/3] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Yang Xu
2022-01-04  6:57 ` [LTP] [PATCH v1 2/3] shell: add kconfig parse api Yang Xu
2022-01-04 11:04   ` Petr Vorel
2022-01-05  7:15     ` xuyang2018.jy
2022-01-05 14:34       ` Petr Vorel
2022-01-06  5:59         ` xuyang2018.jy
2022-01-06  8:16           ` xuyang2018.jy
2022-01-06  9:25         ` [LTP] [PATCH v2 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Yang Xu
2022-01-06  9:25           ` [LTP] [PATCH v2 2/4] lib: Introduce LTP_KCONFIG_DISABLE environment variables Yang Xu
2022-01-06  9:49             ` Petr Vorel
2022-01-06  9:52             ` Petr Vorel
2022-01-06 11:07             ` Cyril Hrubis
2022-01-06 11:50               ` Petr Vorel
2022-01-06 13:59                 ` Cyril Hrubis
2022-01-06 17:41                   ` Petr Vorel
2022-01-07  2:00                   ` xuyang2018.jy
2022-01-06  9:25           ` [LTP] [PATCH v2 3/4] shell: add kconfig parse api Yang Xu
2022-01-06 10:40             ` Petr Vorel
2022-01-06 11:19             ` Cyril Hrubis
2022-01-07  3:54               ` Li Wang
2022-01-07  4:08                 ` xuyang2018.jy
2022-01-07  7:04                   ` Li Wang
2022-01-07  8:28                     ` xuyang2018.jy
2022-01-07  8:41                       ` Li Wang
2022-01-07  9:46                         ` Cyril Hrubis
2022-01-07  9:56                           ` xuyang2018.jy
2022-01-07  9:05                       ` Petr Vorel
2022-01-07  9:22                         ` xuyang2018.jy
2022-01-07 12:07                           ` Petr Vorel
2022-01-07  7:33                 ` Petr Vorel
2022-01-06  9:25           ` [LTP] [PATCH v2 4/4] sysctl/sysctl02.sh: Use kconfig shell api Yang Xu
2022-01-06 11:20             ` Cyril Hrubis
2022-01-10  1:49               ` [LTP] [PATCH v3 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Yang Xu
2022-01-10  1:49                 ` [LTP] [PATCH v3 2/4] lib: Introduce KCONFIG_SKIP_CHECK environment variable Yang Xu
2022-01-10  8:14                   ` Li Wang
2022-01-10 12:20                   ` Cyril Hrubis
2022-01-11  1:38                     ` xuyang2018.jy
2022-01-10  1:49                 ` [LTP] [PATCH v3 3/4] shell: add kconfig parse api Yang Xu
2022-01-10  8:26                   ` Li Wang
2022-01-10  8:46                     ` xuyang2018.jy
2022-01-10  9:13                       ` Li Wang
2022-01-10 13:43                   ` Cyril Hrubis
2022-01-11  5:29                     ` xuyang2018.jy
2022-01-11  6:10                     ` [LTP] [PATCH v4 1/5] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Yang Xu
2022-01-11  6:10                       ` Yang Xu [this message]
2022-01-13 11:09                         ` [LTP] [PATCH v4 2/5] lib: Introduce KCONFIG_SKIP_CHECK environment variable Petr Vorel
2022-01-14  5:36                           ` xuyang2018.jy
2022-01-11  6:10                       ` [LTP] [PATCH v4 3/5] shell: add kconfig parse api Yang Xu
2022-01-11  7:52                         ` Li Wang
2022-01-11  8:37                           ` xuyang2018.jy
2022-01-13  9:15                             ` xuyang2018.jy
2022-01-13  9:42                               ` Li Wang
2022-01-13 15:51                             ` Cyril Hrubis
2022-01-14  6:26                               ` xuyang2018.jy
2022-01-14  9:19                                 ` xuyang2018.jy
2022-01-14  9:49                                   ` Petr Vorel
2022-01-11  6:10                       ` [LTP] [PATCH v4 4/5] sysctl/sysctl02.sh: Use kconfig shell api Yang Xu
2022-01-13 10:53                         ` Petr Vorel
2022-01-13 16:06                           ` Petr Vorel
2022-01-13 15:54                         ` Cyril Hrubis
2022-01-11  6:10                       ` [LTP] [PATCH v4 5/5] runtest.sh: add test_kconfig.sh into ltp c test target Yang Xu
2022-01-13 11:25                         ` Petr Vorel
2022-01-13 15:54                         ` Cyril Hrubis
2022-01-10  1:49                 ` [LTP] [PATCH v3 4/4] sysctl/sysctl02.sh: Use kconfig shell api Yang Xu
2022-01-10  8:30                   ` Li Wang
2022-01-10 14:15                   ` Cyril Hrubis
2022-01-11  5:34                     ` xuyang2018.jy
2022-01-10  8:10                 ` [LTP] [PATCH v3 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Li Wang
2022-01-10 12:18                 ` Cyril Hrubis
2022-01-10  5:45               ` [LTP] [PATCH v2 4/4] sysctl/sysctl02.sh: Use kconfig shell api xuyang2018.jy
2022-01-06  9:54           ` [LTP] [PATCH v2 1/4] lib/tst_kconfig: Modify the return type of tst_kconfig_check function Petr Vorel
2022-01-06 10:57           ` Cyril Hrubis
2022-01-07  1:25             ` xuyang2018.jy
2022-01-04  6:57 ` [LTP] [PATCH v1 3/3] sysctl/sysctl02.sh: Use kconfig shell api Yang Xu

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=1641881435-2351-2-git-send-email-xuyang2018.jy@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.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.