Skip to contentSkip to conversation

xfstests: Changed a couple of tests to be generic

PATCH In review Stefan Behrens 4 participants 9 messages Aug 1, 2011 – Aug 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover xfstests: Changed a couple of tests to be generic

Changes v2->v3:
- Merged 3 patches into one.
- Less verbose subject lines.

Changes v1->v2:
- Instead of just adding btrfs to the list of supported filesystems, the 7 tests that are touched by this patch series are now executed for all filesystems (since the tests are generic ones).
- The changes in src/t_immutable.c are revised to make the setting of append-only and immutable flags generic instead of just adding code for btrfs.

This patch series changes the tests 015, 062, 079, 083, 117, 120 and 192 to be generic for all filesystems and to be executed for all filesystems.
For test 079 to run, src/t_immutable.c was also modified to use the new generic FS_IOC_SETFLAGS/FS_IOC_GETFLAGS ioctl() if they are available.

Stefan Behrens (2):
xfstests: make more tests generic
xfstests: make t_immutable and 079 filesystem-agnostic

 015               |    5 ++-
 062               |    4 +-
 062.out           |    6 -----
 079               |   12 +++++++--
 083               |   12 +++++++--
 117               |    4 +-
 120               |    4 +-
 192               |    2 +-
 src/t_immutable.c |   66 +++++++++++++++++-----------------------------------
 9 files changed, 50 insertions(+), 65 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH v3 1/2 xfstests: make more tests generic

Use _scratch_mkfs / _scratch_mkfs_sized instead of _scratch_mkfs_xfs where possible.
Execute 015, 062, 083, 117, 120 and 192 for all filesystems, these tests used to be XFS specific.

---
 015     |    5 +++--
 062     |    4 ++--
 062.out |    6 ------
 083     |   12 +++++++++---
 117     |    4 ++--
 120     |    4 ++--
 192     |    2 +-
 7 files changed, 19 insertions(+), 18 deletions(-)
015 +3 -2
index 8f2be7c..4206b93 100755
@@ -48,13 +48,14 @@ _free()
 }
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
 _require_nobigloopfs
 
-_scratch_mkfs_xfs -d size=50m >/dev/null || _fail "mkfs failed"
+_scratch_mkfs_sized `expr 50 \* 1024 \* 1024` >/dev/null 2>&1 \
+    || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed"
 out=$SCRATCH_MNT/fillup.$$
 rm -f $seq.full
062 +2 -2
index 5cb6f92..a6e4bc8 100755
@@ -71,7 +71,7 @@ _create_test_bed()
 }
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _require_scratch
@@ -80,7 +80,7 @@ _require_attrs
 rm -f $tmp.backup1 $tmp.backup2 $seq.full
 
 # real QA test starts here
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed"
 _create_test_bed
 
062.out +0 -6
index 73fd628..1d5a094 100644
@@ -1,10 +1,4 @@
 QA output created by 062
-meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
-data     = bsize=XXX blocks=XXX, imaxpct=PCT
-         = sunit=XXX swidth=XXX, unwritten=X
-naming   =VERN bsize=XXX
-log      =LDEV bsize=XXX blocks=XXX
-realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
 *** create test bed
 SCRATCH_MNT
 SCRATCH_MNT/dev
083 +9 -3
index 7342baa..441284e 100755
@@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
@@ -72,8 +72,14 @@ workout()
 	umount $SCRATCH_DEV >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz,agcount=$ags"    >>$seq.full
 	echo ""                                     >>$seq.full
-	_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seq.full 2>&1 \
-		|| _fail "size=$fsz,agcount=$ags mkfs failed"
+	if [ $FSTYP = xfs ]
+	then
+		_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seq.full 2>&1 \
+			|| _fail "size=$fsz,agcount=$ags mkfs failed"
+	else
+		_scratch_mkfs_sized $fsz >>$seq.full 2>&1 \
+			|| _fail "size=$fsz mkfs failed"
+	fi
 	_scratch_mount                              >>$seq.full 2>&1 \
 		|| _fail "mount failed"
 
117 +2 -2
index dd880cb..fcf0485 100755
@@ -51,7 +51,7 @@ _cleanup()
 . ./common.attr
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
@@ -62,7 +62,7 @@ rm -f $seq.full
 umount $SCRATCH_DEV >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seq.full
 echo ""                                     >>$seq.full
-_scratch_mkfs_xfs                           >>$seq.full 2>&1 \
+_scratch_mkfs                               >>$seq.full 2>&1 \
     || _fail "mkfs failed"
 _scratch_mount                              >>$seq.full 2>&1 \
     || _fail "mount failed"
120 +2 -2
index bf1e617..010a8f3 100755
@@ -37,11 +37,11 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux IRIX
 
 _require_scratch
-_scratch_mkfs_xfs >/dev/null 2>&1
+_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 
 _compare_access_times()
 {
192 +1 -1
index d8301d5..4b69147 100755
@@ -45,7 +45,7 @@ _access_time()
 
 # real QA test starts here
 
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 #delay=150
 #delay=75
Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH v3 1/2] xfstests: make more tests generic

Hi,

Quoted 4 lines · Stefan Behrens

Use _scratch_mkfs / _scratch_mkfs_sized instead of _scratch_mkfs_xfs where possible.
Execute 015, 062, 083, 117, 120 and 192 for all filesystems, these tests used to be XFS specific.

this patch is now in xfstests-dev and somehow breaks btrfs testing.

$ check 015
015      [failed, exit status 1] - output mismatch (see 015.out.bad)
--- 015.out     2011-02-11 11:42:29.000000000 +0100
+++ 015.out.bad 2011-08-10 17:19:48.000000000 +0200
@@ -1,7 +1,4 @@
 QA output created by 015
-fill disk:
-   !!! disk full (expected)
-check free space:
-delete fill:
-check free space:
-   !!! free space is in range
+mkfs failed
+(see 015.full for details)
+umount: /mnt/sda10: not mounted
$ check 062
--- 062.out     2011-08-10 17:17:23.000000000 +0200
+++ 062.out.bad 2011-08-10 17:20:57.000000000 +0200
@@ -49,10 +49,13 @@
 user.name2=0xcafe

*** remove attribute
-SCRATCH_MNT/reg: user.name2: No such attribute
+# file: SCRATCH_MNT/reg
+user.name2
+
<...long error output...>

$ check 083
083      [failed, exit status 1] - output mismatch (see 083.out.bad)
--- 083.out     2011-02-11 11:42:30.000000000 +0100
+++ 083.out.bad 2011-08-10 17:21:37.000000000 +0200
@@ -1,4 +1,5 @@
 QA output created by 083
 *** test out-of-space handling for random write operations
-*** done
+size=100m mkfs failed
+(see 083.full for details)
 *** unmount

checks 117,120,192 passed

there's a hardcoded path for mkfs.btrfs in common.rc:_scratch_mkfs_sized()

335 btrfs)
336 /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize
337 ;;

I have a /usr/local/ installation of btrfsprogs from git, _scratch_mkfs_sized() was not called for btrfs before.

Possible ways to fix this:
1) use /sbin/mkfs -t $FSTYP like _scratch_mkfs, or
2) set $MKFS_BTRFS_PROG like for some other filesystems

What is preferred?

david

Quoted 159 lines
---
 015     |    5 +++--
 062     |    4 ++--
 062.out |    6 ------
 083     |   12 +++++++++---
 117     |    4 ++--
 120     |    4 ++--
 192     |    2 +-
 7 files changed, 19 insertions(+), 18 deletions(-)
015 +3 -2
index 8f2be7c..4206b93 100755
@@ -48,13 +48,14 @@ _free()
 }
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
 _require_nobigloopfs
 
-_scratch_mkfs_xfs -d size=50m >/dev/null || _fail "mkfs failed"
+_scratch_mkfs_sized `expr 50 \* 1024 \* 1024` >/dev/null 2>&1 \
+    || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed"
 out=$SCRATCH_MNT/fillup.$$
 rm -f $seq.full
062 +2 -2
index 5cb6f92..a6e4bc8 100755
@@ -71,7 +71,7 @@ _create_test_bed()
 }
 
 # real QA test starts here
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 
 _require_scratch
@@ -80,7 +80,7 @@ _require_attrs
 rm -f $tmp.backup1 $tmp.backup2 $seq.full
 
 # real QA test starts here
-_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed"
 _create_test_bed
 
062.out +0 -6
index 73fd628..1d5a094 100644
@@ -1,10 +1,4 @@
 QA output created by 062
-meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
-data     = bsize=XXX blocks=XXX, imaxpct=PCT
-         = sunit=XXX swidth=XXX, unwritten=X
-naming   =VERN bsize=XXX
-log      =LDEV bsize=XXX blocks=XXX
-realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
 *** create test bed
 SCRATCH_MNT
 SCRATCH_MNT/dev
083 +9 -3
index 7342baa..441284e 100755
@@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
@@ -72,8 +72,14 @@ workout()
 	umount $SCRATCH_DEV >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz,agcount=$ags"    >>$seq.full
 	echo ""                                     >>$seq.full
-	_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seq.full 2>&1 \
-		|| _fail "size=$fsz,agcount=$ags mkfs failed"
+	if [ $FSTYP = xfs ]
+	then
+		_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seq.full 2>&1 \
+			|| _fail "size=$fsz,agcount=$ags mkfs failed"
+	else
+		_scratch_mkfs_sized $fsz >>$seq.full 2>&1 \
+			|| _fail "size=$fsz mkfs failed"
+	fi
 	_scratch_mount                              >>$seq.full 2>&1 \
 		|| _fail "mount failed"
 
117 +2 -2
index dd880cb..fcf0485 100755
@@ -51,7 +51,7 @@ _cleanup()
 . ./common.attr
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _setup_testdir
@@ -62,7 +62,7 @@ rm -f $seq.full
 umount $SCRATCH_DEV >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seq.full
 echo ""                                     >>$seq.full
-_scratch_mkfs_xfs                           >>$seq.full 2>&1 \
+_scratch_mkfs                               >>$seq.full 2>&1 \
     || _fail "mkfs failed"
 _scratch_mount                              >>$seq.full 2>&1 \
     || _fail "mount failed"
120 +2 -2
index bf1e617..010a8f3 100755
@@ -37,11 +37,11 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 . ./common.filter
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux IRIX
 
 _require_scratch
-_scratch_mkfs_xfs >/dev/null 2>&1
+_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 
 _compare_access_times()
 {
192 +1 -1
index d8301d5..4b69147 100755
@@ -45,7 +45,7 @@ _access_time()
 
 # real QA test starts here
 
-_supported_fs xfs udf nfs
+_supported_fs generic
 _supported_os Linux
 #delay=150
 #delay=75
Signature · 6 lines
1.7.3.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw

Re: [PATCH v3 1/2] xfstests: make more tests generic

Quoted 9 lines · David Sterba

there's a hardcoded path for mkfs.btrfs in common.rc:_scratch_mkfs_sized()

335 btrfs)
336 /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize
337 ;;

I have a /usr/local/ installation of btrfsprogs from git, _scratch_mkfs_sized() was not called for btrfs before.

Quoted 6 lines

Possible ways to fix this:
1) use /sbin/mkfs -t $FSTYP like _scratch_mkfs, or
2) set $MKFS_BTRFS_PROG like for some other filesystems

What is preferred?

Please send a patch for variant 2. As soon as we have option using the generic mkfs wrapper sounds like a good idea. In addition to that treating btrfs the same way as other filesystems is always good.

#4 lore raw

Re: [PATCH v3 1/2] xfstests: make more tests generic

Quoted 15 lines · Christoph Hellwig
Quoted 14 lines · David Sterba

there's a hardcoded path for mkfs.btrfs in common.rc:_scratch_mkfs_sized()

335 btrfs)
336 /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize
337 ;;

I have a /usr/local/ installation of btrfsprogs from git, _scratch_mkfs_sized() was not called for btrfs before.

Possible ways to fix this:
1) use /sbin/mkfs -t $FSTYP like _scratch_mkfs, or
2) set $MKFS_BTRFS_PROG like for some other filesystems

Quoted 5 lines
Quoted 1 line

What is preferred?

Please send a patch for variant 2. As soon as we have option using the generic mkfs wrapper sounds like a good idea. In addition to that treating btrfs the same way as other filesystems is always good.

Whoops, we gave different answers. Do what Christoph says... -Alex

#5 lore raw

Re: [PATCH v3 1/2] xfstests: make more tests generic

In reply to David Sterba
Quoted 9 lines · David Sterba

Hi,

Quoted 4 lines · Stefan Behrens

Use _scratch_mkfs / _scratch_mkfs_sized instead of _scratch_mkfs_xfs where possible.
Execute 015, 062, 083, 117, 120 and 192 for all filesystems, these tests used to be XFS specific.

this patch is now in xfstests-dev and somehow breaks btrfs testing.

. . .

Quoted 9 lines

there's a hardcoded path for mkfs.btrfs in common.rc:_scratch_mkfs_sized()

335 btrfs)
336 /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize
337 ;;

I have a /usr/local/ installation of btrfsprogs from git, _scratch_mkfs_sized() was not called for btrfs before.

Quoted 6 lines

Possible ways to fix this:
1) use /sbin/mkfs -t $FSTYP like _scratch_mkfs, or
2) set $MKFS_BTRFS_PROG like for some other filesystems

What is preferred?

Whatever works. My personal preference would be option (1) if it works, since it's does the generic thing directly rather than suggesting something special is needed for btrfs. But if that doesn't work, consistency rules so MKFS_BTRFS_PROG "like for some other filesystems" is good.

-Alex

#6 lore raw

Re: [PATCH v3 1/2] xfstests: make more tests generic

Quoted 5 lines · Alex Elder
Quoted 5 lines

Possible ways to fix this:
1) use /sbin/mkfs -t $FSTYP like _scratch_mkfs, or
2) set $MKFS_BTRFS_PROG like for some other filesystems

Quoted 7 lines
Quoted 1 line

What is preferred?

Whatever works. My personal preference would be option (1) if it works, since it's does the generic thing directly rather than suggesting something special is needed for btrfs. But if that doesn't work, consistency rules so MKFS_BTRFS_PROG "like for some other filesystems" is good.

Normally I'd agree with you, but I've run into problems with the generic mkfs binary, as it parses some options that might otherwise be left to the filesystem. E.g. it parses -l by itself, which causes problems when creating an xfs filesystem with an external log.

Note that any filesystem supported by _scratch_mkfs_sized is special; there is no generic way to specify the size of a filesystem.

#7 lore raw

PATCH v3 2/2 xfstests: make t_immutable and 079 filesystem-agnostic

In reply to Stefan Behrens

Changed the test 079 to be generic for all filesystems and to be executed for all filesystems.
In src/t_immutable.c which is compiled for Linux only, replaced the old style XFS and ext2 specific code for setting the append-only and immutable flags by generic code that makes use of the ioctl(FS_IOC_SETFLAGS) and ioctl(FS_IOC_GETFLAGS). Therefore the check for the specific filesystem type was removed. FS_IOC_GETFLAGS/FS_IOC_SETFLAGS is always used. This code is inside an '#ifdef FS_IOC_SETFLAGS' block in order to never fail compilation. Without support for FS_IOC_SETFLAGS, the test completes with _notrun.

---
 079               |   12 +++++++--
 src/t_immutable.c |   66 +++++++++++++++++-----------------------------------
 2 files changed, 31 insertions(+), 47 deletions(-)
079 +9 -3
index 6c43fe7..8f6e179 100755
@@ -46,7 +46,7 @@ _cleanup()
 . ./common.filter
 . ./common.attr
 
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 
 _require_attrs
@@ -55,10 +55,16 @@ _require_scratch
 [ -x $timmutable ] || _notrun "t_immutable was not built for this platform"
 
 # real QA test starts here
-_scratch_mkfs_xfs 2>&1 >/dev/null || _fail "mkfs failed"
+_scratch_mkfs >/dev/null 2>&1 || _fail "mkfs failed"
 _scratch_mount || _fail "mount failed"
 
 echo "*** starting up"
-$timmutable -c $SCRATCH_MNT/$seq
+$timmutable -c $SCRATCH_MNT/$seq >$tmp.out 2>&1
+if grep -q 'Operation not supported' $tmp.out; then
+    rm -f $tmp.out
+    _notrun "Setting immutable/append flag not supported"
+fi
+cat $tmp.out
+rm -f $tmp.out
 status=$?
 exit
src/t_immutable.c +22 -44

85 lines not on this page · raw message

Signature · 1 line
1.7.3.4