public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
@ 2025-02-24 10:00 Petr Vorel
  2025-02-24 10:00 ` [LTP] [PATCH 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 10:00 UTC (permalink / raw)
  To: ltp

Allow to test only single struct tst_test->test_variants.
This is a similar feature to $LTP_SINGLE_FS_TYPE.

Value is ignored when test does not specify test_variants.
When value is higher than test_variants value lastest variant is used.

	# LTP_SINGLE_VARIANT=0 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
	..
	tst_test.c:1918: TINFO: WARNING: testing only variant 0 of 3
	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
	tst_test.c:1834: TINFO: === Testing on ext4 ===
	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
	mke2fs 1.47.2 (1-Jan-2025)
	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getx2HrGH/mntpoint fstyp=ext4 flags=0
	getdents.h:148: TINFO: Testing the SYS_getdents syscall
	tst_buffers.c:57: TINFO: Test is using guarded buffers
	getdents02.c:77: TPASS: fd=-5 dirp=0x7f0587803ee9 size=279 : EBADF (9)
	getdents02.c:77: TPASS: fd=3 dirp=0x5641617a31e8 size=1 : EINVAL (22)
	getdents02.c:77: TPASS: fd=4 dirp=0x7f0587803ee9 size=279 : ENOTDIR (20)
	getdents02.c:77: TPASS: fd=5 dirp=0x7f0587803ee9 size=279 : ENOENT (2)
	getdents02.c:77: TPASS: fd=3 dirp=0x7f0587802000 size=279 : EFAULT (14)

	# LTP_SINGLE_VARIANT=2 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
	...
	tst_test.c:1918: TINFO: WARNING: testing only variant 2 of 3
	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
	tst_test.c:1834: TINFO: === Testing on ext4 ===
	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
	mke2fs 1.47.2 (1-Jan-2025)
	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getWtBnGE/mntpoint fstyp=ext4 flags=0
	getdents.h:157: TCONF: libc getdents() is not implemented

	# LTP_SINGLE_VARIANT=99 LTP_SINGLE_FS_TYPE=ext4 ./getdents02 # higher value is max value
	tst_test.c:1918: TINFO: WARNING: testing only variant 3 of 3
	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
	tst_test.c:1834: TINFO: === Testing on ext4 ===
	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
	mke2fs 1.47.2 (1-Jan-2025)
	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_get1fX70n/mntpoint fstyp=ext4 flags=0
	getdents.h:162: TINFO: Testing libc getdents64()
	tst_buffers.c:57: TINFO: Test is using guarded buffers
	getdents02.c:77: TPASS: fd=-5 dirp=0x7fcf140f3ee8 size=280 : EBADF (9)
	getdents02.c:77: TPASS: fd=3 dirp=0x55a76e4531e8 size=1 : EINVAL (22)
	getdents02.c:77: TPASS: fd=4 dirp=0x7fcf140f3ee8 size=280 : ENOTDIR (20)
	getdents02.c:77: TPASS: fd=5 dirp=0x7fcf140f3ee8 size=280 : ENOENT (2)
	getdents02.c:77: TPASS: fd=3 dirp=0x7fcf140f2000 size=280 : EFAULT (14)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi all,

Andrea wanted to run only single variant.

Kind regards,
Petr

 lib/tst_test.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 3823ea109e..6edc310209 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -581,6 +581,7 @@ static void print_help(void)
 	fprintf(stderr, "LTP_DEV              Path to the block device to be used (for .needs_device)\n");
 	fprintf(stderr, "LTP_DEV_FS_TYPE      Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE);
 	fprintf(stderr, "LTP_SINGLE_FS_TYPE   Testing only - specifies filesystem instead all supported (for .all_filesystems)\n");
+	fprintf(stderr, "LTP_SINGLE_VARIANT   Testing only - specifies tst_variant to be run\n");
 	fprintf(stderr, "LTP_TIMEOUT_MUL      Timeout multiplier (must be a number >=1)\n");
 	fprintf(stderr, "LTP_RUNTIME_MUL      Runtime multiplier (must be a number >=1)\n");
 	fprintf(stderr, "LTP_VIRT_OVERRIDE    Overrides virtual machine detection (values: \"\"|kvm|microsoft|xen|zvm)\n");
@@ -1887,6 +1888,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 	int ret = 0;
 	unsigned int test_variants = 1;
 	struct utsname uval;
+	const char *only_variant;
 
 	lib_pid = getpid();
 	tst_test = self;
@@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 
 	tst_res(TINFO, "LTP version: "LTP_VERSION);
 
-
 	uname(&uval);
 	tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);
 
@@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 
 	set_overall_timeout();
 
-	if (tst_test->test_variants)
+	if (tst_test->test_variants) {
 		test_variants = tst_test->test_variants;
+		only_variant = getenv("LTP_SINGLE_VARIANT");
+		if (only_variant && only_variant[0] != '\0') {
+			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
+							  test_variants - 1);
+			tst_res(TINFO, "WARNING: testing only variant %d of %d",
+					tst_variant, test_variants - 1);
+			test_variants = tst_variant + 1;
+		}
+	}
+
+	for (; tst_variant < test_variants; tst_variant++) {
 
-	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
 		if (tst_test->all_filesystems || count_fs_descs() > 1)
 			ret |= run_tcases_per_fs();
 		else
-- 
2.47.2


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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [LTP] [PATCH 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
@ 2025-02-24 10:00 ` Petr Vorel
  2025-02-24 10:11 ` [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Li Wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 10:00 UTC (permalink / raw)
  To: ltp

Previously empty $LTP_SINGLE_FS_TYPE value caused no testing:

    # LTP_SINGLE_FS_TYPE= ./getdents02
    ...
    LTP_SINGLE_VARIANT= LTP_SINGLE_FS_TYPE= ./getdents02
    tst_kconfig.c:88: TINFO: Parsing kernel config '/boot/config-6.12.10-amd64'
    tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s
    tst_supported_fs_types.c:161: TINFO: WARNING: testing only
    tst_supported_fs_types.c:128: TINFO: Filesystem  is not supported
    tst_test.c:1861: TCONF: There are no supported filesystems

Now value is ignored:

    # LTP_SINGLE_FS_TYPE= ./getdents02
    ...
    tst_supported_fs_types.c:97: TINFO: Kernel supports ext2
    tst_supported_fs_types.c:62: TINFO: mkfs.ext2 does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports ext3
    tst_supported_fs_types.c:62: TINFO: mkfs.ext3 does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
    tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports xfs
    tst_supported_fs_types.c:62: TINFO: mkfs.xfs does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports btrfs
    tst_supported_fs_types.c:62: TINFO: mkfs.btrfs does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports bcachefs
    tst_supported_fs_types.c:62: TINFO: mkfs.bcachefs does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports vfat
    tst_supported_fs_types.c:62: TINFO: mkfs.vfat does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports exfat
    tst_supported_fs_types.c:62: TINFO: mkfs.exfat does exist
    tst_supported_fs_types.c:132: TINFO: FUSE does support ntfs
    tst_supported_fs_types.c:62: TINFO: mkfs.ntfs does exist
    tst_supported_fs_types.c:97: TINFO: Kernel supports tmpfs
    tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfs
    tst_test.c:1834: TINFO: === Testing on ext2 ===

Fixes: 1199657e91 ("lib: Add support for debugging .all_filesystems")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_supported_fs_types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index bbbb8df19f..5e51595d82 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -157,7 +157,7 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)
 	skip_fuse = tst_fs_in_skiplist("fuse", skiplist);
 	only_fs = getenv("LTP_SINGLE_FS_TYPE");
 
-	if (only_fs) {
+	if (only_fs && only_fs[0] != '\0') {
 		tst_res(TINFO, "WARNING: testing only %s", only_fs);
 		if (tst_fs_is_supported(only_fs))
 			fs_types[0] = only_fs;
-- 
2.47.2


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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
  2025-02-24 10:00 ` [LTP] [PATCH 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
@ 2025-02-24 10:11 ` Li Wang
  2025-02-24 10:21   ` Petr Vorel
  2025-02-24 10:22 ` Petr Vorel
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Li Wang @ 2025-02-24 10:11 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr, Andrea,

On Mon, Feb 24, 2025 at 6:00 PM Petr Vorel <pvorel@suse.cz> wrote:

> Allow to test only single struct tst_test->test_variants.
> This is a similar feature to $LTP_SINGLE_FS_TYPE.
>
> Value is ignored when test does not specify test_variants.
> When value is higher than test_variants value lastest variant is used.
>
>         # LTP_SINGLE_VARIANT=0 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
>         ..
>         tst_test.c:1918: TINFO: WARNING: testing only variant 0 of 3
>         tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
>         tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
>         tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
>         tst_test.c:1834: TINFO: === Testing on ext4 ===
>         tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts=''
> extra opts=''
>         mke2fs 1.47.2 (1-Jan-2025)
>         tst_test.c:1183: TINFO: Mounting /dev/loop0 to
> /tmp/LTP_getx2HrGH/mntpoint fstyp=ext4 flags=0
>         getdents.h:148: TINFO: Testing the SYS_getdents syscall
>         tst_buffers.c:57: TINFO: Test is using guarded buffers
>         getdents02.c:77: TPASS: fd=-5 dirp=0x7f0587803ee9 size=279 : EBADF
> (9)
>         getdents02.c:77: TPASS: fd=3 dirp=0x5641617a31e8 size=1 : EINVAL
> (22)
>         getdents02.c:77: TPASS: fd=4 dirp=0x7f0587803ee9 size=279 :
> ENOTDIR (20)
>         getdents02.c:77: TPASS: fd=5 dirp=0x7f0587803ee9 size=279 : ENOENT
> (2)
>         getdents02.c:77: TPASS: fd=3 dirp=0x7f0587802000 size=279 : EFAULT
> (14)
>
>         # LTP_SINGLE_VARIANT=2 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
>         ...
>         tst_test.c:1918: TINFO: WARNING: testing only variant 2 of 3
>         tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
>         tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
>         tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
>         tst_test.c:1834: TINFO: === Testing on ext4 ===
>         tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts=''
> extra opts=''
>         mke2fs 1.47.2 (1-Jan-2025)
>         tst_test.c:1183: TINFO: Mounting /dev/loop0 to
> /tmp/LTP_getWtBnGE/mntpoint fstyp=ext4 flags=0
>         getdents.h:157: TCONF: libc getdents() is not implemented
>
>         # LTP_SINGLE_VARIANT=99 LTP_SINGLE_FS_TYPE=ext4 ./getdents02 #
> higher value is max value
>         tst_test.c:1918: TINFO: WARNING: testing only variant 3 of 3
>         tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
>         tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
>         tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
>         tst_test.c:1834: TINFO: === Testing on ext4 ===
>         tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts=''
> extra opts=''
>         mke2fs 1.47.2 (1-Jan-2025)
>         tst_test.c:1183: TINFO: Mounting /dev/loop0 to
> /tmp/LTP_get1fX70n/mntpoint fstyp=ext4 flags=0
>         getdents.h:162: TINFO: Testing libc getdents64()
>         tst_buffers.c:57: TINFO: Test is using guarded buffers
>         getdents02.c:77: TPASS: fd=-5 dirp=0x7fcf140f3ee8 size=280 : EBADF
> (9)
>         getdents02.c:77: TPASS: fd=3 dirp=0x55a76e4531e8 size=1 : EINVAL
> (22)
>         getdents02.c:77: TPASS: fd=4 dirp=0x7fcf140f3ee8 size=280 :
> ENOTDIR (20)
>         getdents02.c:77: TPASS: fd=5 dirp=0x7fcf140f3ee8 size=280 : ENOENT
> (2)
>         getdents02.c:77: TPASS: fd=3 dirp=0x7fcf140f2000 size=280 : EFAULT
> (14)
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi all,
>
> Andrea wanted to run only single variant.
>

Could you tell me what the benefit is? why do we need this?

And back to the patch itself, if LTP_SINGLE_ITERATION is used, which
variant will be chosen to run by default? Is that expected?


-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:11 ` [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Li Wang
@ 2025-02-24 10:21   ` Petr Vorel
  2025-02-24 10:32     ` Li Wang
  0 siblings, 1 reply; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 10:21 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,

> > Hi all,

> > Andrea wanted to run only single variant.

> Could you tell me what the benefit is? why do we need this?

@Andrea ^

IMHO similar to LTP_SINGLE_FS_TYPE - speedup. Although I admit
LTP_SINGLE_FS_TYPE allows much bigger cleanup.

> And back to the patch itself, if LTP_SINGLE_ITERATION is used, which
> variant will be chosen to run by default? Is that expected?

By default all variants are tested.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
  2025-02-24 10:00 ` [LTP] [PATCH 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
  2025-02-24 10:11 ` [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Li Wang
@ 2025-02-24 10:22 ` Petr Vorel
  2025-02-24 12:29 ` Andrea Cervesato via ltp
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 10:22 UTC (permalink / raw)
  To: ltp

Hi,

if accepted, LTP_SINGLE_ITERATION should be mentioned in doc/users/setup_tests.rst.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:21   ` Petr Vorel
@ 2025-02-24 10:32     ` Li Wang
  2025-02-24 13:52       ` Petr Vorel
  0 siblings, 1 reply; 15+ messages in thread
From: Li Wang @ 2025-02-24 10:32 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

On Mon, Feb 24, 2025 at 6:21 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > > Hi all,
>
> > > Andrea wanted to run only single variant.
>
> > Could you tell me what the benefit is? why do we need this?
>
> @Andrea ^
>
> IMHO similar to LTP_SINGLE_FS_TYPE - speedup. Although I admit
> LTP_SINGLE_FS_TYPE allows much bigger cleanup.
>
> > And back to the patch itself, if LTP_SINGLE_ITERATION is used, which
> > variant will be chosen to run by default? Is that expected?
>
> By default all variants are tested.
>

Sorry, here I wanted to ask:
 Which variant will be selected when LTP_SINGLE_VARIANT is set?
 Is the selected variant the expected one?

Since the order of test variants is not standardized and is determined
by the author while test writing. Once we used LTP_SINGLE_VARIANT
it still does not guarantee the executed variant is the same for all tests.
Unless people only use it in manual debugging mode.


-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
                   ` (2 preceding siblings ...)
  2025-02-24 10:22 ` Petr Vorel
@ 2025-02-24 12:29 ` Andrea Cervesato via ltp
  2025-02-24 15:16 ` Cyril Hrubis
  2026-04-16  7:01 ` Petr Vorel
  5 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2025-02-24 12:29 UTC (permalink / raw)
  To: Petr Vorel, ltp

Hi Petr,

thanks for this patch. Implementation looks good to me and it would be 
beneficial for debugging purposes when we need to explore the reasons 
why test is failing.

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

On 2/24/25 11:00, Petr Vorel wrote:
> Allow to test only single struct tst_test->test_variants.
> This is a similar feature to $LTP_SINGLE_FS_TYPE.
>
> Value is ignored when test does not specify test_variants.
> When value is higher than test_variants value lastest variant is used.
>
> 	# LTP_SINGLE_VARIANT=0 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
> 	..
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 0 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getx2HrGH/mntpoint fstyp=ext4 flags=0
> 	getdents.h:148: TINFO: Testing the SYS_getdents syscall
> 	tst_buffers.c:57: TINFO: Test is using guarded buffers
> 	getdents02.c:77: TPASS: fd=-5 dirp=0x7f0587803ee9 size=279 : EBADF (9)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x5641617a31e8 size=1 : EINVAL (22)
> 	getdents02.c:77: TPASS: fd=4 dirp=0x7f0587803ee9 size=279 : ENOTDIR (20)
> 	getdents02.c:77: TPASS: fd=5 dirp=0x7f0587803ee9 size=279 : ENOENT (2)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x7f0587802000 size=279 : EFAULT (14)
>
> 	# LTP_SINGLE_VARIANT=2 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
> 	...
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 2 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getWtBnGE/mntpoint fstyp=ext4 flags=0
> 	getdents.h:157: TCONF: libc getdents() is not implemented
>
> 	# LTP_SINGLE_VARIANT=99 LTP_SINGLE_FS_TYPE=ext4 ./getdents02 # higher value is max value
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 3 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_get1fX70n/mntpoint fstyp=ext4 flags=0
> 	getdents.h:162: TINFO: Testing libc getdents64()
> 	tst_buffers.c:57: TINFO: Test is using guarded buffers
> 	getdents02.c:77: TPASS: fd=-5 dirp=0x7fcf140f3ee8 size=280 : EBADF (9)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x55a76e4531e8 size=1 : EINVAL (22)
> 	getdents02.c:77: TPASS: fd=4 dirp=0x7fcf140f3ee8 size=280 : ENOTDIR (20)
> 	getdents02.c:77: TPASS: fd=5 dirp=0x7fcf140f3ee8 size=280 : ENOENT (2)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x7fcf140f2000 size=280 : EFAULT (14)
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi all,
>
> Andrea wanted to run only single variant.
>
> Kind regards,
> Petr
>
>   lib/tst_test.c | 17 ++++++++++++++---
>   1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 3823ea109e..6edc310209 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -581,6 +581,7 @@ static void print_help(void)
>   	fprintf(stderr, "LTP_DEV              Path to the block device to be used (for .needs_device)\n");
>   	fprintf(stderr, "LTP_DEV_FS_TYPE      Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE);
>   	fprintf(stderr, "LTP_SINGLE_FS_TYPE   Testing only - specifies filesystem instead all supported (for .all_filesystems)\n");
> +	fprintf(stderr, "LTP_SINGLE_VARIANT   Testing only - specifies tst_variant to be run\n");
>   	fprintf(stderr, "LTP_TIMEOUT_MUL      Timeout multiplier (must be a number >=1)\n");
>   	fprintf(stderr, "LTP_RUNTIME_MUL      Runtime multiplier (must be a number >=1)\n");
>   	fprintf(stderr, "LTP_VIRT_OVERRIDE    Overrides virtual machine detection (values: \"\"|kvm|microsoft|xen|zvm)\n");
> @@ -1887,6 +1888,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>   	int ret = 0;
>   	unsigned int test_variants = 1;
>   	struct utsname uval;
> +	const char *only_variant;
>   
>   	lib_pid = getpid();
>   	tst_test = self;
> @@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>   
>   	tst_res(TINFO, "LTP version: "LTP_VERSION);
>   
> -
>   	uname(&uval);
>   	tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);
>   
> @@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>   
>   	set_overall_timeout();
>   
> -	if (tst_test->test_variants)
> +	if (tst_test->test_variants) {
>   		test_variants = tst_test->test_variants;
> +		only_variant = getenv("LTP_SINGLE_VARIANT");
> +		if (only_variant && only_variant[0] != '\0') {
> +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> +							  test_variants - 1);
> +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> +					tst_variant, test_variants - 1);
> +			test_variants = tst_variant + 1;
> +		}
> +	}
> +
> +	for (; tst_variant < test_variants; tst_variant++) {
>   
> -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
>   		if (tst_test->all_filesystems || count_fs_descs() > 1)
>   			ret |= run_tcases_per_fs();
>   		else

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:32     ` Li Wang
@ 2025-02-24 13:52       ` Petr Vorel
  0 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 13:52 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

> On Mon, Feb 24, 2025 at 6:21 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Li,

> > > > Hi all,

> > > > Andrea wanted to run only single variant.

> > > Could you tell me what the benefit is? why do we need this?

> > @Andrea ^

> > IMHO similar to LTP_SINGLE_FS_TYPE - speedup. Although I admit
> > LTP_SINGLE_FS_TYPE allows much bigger cleanup.

> > > And back to the patch itself, if LTP_SINGLE_ITERATION is used, which
> > > variant will be chosen to run by default? Is that expected?

> > By default all variants are tested.


> Sorry, here I wanted to ask:
>  Which variant will be selected when LTP_SINGLE_VARIANT is set?
>  Is the selected variant the expected one?

Well, test variant can mean anything. It started as libc variant or raw syscall,
but getdents.h has 4 variants (raw syscall SYS_getdents, raw syscall
SYS_getdents64, libc getdents() and libc getdents64()), futex_utils.h has 2
conditional variants variants syscall with old kernel spec and syscall time64
with kernel spec (often only one variant will be set), tests which are use
select_var.h have 5 variants, ...


> Since the order of test variants is not standardized and is determined
> by the author while test writing. Once we used LTP_SINGLE_VARIANT
> it still does not guarantee the executed variant is the same for all tests.
> Unless people only use it in manual debugging mode.

As Andrea wrote, the goal is to use it for debugging of a particular test.
Yes, it will not be useful to run whole syscalls with it defined.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
                   ` (3 preceding siblings ...)
  2025-02-24 12:29 ` Andrea Cervesato via ltp
@ 2025-02-24 15:16 ` Cyril Hrubis
  2025-02-24 18:00   ` Petr Vorel
  2026-04-16  7:01 ` Petr Vorel
  5 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2025-02-24 15:16 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
>  	lib_pid = getpid();
>  	tst_test = self;
> @@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>  
>  	tst_res(TINFO, "LTP version: "LTP_VERSION);
>  
> -
>  	uname(&uval);
>  	tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);
>  
> @@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>  
>  	set_overall_timeout();
>  
> -	if (tst_test->test_variants)
> +	if (tst_test->test_variants) {
>  		test_variants = tst_test->test_variants;
> +		only_variant = getenv("LTP_SINGLE_VARIANT");
> +		if (only_variant && only_variant[0] != '\0') {
> +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> +							  test_variants - 1);
> +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> +					tst_variant, test_variants - 1);
> +			test_variants = tst_variant + 1;
> +		}
> +	}
> +
> +	for (; tst_variant < test_variants; tst_variant++) {
>  
> -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
>  		if (tst_test->all_filesystems || count_fs_descs() > 1)
>  			ret |= run_tcases_per_fs();
>  		else

Can we instead add a function that would set two integer variables,
first_variant and last variant as:

static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
{
	//setup the defaults and parse the variables here
}

And the we can do:

diff --git a/lib/tst_test.c b/lib/tst_test.c
index e2803f04a..d19fe9aba 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1885,7 +1885,7 @@ unsigned int tst_variant;
 void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 {
        int ret = 0;
-       unsigned int test_variants = 1;
+       unsigned int first_variant, last_variant;
        struct utsname uval;

        lib_pid = getpid();
@@ -1908,10 +1908,9 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

        set_overall_timeout();

-       if (tst_test->test_variants)
-               test_variants = tst_test->test_variants;
+       setup_variants(&first_variant, &last_variant);

-       for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
+       for (tst_variant = first_variant; tst_variant <= last_variant; tst_variant++) {
                if (tst_test->all_filesystems || count_fs_descs() > 1)
                        ret |= run_tcases_per_fs();
                else
diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
index adce0ddcf..74a7e514e 100644
--- a/testcases/kernel/syscalls/pause/pause01.c
+++ b/testcases/kernel/syscalls/pause/pause01.c
@@ -20,6 +20,8 @@ static void do_child(void)
        SAFE_SIGNAL(SIGINT, sig_handler);
        TST_EXP_FAIL(pause(), EINTR);
        TST_CHECKPOINT_WAKE(0);
+
+       tst_res(TPASS, "Process resumed from pause()");
 }

 static void run(void)


-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 15:16 ` Cyril Hrubis
@ 2025-02-24 18:00   ` Petr Vorel
  2025-02-24 18:46     ` Cyril Hrubis
  0 siblings, 1 reply; 15+ messages in thread
From: Petr Vorel @ 2025-02-24 18:00 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,
> Hi!
> >  	lib_pid = getpid();
> >  	tst_test = self;
> > @@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

> >  	tst_res(TINFO, "LTP version: "LTP_VERSION);

> > -
> >  	uname(&uval);
> >  	tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);

> > @@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

> >  	set_overall_timeout();

> > -	if (tst_test->test_variants)
> > +	if (tst_test->test_variants) {
> >  		test_variants = tst_test->test_variants;
> > +		only_variant = getenv("LTP_SINGLE_VARIANT");
> > +		if (only_variant && only_variant[0] != '\0') {
> > +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> > +							  test_variants - 1);
> > +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> > +					tst_variant, test_variants - 1);
> > +			test_variants = tst_variant + 1;
> > +		}
> > +	}
> > +
> > +	for (; tst_variant < test_variants; tst_variant++) {

> > -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
> >  		if (tst_test->all_filesystems || count_fs_descs() > 1)
> >  			ret |= run_tcases_per_fs();
> >  		else

> Can we instead add a function that would set two integer variables,
> first_variant and last variant as:

> static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
> {
> 	//setup the defaults and parse the variables here
> }

Sure, I'll send v2 if you see the patch useful (Li was not sure if this is
useful).

> And the we can do:

> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index e2803f04a..d19fe9aba 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1885,7 +1885,7 @@ unsigned int tst_variant;
>  void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>  {
>         int ret = 0;
> -       unsigned int test_variants = 1;
> +       unsigned int first_variant, last_variant;
>         struct utsname uval;

>         lib_pid = getpid();
> @@ -1908,10 +1908,9 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

>         set_overall_timeout();

> -       if (tst_test->test_variants)
> -               test_variants = tst_test->test_variants;
> +       setup_variants(&first_variant, &last_variant);

> -       for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
> +       for (tst_variant = first_variant; tst_variant <= last_variant; tst_variant++) {
>                 if (tst_test->all_filesystems || count_fs_descs() > 1)
>                         ret |= run_tcases_per_fs();
>                 else
> diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
> index adce0ddcf..74a7e514e 100644
> --- a/testcases/kernel/syscalls/pause/pause01.c
> +++ b/testcases/kernel/syscalls/pause/pause01.c
> @@ -20,6 +20,8 @@ static void do_child(void)
>         SAFE_SIGNAL(SIGINT, sig_handler);
>         TST_EXP_FAIL(pause(), EINTR);
>         TST_CHECKPOINT_WAKE(0);
> +
> +       tst_res(TPASS, "Process resumed from pause()");

I guess this is part of some other work, right? (there is no TST_EXP_FAIL() in
pause01.c).

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 18:00   ` Petr Vorel
@ 2025-02-24 18:46     ` Cyril Hrubis
  2025-02-25  8:02       ` Petr Vorel
  0 siblings, 1 reply; 15+ messages in thread
From: Cyril Hrubis @ 2025-02-24 18:46 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
> > > -	if (tst_test->test_variants)
> > > +	if (tst_test->test_variants) {
> > >  		test_variants = tst_test->test_variants;
> > > +		only_variant = getenv("LTP_SINGLE_VARIANT");
> > > +		if (only_variant && only_variant[0] != '\0') {
> > > +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> > > +							  test_variants - 1);
> > > +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> > > +					tst_variant, test_variants - 1);
> > > +			test_variants = tst_variant + 1;
> > > +		}
> > > +	}
> > > +
> > > +	for (; tst_variant < test_variants; tst_variant++) {
> 
> > > -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
> > >  		if (tst_test->all_filesystems || count_fs_descs() > 1)
> > >  			ret |= run_tcases_per_fs();
> > >  		else
> 
> > Can we instead add a function that would set two integer variables,
> > first_variant and last variant as:
> 
> > static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
> > {
> > 	//setup the defaults and parse the variables here
> > }
> 
> Sure, I'll send v2 if you see the patch useful (Li was not sure if this is
> useful).

I do not have a strong opinion here, it may be mildly useful for test
development, in some rare circumstances.

> > diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
> > index adce0ddcf..74a7e514e 100644
> > --- a/testcases/kernel/syscalls/pause/pause01.c
> > +++ b/testcases/kernel/syscalls/pause/pause01.c
> > @@ -20,6 +20,8 @@ static void do_child(void)
> >         SAFE_SIGNAL(SIGINT, sig_handler);
> >         TST_EXP_FAIL(pause(), EINTR);
> >         TST_CHECKPOINT_WAKE(0);
> > +
> > +       tst_res(TPASS, "Process resumed from pause()");
> 
> I guess this is part of some other work, right? (there is no TST_EXP_FAIL() in
> pause01.c).

That's from a different review, sorry...

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 18:46     ` Cyril Hrubis
@ 2025-02-25  8:02       ` Petr Vorel
  0 siblings, 0 replies; 15+ messages in thread
From: Petr Vorel @ 2025-02-25  8:02 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

> Hi!
> > > > -	if (tst_test->test_variants)
> > > > +	if (tst_test->test_variants) {
> > > >  		test_variants = tst_test->test_variants;
> > > > +		only_variant = getenv("LTP_SINGLE_VARIANT");
> > > > +		if (only_variant && only_variant[0] != '\0') {
> > > > +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> > > > +							  test_variants - 1);
> > > > +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> > > > +					tst_variant, test_variants - 1);
> > > > +			test_variants = tst_variant + 1;
> > > > +		}
> > > > +	}
> > > > +
> > > > +	for (; tst_variant < test_variants; tst_variant++) {

> > > > -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
> > > >  		if (tst_test->all_filesystems || count_fs_descs() > 1)
> > > >  			ret |= run_tcases_per_fs();
> > > >  		else

> > > Can we instead add a function that would set two integer variables,
> > > first_variant and last variant as:

> > > static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
> > > {
> > > 	//setup the defaults and parse the variables here
> > > }

> > Sure, I'll send v2 if you see the patch useful (Li was not sure if this is
> > useful).

> I do not have a strong opinion here, it may be mildly useful for test
> development, in some rare circumstances.

Yeah, that's why I put "Testing only" in the help.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
                   ` (4 preceding siblings ...)
  2025-02-24 15:16 ` Cyril Hrubis
@ 2026-04-16  7:01 ` Petr Vorel
  2026-04-16  7:25   ` Andrea Cervesato via ltp
  2026-04-16  8:19   ` Li Wang
  5 siblings, 2 replies; 15+ messages in thread
From: Petr Vorel @ 2026-04-16  7:01 UTC (permalink / raw)
  To: ltp

Hi,

> Allow to test only single struct tst_test->test_variants.
> This is a similar feature to $LTP_SINGLE_FS_TYPE.

> Value is ignored when test does not specify test_variants.
> When value is higher than test_variants value lastest variant is used.

Gently ping for this patch. IMHO it can be useful in some corner case debugging.

Kind regards,
Petr

> 	# LTP_SINGLE_VARIANT=0 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
> 	..
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 0 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getx2HrGH/mntpoint fstyp=ext4 flags=0
> 	getdents.h:148: TINFO: Testing the SYS_getdents syscall
> 	tst_buffers.c:57: TINFO: Test is using guarded buffers
> 	getdents02.c:77: TPASS: fd=-5 dirp=0x7f0587803ee9 size=279 : EBADF (9)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x5641617a31e8 size=1 : EINVAL (22)
> 	getdents02.c:77: TPASS: fd=4 dirp=0x7f0587803ee9 size=279 : ENOTDIR (20)
> 	getdents02.c:77: TPASS: fd=5 dirp=0x7f0587803ee9 size=279 : ENOENT (2)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x7f0587802000 size=279 : EFAULT (14)

> 	# LTP_SINGLE_VARIANT=2 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
> 	...
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 2 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_getWtBnGE/mntpoint fstyp=ext4 flags=0
> 	getdents.h:157: TCONF: libc getdents() is not implemented

> 	# LTP_SINGLE_VARIANT=99 LTP_SINGLE_FS_TYPE=ext4 ./getdents02 # higher value is max value
> 	tst_test.c:1918: TINFO: WARNING: testing only variant 3 of 3
> 	tst_supported_fs_types.c:161: TINFO: WARNING: testing only ext4
> 	tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
> 	tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
> 	tst_test.c:1834: TINFO: === Testing on ext4 ===
> 	tst_test.c:1171: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
> 	mke2fs 1.47.2 (1-Jan-2025)
> 	tst_test.c:1183: TINFO: Mounting /dev/loop0 to /tmp/LTP_get1fX70n/mntpoint fstyp=ext4 flags=0
> 	getdents.h:162: TINFO: Testing libc getdents64()
> 	tst_buffers.c:57: TINFO: Test is using guarded buffers
> 	getdents02.c:77: TPASS: fd=-5 dirp=0x7fcf140f3ee8 size=280 : EBADF (9)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x55a76e4531e8 size=1 : EINVAL (22)
> 	getdents02.c:77: TPASS: fd=4 dirp=0x7fcf140f3ee8 size=280 : ENOTDIR (20)
> 	getdents02.c:77: TPASS: fd=5 dirp=0x7fcf140f3ee8 size=280 : ENOENT (2)
> 	getdents02.c:77: TPASS: fd=3 dirp=0x7fcf140f2000 size=280 : EFAULT (14)

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi all,

> Andrea wanted to run only single variant.

> Kind regards,
> Petr

>  lib/tst_test.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)

> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 3823ea109e..6edc310209 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -581,6 +581,7 @@ static void print_help(void)
>  	fprintf(stderr, "LTP_DEV              Path to the block device to be used (for .needs_device)\n");
>  	fprintf(stderr, "LTP_DEV_FS_TYPE      Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE);
>  	fprintf(stderr, "LTP_SINGLE_FS_TYPE   Testing only - specifies filesystem instead all supported (for .all_filesystems)\n");
> +	fprintf(stderr, "LTP_SINGLE_VARIANT   Testing only - specifies tst_variant to be run\n");
>  	fprintf(stderr, "LTP_TIMEOUT_MUL      Timeout multiplier (must be a number >=1)\n");
>  	fprintf(stderr, "LTP_RUNTIME_MUL      Runtime multiplier (must be a number >=1)\n");
>  	fprintf(stderr, "LTP_VIRT_OVERRIDE    Overrides virtual machine detection (values: \"\"|kvm|microsoft|xen|zvm)\n");
> @@ -1887,6 +1888,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>  	int ret = 0;
>  	unsigned int test_variants = 1;
>  	struct utsname uval;
> +	const char *only_variant;

>  	lib_pid = getpid();
>  	tst_test = self;
> @@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

>  	tst_res(TINFO, "LTP version: "LTP_VERSION);

> -
>  	uname(&uval);
>  	tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);

> @@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)

