public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: fstests@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH 2/3] generic/382: Fix test when report uses /etc/passwd
Date: Mon, 14 May 2018 19:03:50 +0200	[thread overview]
Message-ID: <20180514170351.13737-3-jack@suse.cz> (raw)
In-Reply-To: <20180514170351.13737-1-jack@suse.cz>

On older kernels xfs_quota uses /etc/passwd to report quota entries. In
such case all-zero lines disturb its output and the test fails. Fix the
problem by ignoring all-zero lines in quota report.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 common/filter     | 8 ++++++++
 tests/generic/382 | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/common/filter b/common/filter
index 53874a08f5e3..037799e5cd19 100644
--- a/common/filter
+++ b/common/filter
@@ -344,6 +344,14 @@ _filter_project_quota()
 	_filter_quota | grep -v "^\#0 \|^(null) "
 }
 
+_filter_quota_report()
+{
+	# When xfs_quota uses /etc/passwd for reporting, it may report lines
+	# full of zeros. Ignore them.
+	grep -v -E '^[^ ]+ +0 +0 +0 +00 +\[--------\] +0 +0 +0 +00 +\[--------\]' |
+	grep -v -E '^[^ ]+ +0 +0 +0 +00 +\[--------\]$'
+}
+
 # Account for different "ln" failure messages
 _filter_ln()
 {
diff --git a/tests/generic/382 b/tests/generic/382
index 33326ffa4d1b..02b98a9ef027 100755
--- a/tests/generic/382
+++ b/tests/generic/382
@@ -79,12 +79,12 @@ do_test()
 	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
 	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
 	echo "$qname blocks and inode limit"
-	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_quota_report | _filter_spaces
 
 	## blocks default quota test ##
 	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
 	echo "$qname blocks quota after write 30M data"
-	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_quota_report | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 
@@ -95,7 +95,7 @@ do_test()
 	sync
 
 	echo "$qname inode quota after creating 30 inodes"
-	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_quota_report | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 }
-- 
2.13.6


  parent reply	other threads:[~2018-05-14 17:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 17:03 [PATCH 0/3] Fix various small quota tests issues for ext[234] Jan Kara
2018-05-14 17:03 ` [PATCH 1/3] common/quota: Make project quota handling work for ext2 & ext3 Jan Kara
2018-05-14 17:03 ` Jan Kara [this message]
2018-05-17  2:42   ` [PATCH 2/3] generic/382: Fix test when report uses /etc/passwd Eryu Guan
2018-05-17  9:18     ` Jan Kara
2018-05-17 10:06       ` Jan Kara
2018-05-19 11:45         ` Eryu Guan
2018-05-18  4:02       ` Dave Chinner
2018-05-18  9:07         ` Jan Kara
2018-05-14 17:03 ` [PATCH 3/3] common/quota: Fix _qmount_options for ext4 journalled quotas Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180514170351.13737-3-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=fstests@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox