Skip to contentSkip to conversation

xfstests: handle xfs_quota output w/ long devicenames

PATCH In review Eric Sandeen 3 participants 3 messages Oct 6, 2013 – Oct 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: handle xfs_quota output w/ long devicenames

Long device names may be split onto their own line on quota output:

Filesystem Blocks Quota Limit Warn/Time Mounted on
/dev/mapper/my-very-very-very-long-devicename

                48M      0      0  00 [------] /mnt/scratch

which breaks tests that capture quota output - currently, only xfs/108.

Add a _filter_quota() which fixes this.

---

common/filter +9 -0
index 066b353..a0d9d2a 100644
@@ -240,6 +240,15 @@ _filter_spaces()
        sed -e 's/ [ ]*/ /g'
 }
 
+_filter_quota()
+{
+	# Long dev name might be split onto its own line; last
+	# seds remove that newline if present
+	_filter_scratch | _filter_test_dir | _filter_spaces | \
+	sed -e 'N;s/SCRATCH_DEV\n/SCRATCH_DEV/g' | \
+	sed -e 'N;s/TEST_DEV\n/TEST_DEV/g'
+}
+
 # Account for different "ln" failure messages
 _filter_ln()
 {
tests/xfs/108 +3 -3
index 82694f1..5030f63 100755
@@ -71,9 +71,9 @@ test_accounting()
 	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
-	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_scratch | _filter_spaces
-	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_scratch | _filter_spaces
-	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_scratch | _filter_spaces
+	xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_quota
+	xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_quota
+	xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_quota
 }
 
 export MOUNT_OPTIONS="-opquota"

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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Sandeen

Long device names may be split onto their own line on quota output:

Filesystem Blocks Quota Limit Warn/Time Mounted on
/dev/mapper/my-very-very-very-long-devicename

                48M      0      0  00 [------] /mnt/scratch

which breaks tests that capture quota output - currently, only xfs/107.

xfs/108?

Quoted 1 line

Add a _filter_quota() which fixes this.

Is this necessary for any other tests? I notice some have their own filters (e.g. xfs/106), but AFAICT none of them handle wraped lines...

Quoted 10 lines

---

common/filter +0 -0
index 066b353..a0d9d2a 100644

common/filter _filter_spaces() · line 249

Quoted 10 lines
common/filter +7 -0
@@ -240,6 +240,15 @@ _filter_spaces()
        sed -e 's/ [ ]*/ /g'
 }
 
+_filter_quota()
+{
+	# Long dev name might be split onto its own line; last
+	# seds remove that newline if present
+	_filter_scratch | _filter_test_dir | _filter_spaces | \
+	sed -e 'N;s/SCRATCH_DEV\n/SCRATCH_DEV/g' | \
+	sed -e 'N;s/TEST_DEV\n/TEST_DEV/g'

A bit messy, but given that we need to filter SCRATCH_MNT and TEST_DIR as well I can't see a much more obvious way to do it. I can think of plenty of line noise equivalents that are much shorter and more concise, but the comments explaining it would be longer than the above method. ;) So:

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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