public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Li Wang <liwang@redhat.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] lib: add TST_NO_SLOW_KCONFIG_CHECK macro for testcase tools
Date: Fri, 17 Jan 2025 08:48:23 +0100	[thread overview]
Message-ID: <95cf0806-4600-4949-8ed7-a31cacf2c8a5@suse.com> (raw)
In-Reply-To: <20250117071758.120366-1-liwang@redhat.com>

Hi Li,

the feature is interesting, but I have the feeling this should be added 
to tst_test struct rather than using a flag at compile time.
For example, by adding to tst_test a slow_kconfig attribute.

Andrea

On 1/17/25 08:17, Li Wang wrote:
> The macro TST_NO_SLOW_KCONFIG_CHECK is added to control whether
> the tst_has_slow_kconfig() function (which presumably checks for
> slow kernel configurations) should be executed.
>
> This allows test cases and tools to opt out of this additional
> check, enabling more flexible and faster test execution in
> certain scenarios.
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>   lib/tst_test.c                    | 2 ++
>   testcases/lib/tst_device.c        | 1 +
>   testcases/lib/tst_get_free_pids.c | 1 +
>   testcases/lib/tst_ns_create.c     | 1 +
>   testcases/lib/tst_ns_exec.c       | 1 +
>   testcases/lib/tst_run_shell.c     | 1 +
>   6 files changed, 7 insertions(+)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index b204ad975..00d34b6f0 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1702,8 +1702,10 @@ unsigned int tst_multiply_timeout(unsigned int timeout)
>   	if (timeout < 1)
>   		tst_brk(TBROK, "timeout must to be >= 1! (%d)", timeout);
>   
> +#ifndef TST_NO_SLOW_KCONFIG_CHECK
>   	if (tst_has_slow_kconfig())
>   		timeout *= 4;
> +#endif
>   
>   	return timeout * timeout_mul;
>   }
> diff --git a/testcases/lib/tst_device.c b/testcases/lib/tst_device.c
> index 45f77a38b..386636610 100644
> --- a/testcases/lib/tst_device.c
> +++ b/testcases/lib/tst_device.c
> @@ -8,6 +8,7 @@
>   #include <stdio.h>
>   #include <stdlib.h>
>   #define TST_NO_DEFAULT_MAIN
> +#define TST_NO_SLOW_KCONFIG_CHECK
>   #include "tst_test.h"
>   #include "old/old_device.h"
>   
> diff --git a/testcases/lib/tst_get_free_pids.c b/testcases/lib/tst_get_free_pids.c
> index 370ec3e26..c6436687a 100644
> --- a/testcases/lib/tst_get_free_pids.c
> +++ b/testcases/lib/tst_get_free_pids.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0-or-later
>   
>   #define TST_NO_DEFAULT_MAIN
> +#define TST_NO_SLOW_KCONFIG_CHECK
>   #include <stdio.h>
>   #include "tst_test.h"
>   
> diff --git a/testcases/lib/tst_ns_create.c b/testcases/lib/tst_ns_create.c
> index ce3707a60..8c22ad449 100644
> --- a/testcases/lib/tst_ns_create.c
> +++ b/testcases/lib/tst_ns_create.c
> @@ -17,6 +17,7 @@
>    */
>   
>   #define TST_NO_DEFAULT_MAIN
> +#define TST_NO_SLOW_KCONFIG_CHECK
>   
>   #include <stdio.h>
>   #include <string.h>
> diff --git a/testcases/lib/tst_ns_exec.c b/testcases/lib/tst_ns_exec.c
> index 6a8e39339..ca5b717da 100644
> --- a/testcases/lib/tst_ns_exec.c
> +++ b/testcases/lib/tst_ns_exec.c
> @@ -14,6 +14,7 @@
>    */
>   
>   #define TST_NO_DEFAULT_MAIN
> +#define TST_NO_SLOW_KCONFIG_CHECK
>   
>   #include <stdio.h>
>   #include <sys/wait.h>
> diff --git a/testcases/lib/tst_run_shell.c b/testcases/lib/tst_run_shell.c
> index 7a446e004..b12a1e9f6 100644
> --- a/testcases/lib/tst_run_shell.c
> +++ b/testcases/lib/tst_run_shell.c
> @@ -5,6 +5,7 @@
>   #include <sys/mount.h>
>   
>   #define TST_NO_DEFAULT_MAIN
> +#define TST_NO_SLOW_KCONFIG_CHECK
>   #include "tst_test.h"
>   #include "tst_safe_stdio.h"
>   #include "ujson.h"

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

  parent reply	other threads:[~2025-01-17  7:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17  7:17 [LTP] [PATCH] lib: add TST_NO_SLOW_KCONFIG_CHECK macro for testcase tools Li Wang
2025-01-17  7:36 ` Petr Vorel
2025-01-17  8:04   ` Petr Vorel
2025-01-17  8:13     ` Li Wang
2025-01-17  8:15       ` Petr Vorel
2025-01-17  8:20         ` Li Wang
2025-01-17  7:48 ` Andrea Cervesato via ltp [this message]
2025-01-17  8:27   ` Li Wang
2025-01-17  8:43     ` Petr Vorel

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=95cf0806-4600-4949-8ed7-a31cacf2c8a5@suse.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=liwang@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox