[Libguestfs] [PATCH nbdkit 2/4] tests: Move creation of ‘disk’ earlier.

Richard W.M. Jones rjones at redhat.com
Thu Jun 7 15:48:55 UTC 2018


Just refactoring.
---
 tests/Makefile.am | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0cc2618..1830cd3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -232,6 +232,18 @@ test_oldstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS)
 
 endif HAVE_LIBGUESTFS
 
+# common disk image shared with several tests
+if HAVE_GUESTFISH
+check_DATA += disk
+MAINTAINERCLEANFILES += disk
+
+disk:
+	rm -f $@ test1.img
+	guestfish -N fs -m /dev/sda1 write /hello.txt "hello,world"
+	mv test1.img disk
+
+endif HAVE_GUESTFISH
+
 # file plugin test.
 LIBGUESTFS_TESTS += test-file
 
@@ -241,26 +253,19 @@ test_file_LDADD = libtest.la $(LIBGUESTFS_LIBS)
 
 # gzip plugin test.
 if HAVE_ZLIB
-if HAVE_GUESTFISH
 
 LIBGUESTFS_TESTS += test-gzip
-check_DATA += disk disk.gz
-MAINTAINERCLEANFILES += disk disk.gz
+check_DATA += disk.gz
+MAINTAINERCLEANFILES += disk.gz
 
 test_gzip_SOURCES = test-gzip.c test.h
 test_gzip_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS)
 test_gzip_LDADD = libtest.la $(LIBGUESTFS_LIBS)
 
-disk:
-	rm -f $@ test1.img
-	guestfish -N fs -m /dev/sda1 write /hello.txt "hello,world"
-	mv test1.img disk
-
 disk.gz: disk
 	rm -f $@
 	gzip -9 -c disk > $@
 
-endif HAVE_GUESTFISH
 endif HAVE_ZLIB
 
 # memory plugin test.
@@ -316,7 +321,6 @@ test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS)
 
 # xz plugin test.
 if HAVE_LIBLZMA
-if HAVE_GUESTFISH
 
 LIBGUESTFS_TESTS += test-xz
 check_DATA += disk.xz
@@ -330,7 +334,6 @@ disk.xz: disk
 	rm -f $@
 	xz --best --block-size=16777216 -c disk > $@
 
-endif HAVE_GUESTFISH
 endif HAVE_LIBLZMA
 
 #----------------------------------------------------------------------
-- 
2.16.2




More information about the Libguestfs mailing list