diff mbox series

[v6,8/8] df01.sh: Convert to TST_ALL_FILESYSTEMS=1

Message ID 20220915093639.2261-9-pvorel@suse.cz
State Accepted
Headers show
Series shell: df01.sh: $TST_ALL_FILESYSTEMS | expand

Commit Message

Petr Vorel Sept. 15, 2022, 9:36 a.m. UTC
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 runtest/commands              |  8 +-------
 runtest/smoketest             |  2 +-
 testcases/commands/df/df01.sh | 28 +++++-----------------------
 3 files changed, 7 insertions(+), 31 deletions(-)

Comments

Cyril Hrubis Sept. 16, 2022, 1:10 p.m. UTC | #1
Hi!
> +TST_ALL_FILESYSTEMS=1
>  TST_CNT=12
>  TST_SETUP=setup
>  TST_TESTFUNC=test
> -TST_OPTS="f:"
> -TST_USAGE=usage
> -TST_PARSE_ARGS=parse_args
>  TST_NEEDS_ROOT=1
> -TST_MOUNT_DEVICE=1

Just looking at this made me realize that for C API ALL_FILESYTEMST does
not imply TST_MOUNT_DEVICE since these functionalities are orthogonal. I
think that it would be better if we had the C API and shell API as close
as possible, hence ALL_FILESYSTEMS should imply only NEEDS_DEVICE and
the MOUNT_DEVICE would stay here.
Cyril Hrubis Sept. 16, 2022, 1:11 p.m. UTC | #2
Hi!
> > +TST_ALL_FILESYSTEMS=1
> >  TST_CNT=12
> >  TST_SETUP=setup
> >  TST_TESTFUNC=test
> > -TST_OPTS="f:"
> > -TST_USAGE=usage
> > -TST_PARSE_ARGS=parse_args
> >  TST_NEEDS_ROOT=1
> > -TST_MOUNT_DEVICE=1
> 
> Just looking at this made me realize that for C API ALL_FILESYTEMST does
> not imply TST_MOUNT_DEVICE since these functionalities are orthogonal. I
> think that it would be better if we had the C API and shell API as close
> as possible, hence ALL_FILESYSTEMS should imply only NEEDS_DEVICE and
> the MOUNT_DEVICE would stay here.

Also with that change:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Petr Vorel Sept. 16, 2022, 1:12 p.m. UTC | #3
> Hi!
> > +TST_ALL_FILESYSTEMS=1
> >  TST_CNT=12
> >  TST_SETUP=setup
> >  TST_TESTFUNC=test
> > -TST_OPTS="f:"
> > -TST_USAGE=usage
> > -TST_PARSE_ARGS=parse_args
> >  TST_NEEDS_ROOT=1
> > -TST_MOUNT_DEVICE=1

> Just looking at this made me realize that for C API ALL_FILESYTEMST does
> not imply TST_MOUNT_DEVICE since these functionalities are orthogonal. I
> think that it would be better if we had the C API and shell API as close
> as possible, hence ALL_FILESYSTEMS should imply only NEEDS_DEVICE and
> the MOUNT_DEVICE would stay here.

OK, I'll keep MOUNT_DEVICE=1 here and we can change it later for both.

Kind regards,
Petr
Petr Vorel Sept. 16, 2022, 8:39 p.m. UTC | #4
> Hi!
> > > +TST_ALL_FILESYSTEMS=1
> > >  TST_CNT=12
> > >  TST_SETUP=setup
> > >  TST_TESTFUNC=test
> > > -TST_OPTS="f:"
> > > -TST_USAGE=usage
> > > -TST_PARSE_ARGS=parse_args
> > >  TST_NEEDS_ROOT=1
> > > -TST_MOUNT_DEVICE=1

> > Just looking at this made me realize that for C API ALL_FILESYTEMST does
> > not imply TST_MOUNT_DEVICE since these functionalities are orthogonal. I
> > think that it would be better if we had the C API and shell API as close
> > as possible, hence ALL_FILESYSTEMS should imply only NEEDS_DEVICE and
> > the MOUNT_DEVICE would stay here.
Good point, thanks! Another reason is that With ALL_FILESYSTEMS implying
TST_MOUNT_DEVICE mkfs01.sh could not use ALL_FILESYSTEMS=1.

Kind regards,
Petr

> Also with that change:

> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/runtest/commands b/runtest/commands
index 8cfad0449..5ec2c3b69 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -14,13 +14,7 @@  ln01_sh ln_tests.sh
 mkdir01_sh mkdir_tests.sh
 mv01_sh mv_tests.sh
 du01_sh du01.sh
-df01_ext2_sh df01.sh -f ext2
-df01_ext3_sh df01.sh -f ext3
-df01_ext4_sh df01.sh -f ext4
-df01_xfs_sh df01.sh -f xfs
-df01_vfat_sh df01.sh -f vfat
-df01_exfat_sh df01.sh -f exfat
-df01_ntfs_sh df01.sh -f ntfs
+df01_sh df01.sh
 mkfs01_sh mkfs01.sh
 mkfs01_ext2_sh mkfs01.sh -f ext2
 mkfs01_ext3_sh mkfs01.sh -f ext3
diff --git a/runtest/smoketest b/runtest/smoketest
index 485f211fb..83eebfe7b 100644
--- a/runtest/smoketest
+++ b/runtest/smoketest
@@ -12,7 +12,7 @@  stat04 symlink01 -T stat04
 utime01A symlink01 -T utime01
 rename01A symlink01 -T rename01
 splice02 splice02 -s 20
-df01_ext4_sh df01.sh -f ext4
+df01_sh df01.sh
 shell_test01 echo "SUCCESS" | shell_pipe01.sh
 ping602 ping02.sh -6
 macsec02 macsec02.sh
diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index 1e86d1c40..9527da214 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -6,35 +6,15 @@ 
 #
 # Test df command with some basic options.
 
+TST_ALL_FILESYSTEMS=1
 TST_CNT=12
 TST_SETUP=setup
 TST_TESTFUNC=test
-TST_OPTS="f:"
-TST_USAGE=usage
-TST_PARSE_ARGS=parse_args
 TST_NEEDS_ROOT=1
-TST_MOUNT_DEVICE=1
-
-usage()
-{
-	cat << EOF
-usage: $0 [-f <ext2|ext3|ext4|vfat|...>]
-
-OPTIONS
--f	Specify the type of filesystem to be built.  If not
-	specified, the default filesystem type (currently ext2)
-	is used.
-EOF
-}
-
-parse_args()
-{
-	TST_FS_TYPE="$2"
-}
 
 setup()
 {
-	DF_FS_TYPE=$(mount | grep "$TST_DEVICE" | awk 'NR==1{print $5}')
+	DF_FS_TYPE="$(grep -E "$TST_MNTPOINT ($TST_FS_TYPE|fuseblk)" /proc/mounts | awk 'NR==1{print $3}')"
 }
 
 df_test()
@@ -180,7 +160,9 @@  test11()
 
 test12()
 {
-	local cmd="df -x $DF_FS_TYPE -P"
+	local fs="$DF_FS_TYPE"
+
+	local cmd="df -x $fs -P"
 
 	df_verify $cmd
 	if [ $? -ne 0 ]; then