52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
From 12a7de7810f8e81551e58b8717e0845e6e86445d Mon Sep 17 00:00:00 2001
|
|
From: Eric Blake <eblake@redhat.com>
|
|
Date: Mon, 3 Aug 2020 16:44:15 -0500
|
|
Subject: [PATCH 4/4] tests: Yet another test-nozero tweak
|
|
|
|
We discovered [1] that on xfs, even though the size of nozero2.img did
|
|
not change, the allocation increased when we wrote literal zeroes all
|
|
the way to end-of-file (that is, the filesystem presumed that we were
|
|
likely to write more data soon). Try a couple more tricks to help
|
|
this test pass on koji: double the file size to 2M but keep the
|
|
write-zero operation at 1M (so that we are no longer writing all the
|
|
way to EOF), and relax the comparison to use -lt rather than !=
|
|
(although a growing file is odd, it is not fatal becuase we really
|
|
only care that the write zero did not become sparse).
|
|
|
|
[1] https://www.redhat.com/archives/libguestfs/2020-August/msg00017.html
|
|
|
|
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
---
|
|
tests/test-nozero.sh | 7 ++++---
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/tests/test-nozero.sh b/tests/test-nozero.sh
|
|
index 9406e63c..1d725bc8 100755
|
|
--- a/tests/test-nozero.sh
|
|
+++ b/tests/test-nozero.sh
|
|
@@ -74,7 +74,7 @@ cleanup_fn cleanup
|
|
|
|
# Prep images.
|
|
declare -a sizes
|
|
-printf %$((1024*1024))s . > nozero1.img
|
|
+printf %$((2*1024*1024))s . > nozero1.img
|
|
cp nozero1.img nozero2.img
|
|
cp nozero1.img nozero3.img
|
|
cp nozero1.img nozero4.img
|
|
@@ -153,9 +153,10 @@ cmp nozero3.img nozero4.img
|
|
cmp nozero4.img nozero5.img
|
|
cmp nozero5.img nozero6.img
|
|
|
|
-# Sanity check on sparseness: images 2-6 should not be sparse
|
|
+# Sanity check on sparseness: images 2-6 should not be sparse (although the
|
|
+# filesystem may have reserved additional space due to our writes)
|
|
for i in {2..6}; do
|
|
- if test "$(stat -c %b nozero$i.img)" != "${sizes[$i]}"; then
|
|
+ if test "$(stat -c %b nozero$i.img)" -lt "${sizes[$i]}"; then
|
|
echo "nozero$i.img was trimmed by mistake"
|
|
fail=1
|
|
fi
|
|
--
|
|
2.27.0
|
|
|