diff mbox series

[1/3] ioctl_ficlone02.c: set all_filesystems to zero

Message ID 20241201093606.68993-2-zlang@kernel.org
State New
Headers show
Series LTP random fixes for xfs and btrfs | expand

Commit Message

Zorro Lang Dec. 1, 2024, 9:36 a.m. UTC
This test need to skip test known filesystems, but according to below
code logic (in lib/tst_test.c):

  if (!tst_test->all_filesystems && tst_test->skip_filesystems) {
        long fs_type = tst_fs_type(".");
        const char *fs_name = tst_fs_type_name(fs_type);

        if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems)) {
            tst_brk(TCONF, "%s is not supported by the test",
            fs_name);
        }

        tst_res(TINFO, "%s is supported by the test", fs_name);
  }

if all_filesystems is 1, the skip_filesystems doesn't work. So set
all_filesystems to 0.

Signed-off-by: Zorro Lang <zlang@kernel.org>
---
 testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Dec. 2, 2024, 1:36 p.m. UTC | #1
Hi!
> This test need to skip test known filesystems, but according to below
> code logic (in lib/tst_test.c):
> 
>   if (!tst_test->all_filesystems && tst_test->skip_filesystems) {
>         long fs_type = tst_fs_type(".");
>         const char *fs_name = tst_fs_type_name(fs_type);
> 
>         if (tst_fs_in_skiplist(fs_name, tst_test->skip_filesystems)) {
>             tst_brk(TCONF, "%s is not supported by the test",
>             fs_name);
>         }
>
>         tst_res(TINFO, "%s is supported by the test", fs_name);
>   }
> 
> if all_filesystems is 1, the skip_filesystems doesn't work. So set
> all_filesystems to 0.

The code to skip filesystems in the case of all filesystems is in the
run_tcase_per_fs() function:

static int run_tcases_per_fs(void)
{
        int ret = 0;
        unsigned int i;
        const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);

The skip_filesystems array is passed to the tst_get_supporte_fs_types()
function which filters out them.
Cyril Hrubis Dec. 2, 2024, 1:59 p.m. UTC | #2
Hi!
> The code to skip filesystems in the case of all filesystems is in the
> run_tcase_per_fs() function:
> 
> static int run_tcases_per_fs(void)
> {
>         int ret = 0;
>         unsigned int i;
>         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);
> 
> The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> function which filters out them.

Perhaps you mean that the skiplist does not work with .all_filesystems
_and_ the LTP_SINGLE_FS_TYPE environment variable?

I guess that we need:

diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
index bbbb8df19..49b1d7205 100644
--- a/lib/tst_supported_fs_types.c
+++ b/lib/tst_supported_fs_types.c
@@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)

        if (only_fs) {
                tst_res(TINFO, "WARNING: testing only %s", only_fs);
+
+               if (tst_fs_in_skiplist(only_fs, skiplist))
+                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
+
                if (tst_fs_is_supported(only_fs))
                        fs_types[0] = only_fs;
                return fs_types;
Petr Vorel Dec. 2, 2024, 2:42 p.m. UTC | #3
> Hi!
> > The code to skip filesystems in the case of all filesystems is in the
> > run_tcase_per_fs() function:

> > static int run_tcases_per_fs(void)
> > {
> >         int ret = 0;
> >         unsigned int i;
> >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);

> > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > function which filters out them.

> Perhaps you mean that the skiplist does not work with .all_filesystems
> _and_ the LTP_SINGLE_FS_TYPE environment variable?

> I guess that we need:

> diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> index bbbb8df19..49b1d7205 100644
> --- a/lib/tst_supported_fs_types.c
> +++ b/lib/tst_supported_fs_types.c
> @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)

>         if (only_fs) {
>                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> +
> +               if (tst_fs_in_skiplist(only_fs, skiplist))
> +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> +

It's a nice feature to be able to force testing on filesystem even it's set to
be skipped without need to manually enable the filesystem and recompile.
(It helps testing with LTP compiled as a package without need to compile LTP.)
Therefore I would avoid this.

@Zorro Lang or are you testing whole syscalls on particular filesystem via
LTP_SINGLE_FS_TYPE=xfs ?

Kind regards,
Petr

>                 if (tst_fs_is_supported(only_fs))
>                         fs_types[0] = only_fs;
>                 return fs_types;
Cyril Hrubis Dec. 2, 2024, 3:23 p.m. UTC | #4
Hi!
> It's a nice feature to be able to force testing on filesystem even it's set to
> be skipped without need to manually enable the filesystem and recompile.
> (It helps testing with LTP compiled as a package without need to compile LTP.)
> Therefore I would avoid this.

I guess that this should be another env variable e.g.
LTP_FORCE_SINGLE_FS_TYPE and it should print a big fat warning that it's
only for development purposes.
Petr Vorel Dec. 3, 2024, 4:53 a.m. UTC | #5
> Hi!
> > It's a nice feature to be able to force testing on filesystem even it's set to
> > be skipped without need to manually enable the filesystem and recompile.
> > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > Therefore I would avoid this.

> I guess that this should be another env variable e.g.
> LTP_FORCE_SINGLE_FS_TYPE and it should print a big fat warning that it's
> only for development purposes.

Well, LTP_SINGLE_FS_TYPE already has "Testing only" and that was the reason it
just forced filesystem regardless "skip" setup. Sure, we can turn it into
"normal" variable and introduce LTP_FORCE_SINGLE_FS_TYPE if it's needed.
But that would be an use case if anybody uses LTP really to test particular
filesystem. And it would affect only .all_filesystem tests (e.g. user's
responsibility would be to point TMPDIR to that particular system on non-
.all_filesystem tests).

@Zorro was it meant like this?

Kind regards,
Petr
Cyril Hrubis Dec. 3, 2024, 7:58 a.m. UTC | #6
Hi!
> > > It's a nice feature to be able to force testing on filesystem even it's set to
> > > be skipped without need to manually enable the filesystem and recompile.
> > > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > > Therefore I would avoid this.
> 
> > I guess that this should be another env variable e.g.
> > LTP_FORCE_SINGLE_FS_TYPE and it should print a big fat warning that it's
> > only for development purposes.
> 
> Well, LTP_SINGLE_FS_TYPE already has "Testing only"

That was maybe how we intended it but we exposed the API and it seems
that there is a usecase for it so people are possibly using it.

> and that was the reason it just forced filesystem regardless "skip"
> setup. Sure, we can turn it into "normal" variable and introduce
> LTP_FORCE_SINGLE_FS_TYPE if it's needed.  But that would be an use
> case if anybody uses LTP really to test particular filesystem. And it
> would affect only .all_filesystem tests (e.g. user's responsibility
> would be to point TMPDIR to that particular system on non-
> .all_filesystem tests).

There is a usecase we haven't figured out, when you want to test a
single filesystem, you do not want to waste time on the rest of the
filesystems and LTP_SINGlE_FS_TYPE nearly works for that usecase.
Petr Vorel Dec. 3, 2024, 9:24 a.m. UTC | #7
> Hi!
> > > > It's a nice feature to be able to force testing on filesystem even it's set to
> > > > be skipped without need to manually enable the filesystem and recompile.
> > > > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > > > Therefore I would avoid this.

> > > I guess that this should be another env variable e.g.
> > > LTP_FORCE_SINGLE_FS_TYPE and it should print a big fat warning that it's
> > > only for development purposes.

> > Well, LTP_SINGLE_FS_TYPE already has "Testing only"

> That was maybe how we intended it but we exposed the API and it seems
> that there is a usecase for it so people are possibly using it.

> > and that was the reason it just forced filesystem regardless "skip"
> > setup. Sure, we can turn it into "normal" variable and introduce
> > LTP_FORCE_SINGLE_FS_TYPE if it's needed.  But that would be an use
> > case if anybody uses LTP really to test particular filesystem. And it
> > would affect only .all_filesystem tests (e.g. user's responsibility
> > would be to point TMPDIR to that particular system on non-
> > .all_filesystem tests).

> There is a usecase we haven't figured out, when you want to test a
> single filesystem, you do not want to waste time on the rest of the
> filesystems and LTP_SINGlE_FS_TYPE nearly works for that usecase.

Yes, I understood this use case, this was probably the reason of this PR.
I'd appreciate Zorro's confirmation we understood him properly (e.g. that
somebody really needs this). I suppose you vote for this feature anyway
and it's fairly simple, thus I can prepare it.

Kind regards,
Petr
Zorro Lang Dec. 9, 2024, 5:53 a.m. UTC | #8
On Mon, Dec 02, 2024 at 03:42:08PM +0100, Petr Vorel wrote:
> > Hi!
> > > The code to skip filesystems in the case of all filesystems is in the
> > > run_tcase_per_fs() function:
> 
> > > static int run_tcases_per_fs(void)
> > > {
> > >         int ret = 0;
> > >         unsigned int i;
> > >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);
> 
> > > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > > function which filters out them.
> 
> > Perhaps you mean that the skiplist does not work with .all_filesystems
> > _and_ the LTP_SINGLE_FS_TYPE environment variable?
> 
> > I guess that we need:
> 
> > diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> > index bbbb8df19..49b1d7205 100644
> > --- a/lib/tst_supported_fs_types.c
> > +++ b/lib/tst_supported_fs_types.c
> > @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)
> 
> >         if (only_fs) {
> >                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > +
> > +               if (tst_fs_in_skiplist(only_fs, skiplist))
> > +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> > +
> 
> It's a nice feature to be able to force testing on filesystem even it's set to
> be skipped without need to manually enable the filesystem and recompile.
> (It helps testing with LTP compiled as a package without need to compile LTP.)
> Therefore I would avoid this.
> 
> @Zorro Lang or are you testing whole syscalls on particular filesystem via
> LTP_SINGLE_FS_TYPE=xfs ?

Oh, yes, I always use LTP with different LTP_SINGLE_FS_TYPE. So that's might be
the problem?

Thanks,
Zorro

> 
> Kind regards,
> Petr
> 
> >                 if (tst_fs_is_supported(only_fs))
> >                         fs_types[0] = only_fs;
> >                 return fs_types;
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Petr Vorel Dec. 9, 2024, 6:14 a.m. UTC | #9
> On Mon, Dec 02, 2024 at 03:42:08PM +0100, Petr Vorel wrote:
> > > Hi!
> > > > The code to skip filesystems in the case of all filesystems is in the
> > > > run_tcase_per_fs() function:

> > > > static int run_tcases_per_fs(void)
> > > > {
> > > >         int ret = 0;
> > > >         unsigned int i;
> > > >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);

> > > > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > > > function which filters out them.

> > > Perhaps you mean that the skiplist does not work with .all_filesystems
> > > _and_ the LTP_SINGLE_FS_TYPE environment variable?

> > > I guess that we need:

> > > diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> > > index bbbb8df19..49b1d7205 100644
> > > --- a/lib/tst_supported_fs_types.c
> > > +++ b/lib/tst_supported_fs_types.c
> > > @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)

> > >         if (only_fs) {
> > >                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > > +
> > > +               if (tst_fs_in_skiplist(only_fs, skiplist))
> > > +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> > > +

> > It's a nice feature to be able to force testing on filesystem even it's set to
> > be skipped without need to manually enable the filesystem and recompile.
> > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > Therefore I would avoid this.

> > @Zorro Lang or are you testing whole syscalls on particular filesystem via
> > LTP_SINGLE_FS_TYPE=xfs ?

> Oh, yes, I always use LTP with different LTP_SINGLE_FS_TYPE. So that's might be
> the problem?

Thanks for confirming your use case.

Well, "Testing only" in the help (-h) was added there to suggest it's for
testing/debugging LTP, not a production testing. But newer mind, I'll implement
Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.

We could allow more filesystems, e.g.  instead of running LTP few times with
different LTP_SINGLE_FS_TYPE value: e.g.

for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done

we could introduce support for particular filesystems
LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02

(Probably define new variable because "SINGLE" is misleading when supporting
more filesystems. Also when we touch it, I would consider renaming variable
FILESYSTEMS is more obvious for newcomers than "FS_TYPE".)

WDYT?

Kind regards,
Petr

> Thanks,
> Zorro
Zorro Lang Dec. 9, 2024, 9:49 a.m. UTC | #10
On Mon, Dec 09, 2024 at 07:14:16AM +0100, Petr Vorel wrote:
> > On Mon, Dec 02, 2024 at 03:42:08PM +0100, Petr Vorel wrote:
> > > > Hi!
> > > > > The code to skip filesystems in the case of all filesystems is in the
> > > > > run_tcase_per_fs() function:
> 
> > > > > static int run_tcases_per_fs(void)
> > > > > {
> > > > >         int ret = 0;
> > > > >         unsigned int i;
> > > > >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);
> 
> > > > > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > > > > function which filters out them.
> 
> > > > Perhaps you mean that the skiplist does not work with .all_filesystems
> > > > _and_ the LTP_SINGLE_FS_TYPE environment variable?
> 
> > > > I guess that we need:
> 
> > > > diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> > > > index bbbb8df19..49b1d7205 100644
> > > > --- a/lib/tst_supported_fs_types.c
> > > > +++ b/lib/tst_supported_fs_types.c
> > > > @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)
> 
> > > >         if (only_fs) {
> > > >                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > > > +
> > > > +               if (tst_fs_in_skiplist(only_fs, skiplist))
> > > > +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> > > > +
> 
> > > It's a nice feature to be able to force testing on filesystem even it's set to
> > > be skipped without need to manually enable the filesystem and recompile.
> > > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > > Therefore I would avoid this.
> 
> > > @Zorro Lang or are you testing whole syscalls on particular filesystem via
> > > LTP_SINGLE_FS_TYPE=xfs ?
> 
> > Oh, yes, I always use LTP with different LTP_SINGLE_FS_TYPE. So that's might be
> > the problem?
> 
> Thanks for confirming your use case.
> 
> Well, "Testing only" in the help (-h) was added there to suggest it's for
> testing/debugging LTP, not a production testing. But newer mind, I'll implement
> Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.
> 
> We could allow more filesystems, e.g.  instead of running LTP few times with
> different LTP_SINGLE_FS_TYPE value: e.g.
> 
> for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done
> 
> we could introduce support for particular filesystems
> LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02
> 
> (Probably define new variable because "SINGLE" is misleading when supporting
> more filesystems. Also when we touch it, I would consider renaming variable
> FILESYSTEMS is more obvious for newcomers than "FS_TYPE".)
> 
> WDYT?

I generally mount a known filesystem on /mnt/ltpdir, and specify "-d /mnt/ltpdir"
(to be TMPDIR). Then set (export)
  LTP_SINGLE_FS_TYPE
  LTP_DEV_FS_TYPE
  LTP_BIG_DEV_FS_TYPE
to be the same fs with the one mounted on $TMPDIR. Then run ltp more likes:

  for cmdfile in fs fs_perms_simple syscalls fs_bind fsx mm commands fcntl-locktests fs_readonly ipc io containers cve smoketest syscalls-ipc dio ltp-aiodio.part1 ltp-aiodio.part2 ltp-aiodio.part3 ltp-aiodio.part4 ltp-aio-stress; do
	runltp  -p -d /mnt/ltpdir -b /dev/loop0 -B xfs -z /dev/loop1 -Z xfs -f $cmdfile ...
  done

I do this to test each filesystem in different test jobs. Each test job test one fs.
I think that might make sure all system calls/IOs test on same filesystem, no matter
on TMPDIR or someone device. Am I right? Or I missunderstand something?

Thanks,
Zorro

> 
> Kind regards,
> Petr
> 
> > Thanks,
> > Zorro
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Petr Vorel Dec. 9, 2024, 10:42 a.m. UTC | #11
> On Mon, Dec 09, 2024 at 07:14:16AM +0100, Petr Vorel wrote:
> > > On Mon, Dec 02, 2024 at 03:42:08PM +0100, Petr Vorel wrote:
> > > > > Hi!
> > > > > > The code to skip filesystems in the case of all filesystems is in the
> > > > > > run_tcase_per_fs() function:

> > > > > > static int run_tcases_per_fs(void)
> > > > > > {
> > > > > >         int ret = 0;
> > > > > >         unsigned int i;
> > > > > >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);

> > > > > > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > > > > > function which filters out them.

> > > > > Perhaps you mean that the skiplist does not work with .all_filesystems
> > > > > _and_ the LTP_SINGLE_FS_TYPE environment variable?

> > > > > I guess that we need:

> > > > > diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> > > > > index bbbb8df19..49b1d7205 100644
> > > > > --- a/lib/tst_supported_fs_types.c
> > > > > +++ b/lib/tst_supported_fs_types.c
> > > > > @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)