>  	set_overall_timeout();

> -	if (tst_test->test_variants)
> +	if (tst_test->test_variants) {
>  		test_variants = tst_test->test_variants;
> +		only_variant = getenv("LTP_SINGLE_VARIANT");
> +		if (only_variant && only_variant[0] != '\0') {
> +			tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> +							  test_variants - 1);
> +			tst_res(TINFO, "WARNING: testing only variant %d of %d",
> +					tst_variant, test_variants - 1);
> +			test_variants = tst_variant + 1;
> +		}
> +	}
> +
> +	for (; tst_variant < test_variants; tst_variant++) {

> -	for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
>  		if (tst_test->all_filesystems || count_fs_descs() > 1)
>  			ret |= run_tcases_per_fs();
>  		else

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2026-04-16  7:01 ` Petr Vorel
@ 2026-04-16  7:25   ` Andrea Cervesato via ltp
  2026-04-16  8:19   ` Li Wang
  1 sibling, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2026-04-16  7:25 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

this patch is not applying anymore, can you please send a new version?
So we are making sure that it's correctly implemented.

Thanks,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
  2026-04-16  7:01 ` Petr Vorel
  2026-04-16  7:25   ` Andrea Cervesato via ltp
@ 2026-04-16  8:19   ` Li Wang
  1 sibling, 0 replies; 15+ messages in thread
From: Li Wang @ 2026-04-16  8:19 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

Petr Vorel <pvorel@suse.cz> wrote:

> > Allow to test only single struct tst_test->test_variants.
> > This is a similar feature to $LTP_SINGLE_FS_TYPE.
>
> > Value is ignored when test does not specify test_variants.
> > When value is higher than test_variants value lastest variant is used.
>
> Gently ping for this patch. IMHO it can be useful in some corner case debugging.

Agreed.

> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -581,6 +581,7 @@ static void print_help(void)
> >       fprintf(stderr, "LTP_DEV              Path to the block device to be used (for .needs_device)\n");
> >       fprintf(stderr, "LTP_DEV_FS_TYPE      Filesystem used for testing (default: %s)\n", DEFAULT_FS_TYPE);
> >       fprintf(stderr, "LTP_SINGLE_FS_TYPE   Testing only - specifies filesystem instead all supported (for .all_filesystems)\n");
> > +     fprintf(stderr, "LTP_SINGLE_VARIANT   Testing only - specifies tst_variant to be run\n");

How about name it as: LTP_VARIANT_START ?

> >       fprintf(stderr, "LTP_TIMEOUT_MUL      Timeout multiplier (must be a number >=1)\n");
> >       fprintf(stderr, "LTP_RUNTIME_MUL      Runtime multiplier (must be a number >=1)\n");
> >       fprintf(stderr, "LTP_VIRT_OVERRIDE    Overrides virtual machine detection (values: \"\"|kvm|microsoft|xen|zvm)\n");
> > @@ -1887,6 +1888,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
> >       int ret = 0;
> >       unsigned int test_variants = 1;
> >       struct utsname uval;
> > +     const char *only_variant;
>
> >       lib_pid = getpid();
> >       tst_test = self;
> > @@ -1899,7 +1901,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>
> >       tst_res(TINFO, "LTP version: "LTP_VERSION);
>
> > -
> >       uname(&uval);
> >       tst_res(TINFO, "Tested kernel: %s %s %s", uval.release, uval.version, uval.machine);
>
> > @@ -1908,10 +1909,20 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
>
> >       set_overall_timeout();
>
> > -     if (tst_test->test_variants)
> > +     if (tst_test->test_variants) {
> >               test_variants = tst_test->test_variants;
> > +             only_variant = getenv("LTP_SINGLE_VARIANT");
> > +             if (only_variant && only_variant[0] != '\0') {
> > +                     tst_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
> > +                                                       test_variants - 1);

Maybe limit the only_variant to range 0~(tst_variants-1)?

I think it'd be better to give a hint of the range rather than
excutiona non-exist number e.g. 99 there.

> > +                     tst_res(TINFO, "WARNING: testing only variant %d of %d",
> > +                                     tst_variant, test_variants - 1);
> > +                     test_variants = tst_variant + 1;
> > +             }
> > +     }
> > +
> > +     for (; tst_variant < test_variants; tst_variant++) {

I guess we need to reset the tst_variant value to zero before each looping.
Because if a test restarts, or manipulates this global state elsewhere,
it won't reset to 0, causing unpredictable behavior or skipped tests.

Then, something maybe like:

 void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 {
        unsigned int test_variants = 1;
+       unsigned int variant_start = 0;
        struct utsname uval;

        tst_test = self;
@@ -2057,10 +2059,20 @@ void tst_run_tcases(int argc, char *argv[],
struct tst_test *self)

        set_overall_timeout();

-       if (tst_test->test_variants)
+       if (tst_test->test_variants) {
                test_variants = tst_test->test_variants;

-       for (tst_variant = 0; tst_variant < test_variants; tst_variant++) {
+               const char *only = getenv("LTP_SINGLE_VARIANT");
+               if (only && *only) {
+                       variant_start = SAFE_STRTOL((char *)only, 0,
test_variants - 1);
+                       test_variants = variant_start + 1;
+
+                       tst_res(TINFO, "WARNING: testing only variant %d of %d",
+                                       variant_start,
tst_test->test_variants - 1);
+               }
+       }
+
+       for (tst_variant = variant_start; tst_variant < test_variants;
tst_variant++) {
                if (tst_test->all_filesystems || count_fs_descs() > 1)
                        run_tcases_per_fs();
                else



-- 
Regards,
Li Wang

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-04-16  8:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 10:00 [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
2025-02-24 10:00 ` [LTP] [PATCH 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
2025-02-24 10:11 ` [LTP] [PATCH 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Li Wang
2025-02-24 10:21   ` Petr Vorel
2025-02-24 10:32     ` Li Wang
2025-02-24 13:52       ` Petr Vorel
2025-02-24 10:22 ` Petr Vorel
2025-02-24 12:29 ` Andrea Cervesato via ltp
2025-02-24 15:16 ` Cyril Hrubis
2025-02-24 18:00   ` Petr Vorel
2025-02-24 18:46     ` Cyril Hrubis
2025-02-25  8:02       ` Petr Vorel
2026-04-16  7:01 ` Petr Vorel
2026-04-16  7:25   ` Andrea Cervesato via ltp
2026-04-16  8:19   ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox