From 4ee2e4525fe0423d7381f30e784bf76053c0a39b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 4 Aug 2020 14:58:36 +0100 Subject: [PATCH] More upstream patches to try to track down test failure in Koji. --- 0001-tests-test-nozero.sh-Add-set-x.patch | 4 +- ...o.sh-Create-test-file-as-single-exte.patch | 4 +- ...ther-robustness-tweak-to-test-nozero.patch | 102 ++++++++++++++++++ ...-tests-Yet-another-test-nozero-tweak.patch | 51 +++++++++ nbdkit.spec | 15 +-- 5 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 0003-tests-Another-robustness-tweak-to-test-nozero.patch create mode 100644 0004-tests-Yet-another-test-nozero-tweak.patch diff --git a/0001-tests-test-nozero.sh-Add-set-x.patch b/0001-tests-test-nozero.sh-Add-set-x.patch index fb328e9..882e652 100644 --- a/0001-tests-test-nozero.sh-Add-set-x.patch +++ b/0001-tests-test-nozero.sh-Add-set-x.patch @@ -1,7 +1,7 @@ From 5dc844e5b481b32915d38a9e5dd32bef3e698957 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 31 Jul 2020 08:51:37 +0100 -Subject: [PATCH 1/2] tests/test-nozero.sh: Add set -x. +Subject: [PATCH 1/4] tests/test-nozero.sh: Add set -x. Used to track down a failure in this test which only happens in Koji. --- @@ -21,5 +21,5 @@ index 444c1b70..9a815814 100755 sock2=`mktemp -u` sock3=`mktemp -u` -- -2.28.0.rc2 +2.27.0 diff --git a/0002-tests-test-nozero.sh-Create-test-file-as-single-exte.patch b/0002-tests-test-nozero.sh-Create-test-file-as-single-exte.patch index 138c3ad..66248c9 100644 --- a/0002-tests-test-nozero.sh-Create-test-file-as-single-exte.patch +++ b/0002-tests-test-nozero.sh-Create-test-file-as-single-exte.patch @@ -1,7 +1,7 @@ From 89a36b1fab8302ddc370695d386a28a03a74eae7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 1 Aug 2020 08:46:53 +0100 -Subject: [PATCH 2/2] tests/test-nozero.sh: Create test file as single extent, +Subject: [PATCH 2/4] tests/test-nozero.sh: Create test file as single extent, add debugging. Previously the test file was created by repeatedly appending, ie: @@ -49,5 +49,5 @@ index 9a815814..f1bb8a38 100755 --run 'nbdsh -u "$uri" -c "h.zero (1024*1024, 0)"' if test "$(stat -c %b nozero1.img)" = "$(stat -c %b nozero2.img)"; then -- -2.28.0.rc2 +2.27.0 diff --git a/0003-tests-Another-robustness-tweak-to-test-nozero.patch b/0003-tests-Another-robustness-tweak-to-test-nozero.patch new file mode 100644 index 0000000..dda1dd4 --- /dev/null +++ b/0003-tests-Another-robustness-tweak-to-test-nozero.patch @@ -0,0 +1,102 @@ +From efb27061f0b4ed15b6dab595a8601bdf1926181e Mon Sep 17 00:00:00 2001 +From: Eric Blake +Date: Mon, 3 Aug 2020 16:44:15 -0500 +Subject: [PATCH 3/4] tests: Another robustness tweak to test-nozero + +Instead of looping to create the file, we can change our printf +argument to do it in one shot. Since we can't control when the +filesystem might overallocate, it's easier to just compare a file to +its former size, rather than to try to compare between two files that +might have started with different allocated sizes even though they +have the same content; this in turn is made easy with a bash array. +In a few places, try to run more of the test rather than giving up at +the first error. + +Signed-off-by: Eric Blake +--- + tests/test-nozero.sh | 29 +++++++++++++++-------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/tests/test-nozero.sh b/tests/test-nozero.sh +index f1bb8a38..9406e63c 100755 +--- a/tests/test-nozero.sh ++++ b/tests/test-nozero.sh +@@ -48,6 +48,7 @@ files="nozero1.img nozero1.log + nozero5a.pid nozero5b.pid + nozero6.img nozero6.log $sock6 nozero6.pid" + rm -f $files ++fail=0 + + # For easier debugging, dump the final log files before removing them + # on exit. +@@ -72,7 +73,8 @@ cleanup () + cleanup_fn cleanup + + # Prep images. +-for f in {0..1023}; do printf '%1024s' . ; done > nozero1.img ++declare -a sizes ++printf %$((1024*1024))s . > nozero1.img + cp nozero1.img nozero2.img + cp nozero1.img nozero3.img + cp nozero1.img nozero4.img +@@ -83,12 +85,13 @@ cp nozero1.img nozero6.img + for f in {1..6}; do + stat -c "%n: %b allocated blocks of size %B bytes, total size %s" \ + nozero$f.img ++ sizes[$f]=$(stat -c %b nozero$f.img) + done + + # Check that zero with trim results in a sparse image. + requires nbdkit -U - --filter=log file logfile=nozero1.log nozero1.img \ + --run 'nbdsh -u "$uri" -c "h.zero (1024*1024, 0)"' +-if test "$(stat -c %b nozero1.img)" = "$(stat -c %b nozero2.img)"; then ++if test "$(stat -c %b nozero1.img)" = "${sizes[1]}"; then + echo "$0: can't trim file by writing zeroes" + exit 77 + fi +@@ -129,17 +132,17 @@ nbdsh -u "nbd+unix://?socket=$sock6" -c 'h.zero (1024*1024, 0)' + grep 'connection=1 Zero' nozero1.log + if grep 'connection=1 Zero' nozero2.log; then + echo "filter should have prevented zero" +- exit 1 ++ fail=1 + fi + grep 'connection=1 Zero' nozero3.log + if grep 'connection=1 Zero' nozero4.log; then + echo "filter should have converted zero into write" +- exit 1 ++ fail=1 + fi + grep 'connection=1 Zero' nozero5b.log + if grep 'connection=1 Zero' nozero5a.log; then + echo "nbdkit should have converted zero into write before nbd plugin" +- exit 1 ++ fail=1 + fi + grep 'connection=1 Zero' nozero6.log + +@@ -150,14 +153,12 @@ cmp nozero3.img nozero4.img + cmp nozero4.img nozero5.img + cmp nozero5.img nozero6.img + +-# Sanity check on sparseness; only image 1 should be sparse +-if test "$(stat -c %b nozero1.img)" = "$(stat -c %b nozero2.img)"; then +- echo "nozero2.img was trimmed by mistake" +- exit 1 +-fi +-for i in 3 4 5 6; do +- if test "$(stat -c %b nozero2.img)" != "$(stat -c %b nozero$i.img)"; then +- echo "nozero$i.img was trimmed by mistake" +- exit 1 ++# Sanity check on sparseness: images 2-6 should not be sparse ++for i in {2..6}; do ++ if test "$(stat -c %b nozero$i.img)" != "${sizes[$i]}"; then ++ echo "nozero$i.img was trimmed by mistake" ++ fail=1 + fi + done ++ ++exit $fail +-- +2.27.0 + diff --git a/0004-tests-Yet-another-test-nozero-tweak.patch b/0004-tests-Yet-another-test-nozero-tweak.patch new file mode 100644 index 0000000..157e86f --- /dev/null +++ b/0004-tests-Yet-another-test-nozero-tweak.patch @@ -0,0 +1,51 @@ +From 12a7de7810f8e81551e58b8717e0845e6e86445d Mon Sep 17 00:00:00 2001 +From: Eric Blake +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 +--- + 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 + diff --git a/nbdkit.spec b/nbdkit.spec index b2718b8..9dd42f5 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -45,7 +45,7 @@ ExclusiveArch: x86_64 Name: nbdkit Version: 1.21.20 -Release: 5%{?dist} +Release: 6%{?dist} Summary: NBD server License: BSD @@ -58,9 +58,11 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name Source2: libguestfs.keyring %endif -# Upsream patch to try to track down test failure. +# Upstream patches to try to fix test failure. Patch1: 0001-tests-test-nozero.sh-Add-set-x.patch Patch2: 0002-tests-test-nozero.sh-Create-test-file-as-single-exte.patch +Patch3: 0003-tests-Another-robustness-tweak-to-test-nozero.patch +Patch4: 0004-tests-Yet-another-test-nozero-tweak.patch %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool @@ -729,13 +731,6 @@ truncate -s 0 tests/test-nbd-tls.sh tests/test-nbd-tls-psk.sh # https://bugzilla.redhat.com/show_bug.cgi?id=1860461 truncate -s 0 tests/test-partition1.sh -# Temporarily kill test-nozero.sh. It fails reliably on i686 and -# x86_64 for reasons which are not understood. See discussion -# upstream here: -# https://www.redhat.com/archives/libguestfs/2020-July/msg00148.html -# https://www.redhat.com/archives/libguestfs/2020-August/msg00000.html -truncate -s 0 tests/test-nozero.sh - # Make sure we can see the debug messages (RHBZ#1230160). export LIBGUESTFS_DEBUG=1 export LIBGUESTFS_TRACE=1 @@ -1079,7 +1074,7 @@ export LIBGUESTFS_TRACE=1 %changelog -* Sat Aug 1 2020 Richard W.M. Jones - 1.21.20-5 +* Sat Aug 1 2020 Richard W.M. Jones - 1.21.20-6 - Add upstream patches to try to track down test failure in Koji. * Tue Jul 28 2020 Fedora Release Engineering - 1.21.20-2