> > > > >         if (only_fs) {
> > > > >                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > > > > +
> > > > > +               if (tst_fs_in_skiplist(only_fs, skiplist))
> > > > > +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> > > > > +

> > > > It's a nice feature to be able to force testing on filesystem even it's set to
> > > > be skipped without need to manually enable the filesystem and recompile.
> > > > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > > > Therefore I would avoid this.

> > > > @Zorro Lang or are you testing whole syscalls on particular filesystem via
> > > > LTP_SINGLE_FS_TYPE=xfs ?

> > > Oh, yes, I always use LTP with different LTP_SINGLE_FS_TYPE. So that's might be
> > > the problem?

> > Thanks for confirming your use case.

> > Well, "Testing only" in the help (-h) was added there to suggest it's for
> > testing/debugging LTP, not a production testing. But newer mind, I'll implement
> > Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.

> > We could allow more filesystems, e.g.  instead of running LTP few times with
> > different LTP_SINGLE_FS_TYPE value: e.g.

> > for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done

> > we could introduce support for particular filesystems
> > LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02

> > (Probably define new variable because "SINGLE" is misleading when supporting
> > more filesystems. Also when we touch it, I would consider renaming variable
> > FILESYSTEMS is more obvious for newcomers than "FS_TYPE".)

> > WDYT?

> I generally mount a known filesystem on /mnt/ltpdir, and specify "-d /mnt/ltpdir"
> (to be TMPDIR). Then set (export)
>   LTP_SINGLE_FS_TYPE
>   LTP_DEV_FS_TYPE
>   LTP_BIG_DEV_FS_TYPE
> to be the same fs with the one mounted on $TMPDIR. Then run ltp more likes:

>   for cmdfile in fs fs_perms_simple syscalls fs_bind fsx mm commands fcntl-locktests fs_readonly ipc io containers cve smoketest syscalls-ipc dio ltp-aiodio.part1 ltp-aiodio.part2 ltp-aiodio.part3 ltp-aiodio.part4 ltp-aio-stress; do
> 	runltp  -p -d /mnt/ltpdir -b /dev/loop0 -B xfs -z /dev/loop1 -Z xfs -f $cmdfile ...
>   done

> I do this to test each filesystem in different test jobs. Each test job test one fs.
> I think that might make sure all system calls/IOs test on same filesystem, no matter
> on TMPDIR or someone device. Am I right? Or I missunderstand something?

IMHO we intended slightly different behavior:

point TMPDIR to the filesystem you are interested in (e.g. /var/tmp for openSUSE
to test Btrfs instead of tmpfs).
Most of the tests are filesystem agnostic (not related to file/filesystem or
using common VFS code), thus this setup is ok (just to avoid testing tmpfs which
is in RAM instead of real block device). Running these tests "manually" for all
filesystems should be waste of time. If you see different results, it might mean
that some system should use .all_filesystems = 1.

These tests where filesystem matters should use .all_filesystems = 1 setup, thus
they run on all available filesystems. You just need to make sure that SUT has
required dependencies (mkfs.* binary and filesystem configured in kernel).

Kind regards,
Petr

> Thanks,
> Zorro


> > Kind regards,
> > Petr

> > > Thanks,
> > > Zorro

> > -- 
> > Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel Dec. 9, 2024, 11:34 a.m. UTC | #12
> On Mon, Dec 09, 2024 at 07:14:16AM +0100, Petr Vorel wrote:
> > > On Mon, Dec 02, 2024 at 03:42:08PM +0100, Petr Vorel wrote:
> > > > > Hi!
> > > > > > The code to skip filesystems in the case of all filesystems is in the
> > > > > > run_tcase_per_fs() function:

> > > > > > static int run_tcases_per_fs(void)
> > > > > > {
> > > > > >         int ret = 0;
> > > > > >         unsigned int i;
> > > > > >         const char *const *filesystems = tst_get_supported_fs_types(tst_test->skip_filesystems);

> > > > > > The skip_filesystems array is passed to the tst_get_supporte_fs_types()
> > > > > > function which filters out them.

> > > > > Perhaps you mean that the skiplist does not work with .all_filesystems
> > > > > _and_ the LTP_SINGLE_FS_TYPE environment variable?

> > > > > I guess that we need:

> > > > > diff --git a/lib/tst_supported_fs_types.c b/lib/tst_supported_fs_types.c
> > > > > index bbbb8df19..49b1d7205 100644
> > > > > --- a/lib/tst_supported_fs_types.c
> > > > > +++ b/lib/tst_supported_fs_types.c
> > > > > @@ -159,6 +159,10 @@ const char **tst_get_supported_fs_types(const char *const *skiplist)

> > > > >         if (only_fs) {
> > > > >                 tst_res(TINFO, "WARNING: testing only %s", only_fs);
> > > > > +
> > > > > +               if (tst_fs_in_skiplist(only_fs, skiplist))
> > > > > +                       tst_brk(TCONF, "Requested filesystems is in test skiplist");
> > > > > +

> > > > It's a nice feature to be able to force testing on filesystem even it's set to
> > > > be skipped without need to manually enable the filesystem and recompile.
> > > > (It helps testing with LTP compiled as a package without need to compile LTP.)
> > > > Therefore I would avoid this.

> > > > @Zorro Lang or are you testing whole syscalls on particular filesystem via
> > > > LTP_SINGLE_FS_TYPE=xfs ?

> > > Oh, yes, I always use LTP with different LTP_SINGLE_FS_TYPE. So that's might be
> > > the problem?

> > Thanks for confirming your use case.

> > Well, "Testing only" in the help (-h) was added there to suggest it's for
> > testing/debugging LTP, not a production testing. But newer mind, I'll implement
> > Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.

> > We could allow more filesystems, e.g.  instead of running LTP few times with
> > different LTP_SINGLE_FS_TYPE value: e.g.

> > for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done

> > we could introduce support for particular filesystems
> > LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02

> > (Probably define new variable because "SINGLE" is misleading when supporting
> > more filesystems. Also when we touch it, I would consider renaming variable
> > FILESYSTEMS is more obvious for newcomers than "FS_TYPE".)

> > WDYT?

> I generally mount a known filesystem on /mnt/ltpdir, and specify "-d /mnt/ltpdir"
> (to be TMPDIR). Then set (export)
>   LTP_SINGLE_FS_TYPE
>   LTP_DEV_FS_TYPE
>   LTP_BIG_DEV_FS_TYPE
> to be the same fs with the one mounted on $TMPDIR. Then run ltp more likes:

>   for cmdfile in fs fs_perms_simple syscalls fs_bind fsx mm commands fcntl-locktests fs_readonly ipc io containers cve smoketest syscalls-ipc dio ltp-aiodio.part1 ltp-aiodio.part2 ltp-aiodio.part3 ltp-aiodio.part4 ltp-aio-stress; do
> 	runltp  -p -d /mnt/ltpdir -b /dev/loop0 -B xfs -z /dev/loop1 -Z xfs -f $cmdfile ...
>   done

NOTE: I recommend you to test kirk [1], the runltp replacement. Output is in
JSON, which is much easier to parse. It also has more features. We should add
some documentation about kirk into LTP documentation.

Kind regards,
Petr

[1] https://github.com/linux-test-project/kirk

> I do this to test each filesystem in different test jobs. Each test job test one fs.
> I think that might make sure all system calls/IOs test on same filesystem, no matter
> on TMPDIR or someone device. Am I right? Or I missunderstand something?

> Thanks,
> Zorro


> > Kind regards,
> > Petr

> > > Thanks,
> > > Zorro

> > -- 
> > Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis Dec. 11, 2024, 12:08 p.m. UTC | #13
Hi!
> Well, "Testing only" in the help (-h) was added there to suggest it's for
> testing/debugging LTP, not a production testing. But newer mind, I'll implement
> Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.
> 
> We could allow more filesystems, e.g.  instead of running LTP few times with
> different LTP_SINGLE_FS_TYPE value: e.g.
> 
> for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done
> 
> we could introduce support for particular filesystems
> LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02

That is stil not equivalent if you run it with a whole LTP. We would
have to run each test that uses device for all LTP_FILESYSTEMS, since
many of the testcases does use device but does not use .all_filesystems.

So all in all I think that LTP_SINGLE_FS_TYPE is good enough solution.

Or we can try to rething the whole thing, but it's getting quite
complicated with all the options we have.
Petr Vorel Dec. 11, 2024, 7:40 p.m. UTC | #14
> Hi!
> > Well, "Testing only" in the help (-h) was added there to suggest it's for
> > testing/debugging LTP, not a production testing. But newer mind, I'll implement
> > Cyril's suggestion, real usage justify it. + I'll add LTP_FORCE_SINGLE_FS_TYPE.

> > We could allow more filesystems, e.g.  instead of running LTP few times with
> > different LTP_SINGLE_FS_TYPE value: e.g.

> > for fs in ext4 xfs btrfs; do LTP_SINGLE_FS_TYPE=fs ioctl_ficlone02; done

> > we could introduce support for particular filesystems
> > LTP_FILESYSTEMS="ext4,xfs,btrfs" ioctl_ficlone02

> That is stil not equivalent if you run it with a whole LTP. We would
> have to run each test that uses device for all LTP_FILESYSTEMS, since
> many of the testcases does use device but does not use .all_filesystems.

> So all in all I think that LTP_SINGLE_FS_TYPE is good enough solution.

> Or we can try to rething the whole thing, but it's getting quite
> complicated with all the options we have.

I guess LTP_SINGLE_FS_TYPE + LTP_FORCE_SINGLE_FS_TYPE LGTM.

What bothers me more how much time we spent with formatting loop device (done
for each test with .all_filesystems several times). Running all tests on single
filesystem, then reformat and run all of them on the other filesystem would be
faster. The only thing which is better on this is theoretical chance that
filesystem gets corrupted by some test, then other tests would be somehow
influenced.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
index fab0daaee..b7f676ec7 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
@@ -57,7 +57,7 @@  static struct tst_test test = {
 	.needs_root = 1,
 	.mount_device = 1,
 	.mntpoint = MNTPOINT,
-	.all_filesystems = 1,
+	.all_filesystems = 0,
 	.skip_filesystems = (const char *[]) {
 		"bcachefs",
 		"btrfs",