From patchwork Mon Jan 21 16:33:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10774189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 698BD139A for ; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A3DE2970C for ; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ED712990C; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D526229385 for ; Mon, 21 Jan 2019 16:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730522AbfAUQdt (ORCPT ); Mon, 21 Jan 2019 11:33:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:46336 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730171AbfAUQdo (ORCPT ); Mon, 21 Jan 2019 11:33:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 83757AFB5 for ; Mon, 21 Jan 2019 16:33:43 +0000 (UTC) Received: from starscream.home.jeffm.io (starscream-1.home.jeffm.io [192.168.1.254]) by mail.home.jeffm.io (Postfix) with ESMTPS id 96FC281AD3DF; Mon, 21 Jan 2019 11:31:58 -0500 (EST) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id 307E6265DA9; Mon, 21 Jan 2019 11:33:42 -0500 (EST) From: jeffm@suse.com To: fstests@vger.kernel.org Cc: Jeff Mahoney Subject: [PATCH 3/7] filter: add support for old filefrag -v Date: Mon, 21 Jan 2019 11:33:12 -0500 Message-Id: <20190121163316.20616-3-jeffm@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190121163316.20616-1-jeffm@suse.com> References: <20190121163316.20616-1-jeffm@suse.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Mahoney 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 --- 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, "#",