Message ID | 20230110082924.1687152-1-johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs/012: check if ext4 is available | expand |
Hi, > btrfs/012 is requiring ext4 support to test the conversion, but the test > case is only checking if mkfs.ext4 is available, not if the filesystem > driver is actually available on the test host. > > Check if the driver is available as well, before trying to run the test. > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > --- > tests/btrfs/012 | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tests/btrfs/012 b/tests/btrfs/012 > index 60461a342545..86fbbb7ac189 100755 > --- a/tests/btrfs/012 > +++ b/tests/btrfs/012 > @@ -32,6 +32,8 @@ _require_command "$E2FSCK_PROG" e2fsck > _require_non_zoned_device "${SCRATCH_DEV}" > _require_loop > > +grep -q ext4 /proc/filesystems || _notrun "no ext4 support" when ext4 is module, and is not used, 'ext4' will not be in /proc/filesystems. so we need a right way to check ext4 support. Best Regards Wang Yugui (wangyugui@e16-tech.com) 2023/01/10
On Tue, Jan 10, 2023 at 07:23:22PM +0800, Wang Yugui wrote: > Hi, > > > btrfs/012 is requiring ext4 support to test the conversion, but the test > > case is only checking if mkfs.ext4 is available, not if the filesystem > > driver is actually available on the test host. > > > > Check if the driver is available as well, before trying to run the test. > > > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > > --- > > tests/btrfs/012 | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/tests/btrfs/012 b/tests/btrfs/012 > > index 60461a342545..86fbbb7ac189 100755 > > --- a/tests/btrfs/012 > > +++ b/tests/btrfs/012 > > @@ -32,6 +32,8 @@ _require_command "$E2FSCK_PROG" e2fsck > > _require_non_zoned_device "${SCRATCH_DEV}" > > _require_loop > > > > +grep -q ext4 /proc/filesystems || _notrun "no ext4 support" > > when ext4 is module, and is not used, 'ext4' will not be in /proc/filesystems. Really? Actually I'm not sure about that. There's an existing helper in common/rc named _require_extra_fs(). Which we usually used to check if a secondary filesystem is supported by the current kernel. Likes: $ grep -rsn _require_extra_fs tests/ tests/generic/631:42:_require_extra_fs overlay tests/generic/699:26:_require_extra_fs overlay tests/overlay/025:36:_require_extra_fs tmpfs tests/overlay/106:22:_require_extra_fs tmpfs tests/overlay/107:22:_require_extra_fs tmpfs tests/overlay/108:22:_require_extra_fs tmpfs tests/overlay/109:22:_require_extra_fs tmpfs tests/xfs/049:43:_require_extra_fs ext2 Thanks, Zorro > > so we need a right way to check ext4 support. > > Best Regards > Wang Yugui (wangyugui@e16-tech.com) > 2023/01/10 >
On Tue, 10 Jan 2023 22:12:23 +0800, Zorro Lang wrote: > On Tue, Jan 10, 2023 at 07:23:22PM +0800, Wang Yugui wrote: > > Hi, > > > > > btrfs/012 is requiring ext4 support to test the conversion, but the test > > > case is only checking if mkfs.ext4 is available, not if the filesystem > > > driver is actually available on the test host. > > > > > > Check if the driver is available as well, before trying to run the test. > > > > > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > > > --- > > > tests/btrfs/012 | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/tests/btrfs/012 b/tests/btrfs/012 > > > index 60461a342545..86fbbb7ac189 100755 > > > --- a/tests/btrfs/012 > > > +++ b/tests/btrfs/012 > > > @@ -32,6 +32,8 @@ _require_command "$E2FSCK_PROG" e2fsck > > > _require_non_zoned_device "${SCRATCH_DEV}" > > > _require_loop > > > > > > +grep -q ext4 /proc/filesystems || _notrun "no ext4 support" > > > > when ext4 is module, and is not used, 'ext4' will not be in /proc/filesystems. > > Really? Actually I'm not sure about that. There's an existing helper in > common/rc named _require_extra_fs(). Which we usually used to check if > a secondary filesystem is supported by the current kernel. Likes: Yes, if the ext4 kmod is not loaded then it won't appear in /proc/filesystems. _require_extra_fs should work, as it calls modprobe before checking /proc/filesystems. Cheers, David
On 10.01.23 15:12, Zorro Lang wrote: > On Tue, Jan 10, 2023 at 07:23:22PM +0800, Wang Yugui wrote: >> Hi, >> >>> btrfs/012 is requiring ext4 support to test the conversion, but the test >>> case is only checking if mkfs.ext4 is available, not if the filesystem >>> driver is actually available on the test host. >>> >>> Check if the driver is available as well, before trying to run the test. >>> >>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> >>> --- >>> tests/btrfs/012 | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/tests/btrfs/012 b/tests/btrfs/012 >>> index 60461a342545..86fbbb7ac189 100755 >>> --- a/tests/btrfs/012 >>> +++ b/tests/btrfs/012 >>> @@ -32,6 +32,8 @@ _require_command "$E2FSCK_PROG" e2fsck >>> _require_non_zoned_device "${SCRATCH_DEV}" >>> _require_loop >>> >>> +grep -q ext4 /proc/filesystems || _notrun "no ext4 support" >> >> when ext4 is module, and is not used, 'ext4' will not be in /proc/filesystems. > > Really? Actually I'm not sure about that. There's an existing helper in > common/rc named _require_extra_fs(). Which we usually used to check if > a secondary filesystem is supported by the current kernel. Likes: > > $ grep -rsn _require_extra_fs tests/ > tests/generic/631:42:_require_extra_fs overlay > tests/generic/699:26:_require_extra_fs overlay > tests/overlay/025:36:_require_extra_fs tmpfs > tests/overlay/106:22:_require_extra_fs tmpfs > tests/overlay/107:22:_require_extra_fs tmpfs > tests/overlay/108:22:_require_extra_fs tmpfs > tests/overlay/109:22:_require_extra_fs tmpfs > tests/xfs/049:43:_require_extra_fs ext2 Ha that helper is what I was looking for, but couldn't find it.
diff --git a/tests/btrfs/012 b/tests/btrfs/012 index 60461a342545..86fbbb7ac189 100755 --- a/tests/btrfs/012 +++ b/tests/btrfs/012 @@ -32,6 +32,8 @@ _require_command "$E2FSCK_PROG" e2fsck _require_non_zoned_device "${SCRATCH_DEV}" _require_loop +grep -q ext4 /proc/filesystems || _notrun "no ext4 support" + BLOCK_SIZE=`_get_block_size $TEST_DIR` # Create & populate an ext4 filesystem
btrfs/012 is requiring ext4 support to test the conversion, but the test case is only checking if mkfs.ext4 is available, not if the filesystem driver is actually available on the test host. Check if the driver is available as well, before trying to run the test. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- tests/btrfs/012 | 2 ++ 1 file changed, 2 insertions(+)