* [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
@ 2025-02-25 11:44 Petr Vorel
2025-02-25 11:44 ` [LTP] [PATCH v2 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
2025-12-18 12:39 ` [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Andrea Cervesato via ltp
0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2025-02-25 11:44 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.
Variant counting starts with 0, latest value is test_variants - 1
(C array like counting).
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:1904: TINFO: WARNING: testing only variant 0 of 3
tst_test.c:1937: TINFO: ===== Testing tst_variant: 0 =====
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_getrQ7dbE/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=0x7fdf76897ee9 size=279 : EBADF (9)
getdents02.c:77: TPASS: fd=3 dirp=0x557a810581e8 size=1 : EINVAL (22)
getdents02.c:77: TPASS: fd=4 dirp=0x7fdf76897ee9 size=279 : ENOTDIR (20)
getdents02.c:77: TPASS: fd=5 dirp=0x7fdf76897ee9 size=279 : ENOENT (2)
getdents02.c:77: TPASS: fd=3 dirp=0x7fdf76896000 size=279 : EFAULT (14)
# LTP_SINGLE_VARIANT=2 LTP_SINGLE_FS_TYPE=ext4 ./getdents02
...
tst_test.c:1904: TINFO: WARNING: testing only variant 2 of 3
tst_test.c:1937: TINFO: ===== Testing tst_variant: 2 =====
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_gethBuDHc/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:1904: TINFO: WARNING: testing only variant 3 of 3
tst_test.c:1937: TINFO: ===== Testing tst_variant: 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_getnfis4f/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=0x7f1b029b2ee8 size=280 : EBADF (9)
getdents02.c:77: TPASS: fd=3 dirp=0x55fbc55661e8 size=1 : EINVAL (22)
getdents02.c:77: TPASS: fd=4 dirp=0x7f1b029b2ee8 size=280 : ENOTDIR (20)
getdents02.c:77: TPASS: fd=5 dirp=0x7f1b029b2ee8 size=280 : ENOENT (2)
getdents02.c:77: TPASS: fd=3 dirp=0x7f1b029b1000 size=280 : EFAULT (14)
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Add a function that would set two integer variables, first_variant and
last variant (Cyril). NOTE: I'm not sure if the implementation is really
better than the previous one.
* Add documentation into setup_tests.rst.
doc/users/setup_tests.rst | 3 +++
lib/tst_test.c | 33 ++++++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/doc/users/setup_tests.rst b/doc/users/setup_tests.rst
index 2766ed719c..78e1098917 100644
--- a/doc/users/setup_tests.rst
+++ b/doc/users/setup_tests.rst
@@ -46,6 +46,9 @@ users.
- Testing only - specifies filesystem instead all supported
(for tests with ``.all_filesystems``).
+ * - LTP_SINGLE_VARIANT
+ - Testing only - specifies tst_variant to be run.
+
* - LTP_DEV_FS_TYPE
- Filesystem used for testing (default: ``ext2``).
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 3823ea109e..ddeacfb228 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");
@@ -1882,10 +1883,33 @@ static int run_tcases_per_fs(void)
unsigned int tst_variant;
+static void setup_variants(unsigned int *first_variant, unsigned int *last_variant)
+{
+ const char *only_variant;
+ *first_variant = 0;
+ *last_variant = 1;
+
+ if (!tst_test->test_variants)
+ return;
+
+ *last_variant = tst_test->test_variants;
+
+ only_variant = getenv("LTP_SINGLE_VARIANT");
+ if (!only_variant || only_variant[0] == '\0')
+ return;
+
+ *first_variant = MIN(SAFE_STRTOL((char *)only_variant, 0, INT_MAX),
+ *last_variant - 1);
+
+ tst_res(TINFO, "WARNING: testing only variant %d of %d",
+ *first_variant, *last_variant - 1);
+ *last_variant = *first_variant + 1;
+}
+
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();
@@ -1899,7 +1923,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 +1931,10 @@ 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++) {
+ tst_res(TINFO, "===== Testing tst_variant: %d =====", 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] 6+ messages in thread* [LTP] [PATCH v2 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value
2025-02-25 11:44 [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
@ 2025-02-25 11:44 ` Petr Vorel
2025-12-18 12:30 ` Andrea Cervesato via ltp
2025-12-18 12:39 ` [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Andrea Cervesato via ltp
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2025-02-25 11:44 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>
---
The same as v1.
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] 6+ messages in thread* Re: [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
2025-02-25 11:44 [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
2025-02-25 11:44 ` [LTP] [PATCH v2 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
@ 2025-12-18 12:39 ` Andrea Cervesato via ltp
2026-01-05 14:55 ` Petr Vorel
1 sibling, 1 reply; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2025-12-18 12:39 UTC (permalink / raw)
To: Petr Vorel, ltp
Hi!
I was re-checking this implementation and it looks a bit different than
what I was expecting. I probably misunderstood the first version.
I was wondering if it's possible to select a specific variant inside
the variants list, but this patch seems to start from the one we select
until the end.
--
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] 6+ messages in thread
* Re: [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant
2025-12-18 12:39 ` [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Andrea Cervesato via ltp
@ 2026-01-05 14:55 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2026-01-05 14:55 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
> Hi!
> I was re-checking this implementation and it looks a bit different than
> what I was expecting. I probably misunderstood the first version.
> I was wondering if it's possible to select a specific variant inside
> the variants list, but this patch seems to start from the one we select
> until the end.
It's really as we discussed, only single variant is selected:
+ *last_variant = *first_variant + 1;
$ LTP_SINGLE_VARIANT=5 ./lib/newlib_tests/test_fail_variant
...
tst_test.c:1857: TINFO: Overall timeout per run is 0h 00m 30s
tst_test.c:2034: TINFO: WARNING: testing only variant 5 of 9
tst_test.c:2068: TINFO: ===== Testing tst_variant: 5 =====
test_fail_variant.c:13: TFAIL: Failing a test variant
Summary:
passed 0
failed 1
broken 0
skipped 0
warnings 0
And with master is:
$ LTP_SINGLE_VARIANT=5 ./lib/newlib_tests/test_fail_variant
...
tst_test.c:1856: TINFO: Overall timeout per run is 0h 00m 30s
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
test_fail_variant.c:13: TFAIL: Failing a test variant
Summary:
passed 0
failed 10
broken 0
skipped 0
warnings 0
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-05 14:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 11:44 [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Petr Vorel
2025-02-25 11:44 ` [LTP] [PATCH v2 2/2] tst_supported_fs_types: Ignore empty $LTP_SINGLE_FS_TYPE value Petr Vorel
2025-12-18 12:30 ` Andrea Cervesato via ltp
2026-01-05 14:30 ` Petr Vorel
2025-12-18 12:39 ` [LTP] [PATCH v2 1/2] tst_test: Add $LTP_SINGLE_ITERATION to limit variant Andrea Cervesato via ltp
2026-01-05 14:55 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox