[Libguestfs] [PATCH nbdkit] tests: xz: Use 16M block size when preparing disk for xz plugin test.

Richard W.M. Jones
2018-06-06T19:12:18Z

In a recent commit guestfish changed the default size for disk images
prepared using the -N parameter from 100M to 1G:


https://github.com/libguestfs/libguestfs/commit/adc23829e4b128562c2c29d984654528bd259644

For the xz plugin test we prepared a disk image using guestfish and
then xz-compressing the output, but we did not take our own advice and
use the --block-size parameter to limit the xz block size.  Because of
the increased size of the disk as a whole, this pushed the block size
beyond the limit that the xz plugin can handle, and the test would
fail with:

  nbdkit: error: /var/tmp/nbdkit-1.3.1/tests/disk.xz: xz file largest block is
bigger than maxblock
  Either recompress the xz file with smaller blocks (see nbdkit-xz-plugin(1))
  or make maxblock parameter bigger.
  maxblock = 536870912 (bytes)
  largest block in xz file = 1073741824 (bytes)

Simple fix by adding the --block-size parameter.

Note that to see the effect of this change you will need to ‘make
maintainer-clean’ or remove the files ‘tests/disk’ and ‘tests/disk.xz’
by hand.
---
 tests/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4582120..0cc2618 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -328,7 +328,7 @@ test_xz_LDADD = libtest.la $(LIBGUESTFS_LIBS)

 disk.xz: disk
 	rm -f $@
-	xz --best -c disk > $@
+	xz --best --block-size=16777216 -c disk > $@

 endif HAVE_GUESTFISH
 endif HAVE_LIBLZMA
--
2.15.1