[LTP] [PATCH v4] lib: LTP_SINGLE_FS_TYPE and LTP_FORCE_SINGLE_FS_TYPE

Petr Vorel pvorel@suse.cz
Tue May 27 11:34:36 CEST 2025


Hi Li, Cyril,

> Petr Vorel <pvorel@suse.cz> wrote:

> > > -     skip_fuse = tst_fs_in_skiplist("fuse", skiplist);
> > >       only_fs = getenv("LTP_SINGLE_FS_TYPE");
> > > +     force_only_fs = getenv("LTP_FORCE_SINGLE_FS_TYPE");
> > > +
> > > +     if (only_fs && force_only_fs) {
> > > +             tst_brk(TBROK,
> > > +                     "Only one of LTP_SINGLE_FS_TYPE and LTP_FORCE_SINGLE_FS_TYPE can be set");
> > > +             return NULL;
> > > +     }
> > > +
> > > +     skip_fuse = tst_fs_in_skiplist("fuse", skiplist);

> > >       if (only_fs) {
> > >               tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > > -             if (tst_fs_is_supported(only_fs))
> > > +             if (fs_could_be_used(only_fs, skiplist, skip_fuse))
> > >                       fs_types[0] = only_fs;

> One more thing I'm a bit hesitant about, do we need to explicitly set
> fs_types[1] to NULL here?

Although it looks reasonable, I suppose it's not needed because array is static,
therefore members are NULL, right?

static const char *fs_types[ARRAY_SIZE(fs_type_whitelist)];

Also I tested it on statmount02.c, which has:

	.all_filesystems = 1,
	.skip_filesystems = (const char *const []) {
		"fuse",
		"btrfs",
		NULL
	},

and it works as expected:

# LTP_SINGLE_FS_TYPE=ntfs ./statmount02
...
tst_test.c:1953: TINFO: LTP version: 20250130-278-gada0e52d26
...
tst_supported_fs_types.c:190: TINFO: WARNING: testing only ntfs
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:163: TINFO: Skipping FUSE based ntfs as requested by the test
tst_test.c:1917: TCONF: There are no supported filesystems

# LTP_FORCE_SINGLE_FS_TYPE=ntfs ./statmount02
...
tst_test.c:1953: TINFO: LTP version: 20250130-278-gada0e52d26
...
tst_supported_fs_types.c:197: TINFO: WARNING: force testing only ntfs
tst_test.c:1888: TINFO: === Testing on ntfs ===
tst_test.c:1217: TINFO: Formatting /dev/loop0 with ntfs opts='' extra opts=''
The partition start sector was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of sectors per track was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of heads was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
statmount02.c:51: TINFO: Mounting /dev/loop0 to /tmp/LTP_sta2GSo2A/mntpoint fstyp=ntfs flags=1
statmount02.c:51: TINFO: Trying FUSE...
statmount02.c:35: TPASS: statmount(sx_mount->data.stx_mnt_id, STATMOUNT_SB_BASIC, st_mount, sizeof(struct statmount), 0) passed
statmount02.c:41: TPASS: st_mount->mask == STATMOUNT_SB_BASIC (1)
statmount02.c:42: TPASS: st_mount->size == sizeof(struct statmount) (512)
statmount02.c:43: TPASS: st_mount->sb_dev_major == sx_mount->data.stx_dev_major (7)
statmount02.c:44: TPASS: st_mount->sb_dev_minor == sx_mount->data.stx_dev_minor (0)
statmount02.c:45: TPASS: st_mount->sb_magic == sf_mount->f_type (1702057286)
statmount02.c:46: TFAIL: st_mount->sb_flags (0) != MS_RDONLY (1)
statmount02.c:60: TINFO: Umounting /tmp/LTP_sta2GSo2A/mntpoint

Kind regards,
Petr

> > >               return fs_types;
> > >       }

> > > -     for (i = 0; fs_type_whitelist[i]; i++) {
> > > -             if (tst_fs_in_skiplist(fs_type_whitelist[i], skiplist)) {
> > > -                     tst_res(TINFO, "Skipping %s as requested by the test",
> > > -                             fs_type_whitelist[i]);
> > > -                     continue;
> > > -             }
> > > -
> > > -             sup = tst_fs_is_supported(fs_type_whitelist[i]);
> > > -
> > > -             if (skip_fuse && sup == TST_FS_FUSE) {
> > > -                     tst_res(TINFO,
> > > -                             "Skipping FUSE based %s as requested by the test",
> > > -                             fs_type_whitelist[i]);
> > > -                     continue;
> > > -             }
> > > +     if (force_only_fs) {
> > > +             tst_res(TINFO, "WARNING: force testing only %s", force_only_fs);
> > > +             fs_types[0] = force_only_fs;

> fs_type[1] = NULL; ?


More information about the ltp mailing list