public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: handle xfs_quota output w/ long devicenames
@ 2013-10-06 22:46 Eric Sandeen
  2013-10-09 22:12 ` Dave Chinner
  2013-10-16 20:33 ` Rich Johnston
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2013-10-06 22:46 UTC (permalink / raw)
  To: xfs-oss

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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---



diff --git a/common/filter b/common/filter
index 066b353..a0d9d2a 100644
--- a/common/filter
+++ b/common/filter
@@ -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()
 {
diff --git a/tests/xfs/108 b/tests/xfs/108
index 82694f1..5030f63 100755
--- a/tests/xfs/108
+++ b/tests/xfs/108
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfstests: handle xfs_quota output w/ long devicenames
  2013-10-06 22:46 [PATCH] xfstests: handle xfs_quota output w/ long devicenames Eric Sandeen
@ 2013-10-09 22:12 ` Dave Chinner
  2013-10-16 20:33 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2013-10-09 22:12 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Sun, Oct 06, 2013 at 05:46:19PM -0500, Eric Sandeen wrote:
> 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?

> 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...

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> 
> 
> diff --git a/common/filter b/common/filter
> index 066b353..a0d9d2a 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -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:

Reviewed-by: Dave Chinner <dchinner@redhat.com>

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfstests: handle xfs_quota output w/ long devicenames
  2013-10-06 22:46 [PATCH] xfstests: handle xfs_quota output w/ long devicenames Eric Sandeen
  2013-10-09 22:12 ` Dave Chinner
@ 2013-10-16 20:33 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Johnston @ 2013-10-16 20:33 UTC (permalink / raw)
  To: Eric Sandeen, xfs-oss

This has been committed.

Thanks
--Rich

commit cd7eb340dd2eded93f41bc096954017e2f9fa58d
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Sun Oct 6 22:46:19 2013 +0000

     xfstests: handle xfs_quota output w/ long devicenames

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-16 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-06 22:46 [PATCH] xfstests: handle xfs_quota output w/ long devicenames Eric Sandeen
2013-10-09 22:12 ` Dave Chinner
2013-10-16 20:33 ` Rich Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox