From patchwork Mon Nov 13 15:50:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10056349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9DEC960365 for ; Mon, 13 Nov 2017 15:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F2B329386 for ; Mon, 13 Nov 2017 15:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83EC32941E; Mon, 13 Nov 2017 15:50:37 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 E4D5A29419 for ; Mon, 13 Nov 2017 15:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbdKMPuf (ORCPT ); Mon, 13 Nov 2017 10:50:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:33507 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753406AbdKMPuf (ORCPT ); Mon, 13 Nov 2017 10:50:35 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9108AAAEF; Mon, 13 Nov 2017 15:50:33 +0000 (UTC) From: Nikolay Borisov To: linux-xfs@vger.kernel.org Cc: fstests@vger.kernel.org, eguan@redhat.com, david@fromorbit.com, darrick.wong@oracle.com, Nikolay Borisov Subject: [PATCH v3 1/2] generic: Adjust generic test outputs for new fiemap imeplementation Date: Mon, 13 Nov 2017 17:50:28 +0200 Message-Id: <1510588229-6079-1-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510588073-5665-1-git-send-email-nborisov@suse.com> References: <1510588073-5665-1-git-send-email-nborisov@suse.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With the new range query support for the fiemap command, the command also started printing hole extent for files which consist of only a hole. So adjust generic test output accordingly. Furthermore, this change breaks tests which are executed with a version of xfs_io that doesn't support fiemap's range query. Fix this by implementing a function which will fixup the output of tests which are broken by emulating the output on older xfs_io versions Signed-off-by: Nikolay Borisov --- V3: * Squash the test adjusments as well as the implementation of fiemap_range_fixup in a single patch * Add coment explaining the need for _fiemap_range_fixup common/punch | 23 +++++++++++++++++++++++ tests/generic/012.out | 1 + tests/generic/016.out | 1 + tests/generic/021.out | 2 ++ tests/generic/022.out | 2 ++ tests/generic/058.out | 1 + tests/generic/060.out | 1 + tests/generic/061.out | 1 + tests/generic/063.out | 1 + tests/generic/255.out | 6 ++++++ tests/generic/316.out | 6 ++++++ 11 files changed, 45 insertions(+) diff --git a/common/punch b/common/punch index c4ed261..9c39183 100644 --- a/common/punch +++ b/common/punch @@ -218,6 +218,27 @@ _filter_fiemap() _coalesce_extents } +#This function allows for tests which print the fiemap of a +#file, that consists of only a hole to pass when executed with +#older versions of xfs_io's fiemap that didn't print anything for +#such files +_fiemap_range_fixup() +{ + #check if we support ranged query + $XFS_IO_PROG -c "help fiemap" | head -n 1 | grep -q "[offset [len]]" + local range_sup=$? + #check if the file consists of a single hole only + echo "$1" | grep -q "^0\: \[.*\]\: hole$" + local sole_hole=$? + local filesize="$(((`stat -c %s $1` / 512) - 1))" + local output_line_num=`$XFS_IO_PROG -c 'fiemap' $testfile | wc -l` + + if [ $range_sup -eq 1 ] && [ $sole_hole -eq 1 ] && [ $output_line_num -eq 1 ] + then + echo "0: [0..$filesize]: hole" + fi +} + _filter_fiemap_flags() { $AWK_PROG ' @@ -363,6 +384,7 @@ _test_generic_punch() $XFS_IO_PROG -f -c "truncate $_20k" \ -c "$zero_cmd $_4k $_8k" \ -c "$map_cmd -v" $testfile | $filter_cmd + _fiemap_range_fixup $testfile [ $? -ne 0 ] && die_now _md5_checksum $testfile @@ -470,6 +492,7 @@ _test_generic_punch() -c "pwrite $_8k $_4k" $sync_cmd \ -c "$zero_cmd $_4k $_12k" \ -c "$map_cmd -v" $testfile | $filter_cmd + _fiemap_range_fixup $testfile [ $? -ne 0 ] && die_now _md5_checksum $testfile diff --git a/tests/generic/012.out b/tests/generic/012.out index ffbf8a3..8045471 100644 --- a/tests/generic/012.out +++ b/tests/generic/012.out @@ -1,5 +1,6 @@ QA output created by 012 1. into a hole +0: [0..95]: hole f4f35d60b3cc18aaa6d8d92f0cd3708a 2. into allocated space 0: [0..95]: extent diff --git a/tests/generic/016.out b/tests/generic/016.out index c45a44a..1371ce7 100644 --- a/tests/generic/016.out +++ b/tests/generic/016.out @@ -1,5 +1,6 @@ QA output created by 016 1. into a hole +0: [0..95]: hole f4f35d60b3cc18aaa6d8d92f0cd3708a 2. into allocated space 0: [0..95]: extent diff --git a/tests/generic/021.out b/tests/generic/021.out index 1137741..791b78a 100644 --- a/tests/generic/021.out +++ b/tests/generic/021.out @@ -1,5 +1,6 @@ QA output created by 021 1. into a hole +0: [0..95]: hole f4f35d60b3cc18aaa6d8d92f0cd3708a 2. into allocated space 0: [0..95]: extent @@ -34,6 +35,7 @@ f4f35d60b3cc18aaa6d8d92f0cd3708a 1: [64..95]: hole d8f51c20223dbce5c7c90db87bc221b0 10. hole -> data -> hole +0: [0..63]: hole bb7df04e1b0a2570657527a7e108ae23 11. data -> hole -> data 0: [0..63]: extent diff --git a/tests/generic/022.out b/tests/generic/022.out index fbffa59..6dbc192 100644 --- a/tests/generic/022.out +++ b/tests/generic/022.out @@ -1,5 +1,6 @@ QA output created by 022 1. into a hole +0: [0..95]: hole f4f35d60b3cc18aaa6d8d92f0cd3708a 2. into allocated space 0: [0..95]: extent @@ -34,6 +35,7 @@ f4f35d60b3cc18aaa6d8d92f0cd3708a 1: [64..95]: hole d8f51c20223dbce5c7c90db87bc221b0 10. hole -> data -> hole +0: [0..63]: hole bb7df04e1b0a2570657527a7e108ae23 11. data -> hole -> data 0: [0..63]: extent diff --git a/tests/generic/058.out b/tests/generic/058.out index b15308d..3bbc2a4 100644 --- a/tests/generic/058.out +++ b/tests/generic/058.out @@ -1,5 +1,6 @@ QA output created by 058 1. into a hole +0: [0..55]: hole cf845a781c107ec1346e849c9dd1b7e8 2. into allocated space 0: [0..7]: extent diff --git a/tests/generic/060.out b/tests/generic/060.out index 909b578..210af74 100644 --- a/tests/generic/060.out +++ b/tests/generic/060.out @@ -1,5 +1,6 @@ QA output created by 060 1. into a hole +0: [0..55]: hole cf845a781c107ec1346e849c9dd1b7e8 2. into allocated space 0: [0..7]: extent diff --git a/tests/generic/061.out b/tests/generic/061.out index 78d6c6d..6d95680 100644 --- a/tests/generic/061.out +++ b/tests/generic/061.out @@ -1,5 +1,6 @@ QA output created by 061 1. into a hole +0: [0..55]: hole cf845a781c107ec1346e849c9dd1b7e8 2. into allocated space 0: [0..7]: extent diff --git a/tests/generic/063.out b/tests/generic/063.out index d828ff6..10db43f 100644 --- a/tests/generic/063.out +++ b/tests/generic/063.out @@ -1,5 +1,6 @@ QA output created by 063 1. into a hole +0: [0..55]: hole cf845a781c107ec1346e849c9dd1b7e8 2. into allocated space 0: [0..7]: extent diff --git a/tests/generic/255.out b/tests/generic/255.out index 217ef3e..441fde8 100644 --- a/tests/generic/255.out +++ b/tests/generic/255.out @@ -1,5 +1,6 @@ QA output created by 255 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -42,6 +43,7 @@ daa100df6e6711906b61c9ab5aa16032 3: [32..39]: hole cc63069677939f69a6e8f68cae6a6dac 10. hole -> data -> hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 11. data -> hole -> data 0: [0..7]: extent @@ -79,6 +81,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -121,6 +124,7 @@ daa100df6e6711906b61c9ab5aa16032 3: [32..39]: hole cc63069677939f69a6e8f68cae6a6dac 10. hole -> data -> hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 11. data -> hole -> data 0: [0..7]: extent @@ -158,6 +162,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -240,6 +245,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent diff --git a/tests/generic/316.out b/tests/generic/316.out index 383f0d1..5506198 100644 --- a/tests/generic/316.out +++ b/tests/generic/316.out @@ -1,5 +1,6 @@ QA output created by 316 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -16,6 +17,7 @@ cc63069677939f69a6e8f68cae6a6dac 1: [8..39]: hole 1b3779878366498b28c702ef88c4a773 10. hole -> data -> hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 11. data -> hole -> data 0: [0..7]: extent @@ -43,6 +45,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -59,6 +62,7 @@ cc63069677939f69a6e8f68cae6a6dac 1: [8..39]: hole 1b3779878366498b28c702ef88c4a773 10. hole -> data -> hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 11. data -> hole -> data 0: [0..7]: extent @@ -86,6 +90,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent @@ -133,6 +138,7 @@ eecb7aa303d121835de05028751d301c 0000400 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd * 1. into a hole +0: [0..39]: hole daa100df6e6711906b61c9ab5aa16032 2. into allocated space 0: [0..7]: extent