Eric Blake
2018-Apr-06 19:50 UTC
[Libguestfs] [nbdkit PATCH v2] tests: Skip guestfs code on CentOS 6
CentOS 6 has libguestfs-devel 1.20.11, which predates the support in guestfs_add_drive_opts() for requesting an nbd drive instead of a local file (annoyingly, guestfs documentation merely states the function was available since 0.3, without saying which later releases added new options); causing a compilation failure during 'make check'. Maybe the guestfs plugin should still be built, even though the tests that use guestfs can't work without support for GUESTFS_ADD_DRIVE_OPTS_PROTOCOL; but it's easier to just declare that on this old platform, we'll just disable guestfs integration altogether. With that in place, 'make check' now runs to completion, passing 14 and skipping 5 remaining tests. Signed-off-by: Eric Blake <eblake@redhat.com> --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index c9a6948..d498d05 100644 --- a/configure.ac +++ b/configure.ac @@ -403,10 +403,20 @@ AC_ARG_WITH([libguestfs],[ [with_libguestfs=check]) AS_IF([test "$with_libguestfs" != "no"],[ PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs],[ + # Although the library was found, we want to make sure it supports nbd + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <guestfs.h> + ]], [[ +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL +#error unsupported +#endif + ]])], [ AC_SUBST([LIBGUESTFS_CFLAGS]) AC_SUBST([LIBGUESTFS_LIBS]) AC_DEFINE([HAVE_LIBGUESTFS],[1],[libguestfs found at compile time.]) + ],[ + LIBGUESTFS_LIBS+ AC_MSG_WARN([libguestfs too old, guestfs plugin and tests will be disabled])]) ], [AC_MSG_WARN([libguestfs not found, guestfs plugin and tests will be disabled])]) ]) -- 2.14.3
Eric Blake
2018-Apr-09 20:44 UTC
[Libguestfs] [nbdkit PATCH 2/1] RFC: tests: Run tests that don't require libguestfs
A bit of refactoring to the HAVE_LIBGUESTFS conditional, coupled with the addition of a LIBGUESTFS_TESTS intermediate list, allows us to run a few more tests on CentOS 6 (adding some tests of command-line behavior and filters that was previously completely skipped). For the two tests that we can't run, using check_PROGRAMS still causes those programs to try to compile (which leads to compile errors); but using EXTRA_PROGRAMS keeps automake silent without getting those sources in the way, while still distributing the sources for someone motivated to fix the tests. Compared to the previous patch (14/14 pass and 5 skip), I now have 15/18 pass and 9 skip. Signed-off-by: Eric Blake <eblake@redhat.com> --- This one was more invasive than the previous, but may still be worth having on top of the configure change that disables HAVE_LIBGUESTFS on CentOS 7. The three test failures are now: ./test-dump-plugin-example4.sh: unexpected output from nbdkit example4 --dump-plugin path=/home/dummy/nbdkit/plugins/perl/.libs/nbdkit-perl-plugin.so name=perl version=1.3.0 ... has__zero_old=1 FAIL: test-dump-plugin-example4.sh nbd://?socket=cache.sock: No such file or directory ./test-cache.sh: line 64: kill: (32161) - No such process FAIL: test-cache.sh guestfish: -N parameter 'cow-base.img=fs': no such prepared disk image known. Use 'guestfish -N help' to list possible values for the -N parameter. FAIL: test-cow.sh (hmm, so my attempt to guard test-cache.sh and test-cow.sh by HAVE_GUESTFISH didn't really help) tests/Makefile.am | 71 +++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 2cc2344..4582120 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -190,7 +190,11 @@ TESTS += \ # Most in-depth tests need libguestfs, since that is a convenient way to # drive qemu. +LIBGUESTFS_TESTS +EXTRA_PROGRAMS if HAVE_LIBGUESTFS +check_PROGRAMS += $(LIBGUESTFS_TESTS) +TESTS += $(LIBGUESTFS_TESTS) # Use the 'direct' backend, and ensure maximum libguestfs debugging is # written to the *.log files in case there is a problem. @@ -206,32 +210,30 @@ libtest_la_SOURCES = test.c test.h libtest_la_CFLAGS = $(WARNINGS_CFLAGS) # Basic connection test. -check_PROGRAMS += test-connect -TESTS += test-connect +LIBGUESTFS_TESTS += test-connect test_connect_SOURCES = test-connect.c test.h test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_connect_LDADD = libtest.la $(LIBGUESTFS_LIBS) # newstyle protocol test. -check_PROGRAMS += test-newstyle -TESTS += test-newstyle +LIBGUESTFS_TESTS += test-newstyle test_newstyle_SOURCES = test-newstyle.c test.h test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_newstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS) # oldstyle protocol test. -check_PROGRAMS += test-oldstyle -TESTS += test-oldstyle +LIBGUESTFS_TESTS += test-oldstyle test_oldstyle_SOURCES = test-oldstyle.c test.h test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_oldstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS) +endif HAVE_LIBGUESTFS + # file plugin test. -check_PROGRAMS += test-file -TESTS += test-file +LIBGUESTFS_TESTS += test-file test_file_SOURCES = test-file.c test.h test_file_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) @@ -241,8 +243,7 @@ test_file_LDADD = libtest.la $(LIBGUESTFS_LIBS) if HAVE_ZLIB if HAVE_GUESTFISH -check_PROGRAMS += test-gzip -TESTS += test-gzip +LIBGUESTFS_TESTS += test-gzip check_DATA += disk disk.gz MAINTAINERCLEANFILES += disk disk.gz @@ -263,24 +264,21 @@ endif HAVE_GUESTFISH endif HAVE_ZLIB # memory plugin test. -check_PROGRAMS += test-memory -TESTS += test-memory +LIBGUESTFS_TESTS += test-memory test_memory_SOURCES = test-memory.c test.h test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS) # nbd plugin test. -check_PROGRAMS += test-nbd -TESTS += test-nbd +LIBGUESTFS_TESTS += test-nbd test_nbd_SOURCES = test-nbd.c test.h test_nbd_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_nbd_LDADD = libtest.la $(LIBGUESTFS_LIBS) # null plugin test. -check_PROGRAMS += test-null -TESTS += test-null +LIBGUESTFS_TESTS += test-null test_null_SOURCES = test-null.c test.h test_null_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) @@ -301,17 +299,16 @@ split3: file-data rm -f $@ $@-t dd if=$< of=$@-t bs=1 skip=200 mv $@-t $@ -check_PROGRAMS += test-split -TESTS += test-split +LIBGUESTFS_TESTS += test-split test_split_SOURCES = test-split.c test.h test_split_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_split_LDADD = libtest.la $(LIBGUESTFS_LIBS) # streaming plugin test. -check_PROGRAMS += test-streaming # Doesn't work: -#TESTS += test-streaming +#LIBGUESTFS_TESTS += test-streaming +EXTRA_PROGRAMS += test-streaming test_streaming_SOURCES = test-streaming.c test.h test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) @@ -321,8 +318,7 @@ test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS) if HAVE_LIBLZMA if HAVE_GUESTFISH -check_PROGRAMS += test-xz -TESTS += test-xz +LIBGUESTFS_TESTS += test-xz check_DATA += disk.xz MAINTAINERCLEANFILES += disk.xz @@ -343,8 +339,7 @@ endif HAVE_LIBLZMA # OCaml plugin test. if HAVE_OCAML -check_PROGRAMS += test-ocaml -TESTS += test-ocaml +LIBGUESTFS_TESTS += test-ocaml # This is somewhat different from the other tests because we have # to build an actual plugin here. @@ -365,11 +360,10 @@ endif HAVE_OCAML # perl plugin test. if HAVE_PERL -check_PROGRAMS += test-perl TESTS += \ test-dump-plugin-example4.sh \ - test-perl \ test-shebang-perl.sh +LIBGUESTFS_TESTS += test-perl test_perl_SOURCES = test-lang-plugins.c test.h test_perl_CFLAGS = \ @@ -382,11 +376,10 @@ endif HAVE_PERL # python plugin test. if HAVE_PYTHON -check_PROGRAMS += test-python TESTS += \ - test-python \ test-python-exception.sh \ test-shebang-python.sh +LIBGUESTFS_TESTS += test-python test_python_SOURCES = test-lang-plugins.c test.h test_python_CFLAGS = \ @@ -402,10 +395,10 @@ if HAVE_RUBY # Ruby tests are disabled. See "WARNING" section in # plugins/ruby/nbdkit-ruby-plugin.pod -check_PROGRAMS += test-ruby -#TESTS += \ -# test-ruby \ -# test-shebang-ruby.sh +#LIBGUESTFS_TESTS += \ +# test-ruby +#TESTS += test-shebang-ruby.sh +EXTRA_PROGRAMS += test-ruby test_ruby_SOURCES = test-lang-plugins.c test.h test_ruby_CFLAGS = \ @@ -422,14 +415,17 @@ endif HAVE_RUBY TESTS += test-blocksize.sh # cache filter test. +if HAVE_GUESTFISH TESTS += test-cache.sh +endif HAVE_GUESTFISH # cow filter test. +if HAVE_GUESTFISH TESTS += test-cow.sh +endif HAVE_GUESTFISH # delay filter test. -check_PROGRAMS += test-delay -TESTS += test-delay +LIBGUESTFS_TESTS += test-delay test_delay_SOURCES = test-delay.c test.h test_delay_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) @@ -447,8 +443,7 @@ TESTS += test-nozero.sh # offset filter test. check_DATA += offset-data MAINTAINERCLEANFILES += offset-data -check_PROGRAMS += test-offset -TESTS += test-offset +LIBGUESTFS_TESTS += test-offset offset-data: rm -f $@ $@-t @@ -460,12 +455,10 @@ test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS) # partition filter test. -check_PROGRAMS += test-partition -TESTS += test-partition +LIBGUESTFS_TESTS += test-partition test_partition_SOURCES = test-partition.c test.h test_partition_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) test_partition_LDADD = libtest.la $(LIBGUESTFS_LIBS) -endif HAVE_LIBGUESTFS endif HAVE_PLUGINS -- 2.14.3
Eric Blake
2018-May-01 13:55 UTC
Re: [Libguestfs] [nbdkit PATCH 2/1] RFC: tests: Run tests that don't require libguestfs
On 04/09/2018 03:44 PM, Eric Blake wrote:> A bit of refactoring to the HAVE_LIBGUESTFS conditional, > coupled with the addition of a LIBGUESTFS_TESTS intermediate > list, allows us to run a few more tests on CentOS 6 (adding > some tests of command-line behavior and filters that was > previously completely skipped). > > For the two tests that we can't run, using check_PROGRAMS > still causes those programs to try to compile (which leads to > compile errors); but using EXTRA_PROGRAMS keeps automake > silent without getting those sources in the way, while still > distributing the sources for someone motivated to fix the > tests. > > Compared to the previous patch (14/14 pass and 5 skip), I now > have 15/18 pass and 9 skip. > > Signed-off-by: Eric Blake <eblake@redhat.com> > ---Ping> > This one was more invasive than the previous, but may still be > worth having on top of the configure change that disables > HAVE_LIBGUESTFS on CentOS 7. The three test failures are now: > > ./test-dump-plugin-example4.sh: unexpected output from nbdkit example4 --dump-plugin > path=/home/dummy/nbdkit/plugins/perl/.libs/nbdkit-perl-plugin.so > name=perl > version=1.3.0 > ... > has__zero_old=1 > FAIL: test-dump-plugin-example4.sh > > > nbd://?socket=cache.sock: No such file or directory > ./test-cache.sh: line 64: kill: (32161) - No such process > FAIL: test-cache.sh > guestfish: -N parameter 'cow-base.img=fs': no such prepared disk image known. > Use 'guestfish -N help' to list possible values for the -N parameter. > FAIL: test-cow.sh > > (hmm, so my attempt to guard test-cache.sh and test-cow.sh by > HAVE_GUESTFISH didn't really help) > > tests/Makefile.am | 71 +++++++++++++++++++++++++------------------------------ > 1 file changed, 32 insertions(+), 39 deletions(-) > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 2cc2344..4582120 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -190,7 +190,11 @@ TESTS += \ > > # Most in-depth tests need libguestfs, since that is a convenient way to > # drive qemu. > +LIBGUESTFS_TESTS > +EXTRA_PROGRAMS > if HAVE_LIBGUESTFS > +check_PROGRAMS += $(LIBGUESTFS_TESTS) > +TESTS += $(LIBGUESTFS_TESTS) > > # Use the 'direct' backend, and ensure maximum libguestfs debugging is > # written to the *.log files in case there is a problem. > @@ -206,32 +210,30 @@ libtest_la_SOURCES = test.c test.h > libtest_la_CFLAGS = $(WARNINGS_CFLAGS) > > # Basic connection test. > -check_PROGRAMS += test-connect > -TESTS += test-connect > +LIBGUESTFS_TESTS += test-connect > > test_connect_SOURCES = test-connect.c test.h > test_connect_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_connect_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # newstyle protocol test. > -check_PROGRAMS += test-newstyle > -TESTS += test-newstyle > +LIBGUESTFS_TESTS += test-newstyle > > test_newstyle_SOURCES = test-newstyle.c test.h > test_newstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_newstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # oldstyle protocol test. > -check_PROGRAMS += test-oldstyle > -TESTS += test-oldstyle > +LIBGUESTFS_TESTS += test-oldstyle > > test_oldstyle_SOURCES = test-oldstyle.c test.h > test_oldstyle_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_oldstyle_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > +endif HAVE_LIBGUESTFS > + > # file plugin test. > -check_PROGRAMS += test-file > -TESTS += test-file > +LIBGUESTFS_TESTS += test-file > > test_file_SOURCES = test-file.c test.h > test_file_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > @@ -241,8 +243,7 @@ test_file_LDADD = libtest.la $(LIBGUESTFS_LIBS) > if HAVE_ZLIB > if HAVE_GUESTFISH > > -check_PROGRAMS += test-gzip > -TESTS += test-gzip > +LIBGUESTFS_TESTS += test-gzip > check_DATA += disk disk.gz > MAINTAINERCLEANFILES += disk disk.gz > > @@ -263,24 +264,21 @@ endif HAVE_GUESTFISH > endif HAVE_ZLIB > > # memory plugin test. > -check_PROGRAMS += test-memory > -TESTS += test-memory > +LIBGUESTFS_TESTS += test-memory > > test_memory_SOURCES = test-memory.c test.h > test_memory_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_memory_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # nbd plugin test. > -check_PROGRAMS += test-nbd > -TESTS += test-nbd > +LIBGUESTFS_TESTS += test-nbd > > test_nbd_SOURCES = test-nbd.c test.h > test_nbd_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_nbd_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # null plugin test. > -check_PROGRAMS += test-null > -TESTS += test-null > +LIBGUESTFS_TESTS += test-null > > test_null_SOURCES = test-null.c test.h > test_null_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > @@ -301,17 +299,16 @@ split3: file-data > rm -f $@ $@-t > dd if=$< of=$@-t bs=1 skip=200 > mv $@-t $@ > -check_PROGRAMS += test-split > -TESTS += test-split > +LIBGUESTFS_TESTS += test-split > > test_split_SOURCES = test-split.c test.h > test_split_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_split_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # streaming plugin test. > -check_PROGRAMS += test-streaming > # Doesn't work: > -#TESTS += test-streaming > +#LIBGUESTFS_TESTS += test-streaming > +EXTRA_PROGRAMS += test-streaming > > test_streaming_SOURCES = test-streaming.c test.h > test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > @@ -321,8 +318,7 @@ test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS) > if HAVE_LIBLZMA > if HAVE_GUESTFISH > > -check_PROGRAMS += test-xz > -TESTS += test-xz > +LIBGUESTFS_TESTS += test-xz > check_DATA += disk.xz > MAINTAINERCLEANFILES += disk.xz > > @@ -343,8 +339,7 @@ endif HAVE_LIBLZMA > # OCaml plugin test. > if HAVE_OCAML > > -check_PROGRAMS += test-ocaml > -TESTS += test-ocaml > +LIBGUESTFS_TESTS += test-ocaml > > # This is somewhat different from the other tests because we have > # to build an actual plugin here. > @@ -365,11 +360,10 @@ endif HAVE_OCAML > # perl plugin test. > if HAVE_PERL > > -check_PROGRAMS += test-perl > TESTS += \ > test-dump-plugin-example4.sh \ > - test-perl \ > test-shebang-perl.sh > +LIBGUESTFS_TESTS += test-perl > > test_perl_SOURCES = test-lang-plugins.c test.h > test_perl_CFLAGS = \ > @@ -382,11 +376,10 @@ endif HAVE_PERL > # python plugin test. > if HAVE_PYTHON > > -check_PROGRAMS += test-python > TESTS += \ > - test-python \ > test-python-exception.sh \ > test-shebang-python.sh > +LIBGUESTFS_TESTS += test-python > > test_python_SOURCES = test-lang-plugins.c test.h > test_python_CFLAGS = \ > @@ -402,10 +395,10 @@ if HAVE_RUBY > # Ruby tests are disabled. See "WARNING" section in > # plugins/ruby/nbdkit-ruby-plugin.pod > > -check_PROGRAMS += test-ruby > -#TESTS += \ > -# test-ruby \ > -# test-shebang-ruby.sh > +#LIBGUESTFS_TESTS += \ > +# test-ruby > +#TESTS += test-shebang-ruby.sh > +EXTRA_PROGRAMS += test-ruby > > test_ruby_SOURCES = test-lang-plugins.c test.h > test_ruby_CFLAGS = \ > @@ -422,14 +415,17 @@ endif HAVE_RUBY > TESTS += test-blocksize.sh > > # cache filter test. > +if HAVE_GUESTFISH > TESTS += test-cache.sh > +endif HAVE_GUESTFISH > > # cow filter test. > +if HAVE_GUESTFISH > TESTS += test-cow.sh > +endif HAVE_GUESTFISH > > # delay filter test. > -check_PROGRAMS += test-delay > -TESTS += test-delay > +LIBGUESTFS_TESTS += test-delay > > test_delay_SOURCES = test-delay.c test.h > test_delay_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > @@ -447,8 +443,7 @@ TESTS += test-nozero.sh > # offset filter test. > check_DATA += offset-data > MAINTAINERCLEANFILES += offset-data > -check_PROGRAMS += test-offset > -TESTS += test-offset > +LIBGUESTFS_TESTS += test-offset > > offset-data: > rm -f $@ $@-t > @@ -460,12 +455,10 @@ test_offset_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_offset_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > # partition filter test. > -check_PROGRAMS += test-partition > -TESTS += test-partition > +LIBGUESTFS_TESTS += test-partition > > test_partition_SOURCES = test-partition.c test.h > test_partition_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) > test_partition_LDADD = libtest.la $(LIBGUESTFS_LIBS) > > -endif HAVE_LIBGUESTFS > endif HAVE_PLUGINS >-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2018-May-01 14:10 UTC
Re: [Libguestfs] [nbdkit PATCH 2/1] RFC: tests: Run tests that don't require libguestfs
Sorry I missed this one. It looks to me like straightforward refactoring, therefore ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- [nbdkit PATCH] maint: Adjust cleaning rules
- [nbdkit PATCH v2] tests: Skip guestfs code on CentOS 6
- [PATCH nbdkit 3/3] tests: fix generation of PKI test data
- [nbdkit PATCH 2/2] ext2: Supply .list_exports and .default_export
- Re: [nbdkit PATCH v2] Introduce cacheextents filter