public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: fstests@vger.kernel.org
Cc: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH 3/7] filter: add support for old filefrag -v
Date: Mon, 21 Jan 2019 11:33:12 -0500	[thread overview]
Message-ID: <20190121163316.20616-3-jeffm@suse.com> (raw)
In-Reply-To: <20190121163316.20616-1-jeffm@suse.com>

From: Jeff Mahoney <jeffm@suse.com>

e2fsprogs versions prior to v1.42.7 had a different format for
filefrag -v that is incompatible with the regex in _filefrag_filter.

This patch adds support for the older format to test on older releases

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 common/filter | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/common/filter b/common/filter
index b4443a34..a8ddf571 100644
--- a/common/filter
+++ b/common/filter
@@ -528,13 +528,27 @@ _filter_filefrag()
 {
 	perl -ne '
 	if (/blocks? of (\d+) bytes/) {
+		$oldfmt = 0;
 		$blocksize = $1;
-		next
+		next;
+	} elsif (/\d+ blocks, blocksize (\d+)/) {
+		$oldfmt = 1;
+		$blocksize = $1;
+		next;
+	}
+	if ($oldfmt) {
+		chomp;
+		($ext, $logical, $physical, $ignore, $length1, $length2, $flags) =
+			(/^\s*(\d+)\s+(\d+)\s+(\d+)\s+((\d+)|\d+\s+(\d+))\s+([a-z0-9,]*)$/)
+		or next;
+		$length = "$length1$length2";
+	} else {
+		($ext, $logical, $physical, $length) =
+			(/^\s*(\d+):\s+(\d+)\.\.\s*\d+:\s+(\d+)\.\.\s*\d+:\s+(\d+):/)
+		or next;
+		($flags) = /.*:\s*(\S*)$/;
 	}
-	($ext, $logical, $physical, $length) =
-		(/^\s*(\d+):\s+(\d+)\.\.\s*\d+:\s+(\d+)\.\.\s*\d+:\s+(\d+):/)
-	or next;
-	($flags) = /.*:\s*(\S*)$/;
+
 	print $physical * $blocksize, "#",
 	      $length * $blocksize, "#",
 	      $logical * $blocksize, "#",
-- 
2.16.4

  parent reply	other threads:[~2019-01-21 16:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 16:33 [PATCH 1/7] btrfs/010: don't run without /sys/fs/btrfs jeffm
2019-01-21 16:33 ` [PATCH 2/7] filter: fix assumed whitespace in _filefrag_filter regex jeffm
2019-01-21 22:51   ` Dave Chinner
2019-01-23  1:38     ` Jeff Mahoney
2019-01-23  4:16       ` Dave Chinner
2019-01-21 16:33 ` jeffm [this message]
2019-01-21 22:53   ` [PATCH 3/7] filter: add support for old filefrag -v Dave Chinner
2019-01-23  1:38     ` Jeff Mahoney
2019-01-21 16:33 ` [PATCH 4/7] btrfs: require feature raid56 for raid56 tests jeffm
2019-01-22 22:39   ` Filipe Manana
2019-01-21 16:33 ` [PATCH 5/7] btrfs/023: skip trying to test raid56 without kernel support jeffm
2019-01-22 22:40   ` Filipe Manana
2019-01-21 16:33 ` [PATCH 6/7] btrfs/131: require support for free-space-tree jeffm
2019-01-22 22:41   ` Filipe Manana
2019-01-21 16:33 ` [PATCH 7/7] check: move test exclusion handling to _prepare_test_list jeffm
2019-01-21 23:09   ` Dave Chinner
2019-01-23  1:59     ` Jeff Mahoney
2019-01-22 22:38 ` [PATCH 1/7] btrfs/010: don't run without /sys/fs/btrfs Filipe Manana

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=20190121163316.20616-3-jeffm@suse.com \
    --to=jeffm@suse.com \
    --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