From: Nikolay Borisov <nborisov@suse.com>
To: linux-xfs@vger.kernel.org
Cc: fstests@vger.kernel.org, eguan@redhat.com, david@fromorbit.com,
darrick.wong@oracle.com, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v4 1/3] generic: Adjust generic test outputs for new fiemap imeplementation
Date: Wed, 15 Nov 2017 14:11:38 +0200 [thread overview]
Message-ID: <1510747900-13440-1-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1510747821-13270-1-git-send-email-nborisov@suse.com>
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 <nborisov@suse.com>
---
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
--
2.7.4
next prev parent reply other threads:[~2017-11-15 12:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 12:10 [PATCH v4 1/2] fiemap: Factor out actual fiemap call code Nikolay Borisov
2017-11-15 12:10 ` [PATCH v4 2/2] fiemap: Implement ranged query Nikolay Borisov
2017-11-17 2:47 ` Eric Sandeen
2017-11-17 9:39 ` Nikolay Borisov
2017-11-15 12:11 ` Nikolay Borisov [this message]
2017-11-15 12:11 ` [PATCH v4 2/3] common: Implement fiemap's range query check Nikolay Borisov
2017-11-21 5:39 ` Eryu Guan
2017-11-15 12:11 ` [PATCH v4 3/3] xfs: initial fiemap range query test Nikolay Borisov
2017-11-21 5:45 ` Eryu Guan
2017-11-21 15:10 ` Nikolay Borisov
2017-11-21 5:29 ` [PATCH v4 1/3] generic: Adjust generic test outputs for new fiemap imeplementation Eryu Guan
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=1510747900-13440-1-git-send-email-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-xfs@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;
as well as URLs for NNTP newsgroup(s).