public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: xfs@oss.sgi.com
Cc: Eryu Guan <eguan@redhat.com>
Subject: [PATCH] xfstests generic/260: get correct trimmed bytes
Date: Thu,  3 Oct 2013 19:57:17 +0800	[thread overview]
Message-ID: <1380801437-1191-1-git-send-email-eguan@redhat.com> (raw)

Newer fstrim(1) reports trimmed bytes differently, e.g.

new fstrim: /mnt/ext4: 9.7 GiB (10411118592 bytes) trimmed
old fstrim: /mnt/ext4: 10411118592 bytes were trimmed

generic/260 reports syntax error

    +./tests/generic/260: line 111: [: 9.7: integer expression expected
    +./tests/generic/260: line 121: [: 9.7: integer expression expected
    +./tests/generic/260: line 183: [: 9.7: integer expression expected

Fix it so 260 passes with both old and new fstrim.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/generic/260 | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tests/generic/260 b/tests/generic/260
index dc8b822..bc9eb3b 100755
--- a/tests/generic/260
+++ b/tests/generic/260
@@ -104,9 +104,8 @@ _scratch_mount
 # This is a bit fuzzy, but since the file system is fresh
 # there should be at least (fssize/2) free space to trim.
 # This is supposed to catch wrong FITRIM argument handling
-out=$($FSTRIM_PROG -v -o10M $SCRATCH_MNT)
-nopref=${out##*: }
-bytes=${nopref%% *}
+out=$($FSTRIM_PROG -v -o10M $SCRATCH_MNT | egrep -o "[0-9]+ bytes")
+bytes=${out%% *}
 
 if [ $bytes -gt $(_math "$fssize*1024") ]; then
 	status=1
@@ -177,9 +176,8 @@ _scratch_mount
 # It is because btrfs does not have not-yet-used parts of the device
 # mapped and since we got here right after the mkfs, there is not
 # enough free extents in the root tree.
-out=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT)
-nopref=${out##*: }
-bytes=${nopref%% *}
+out=$($FSTRIM_PROG -v -l$len $SCRATCH_MNT | egrep -o "[0-9]+ bytes")
+bytes=${out%% *}
 if [ $bytes -le $(_math "$fssize*512") ] && [ $FSTYP != "btrfs" ]; then
 	status=1
 	echo "It seems that fs logic handling len argument overflows"
-- 
1.8.3.1

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

             reply	other threads:[~2013-10-03 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 11:57 Eryu Guan [this message]
2013-10-04  1:07 ` [PATCH] xfstests generic/260: get correct trimmed bytes Dave Chinner
2013-10-04  6:32   ` [PATCH v2] " Eryu Guan
2013-10-08  0:45     ` Dave Chinner
2013-10-16 20:20     ` Rich Johnston

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=1380801437-1191-1-git-send-email-eguan@redhat.com \
    --to=eguan@redhat.com \
    --cc=xfs@oss.sgi.com \
    /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