Eric Blake
2018-Apr-05 20:03 UTC
[Libguestfs] [nbdkit PATCH] tests: Skip guestfs tests 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. The guestfs plugin can still be built, so no configure changes are needed; but skip the tests that fail to compile so that 'make check' can at least complete. Signed-off-by: Eric Blake <eblake@redhat.com> --- Even with this patch, there are still failures: /home/dummy/nbdkit/src/nbdkit -U /tmp/nbdkitC8Hm6H/sock -P /tmp/nbdkitC8Hm6H/pid -f -v /home/dummy/nbdkit/plugins/gzip/.libs/nbdkit-gzip-plugin.so -r file=disk. gz nbdkit: debug: TLS disabled: nbdkit was not compiled with GnuTLS support nbdkit: /home/dummy/nbdkit/plugins/gzip/.libs/nbdkit-gzip-plugin.so: /home/dummy /nbdkit/plugins/gzip/.libs/nbdkit-gzip-plugin.so: undefined symbol: gzbuffer test-gzip FAILED: nbdkit exited before starting to serve files waitpid: No child processes FAIL: test-gzip ./test-dump-plugin-example4.sh: unexpected output from nbdkit example4 --dump-pl ugin path=/home/dummy/nbdkit/plugins/perl/.libs/nbdkit-perl-plugin.so ... has__zero_old=1 FAIL: test-dump-plugin-example4.sh libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: set_attach_method "appliance" libguestfs: trace: set_attach_method = 0 libguestfs: create: flags = 0, handle = 0xf8fac0 nbd://?socket=cache.sock: No such file or directory libguestfs: trace: close libguestfs: closing guestfs handle 0xf8fac0 (state 0) ./test-cache.sh: line 64: kill: (14315) - No such process FAIL: test-cache.sh libguestfs: trace: set_verbose true libguestfs: trace: set_verbose = 0 libguestfs: trace: set_attach_method "appliance" libguestfs: trace: set_attach_method = 0 libguestfs: create: flags = 0, handle = 0xf89ac0 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. libguestfs: trace: close libguestfs: closing guestfs handle 0xf89ac0 (state 0) FAIL: test-cow.sh ======================4 of 19 tests failed (21 tests were not run) ====================== but that's better than not compiling --- tests/test-connect.c | 5 +++++ tests/test-delay.c | 5 +++++ tests/test-file.c | 5 +++++ tests/test-gzip.c | 5 +++++ tests/test-lang-plugins.c | 5 +++++ tests/test-memory.c | 5 +++++ tests/test-nbd.c | 5 +++++ tests/test-newstyle.c | 5 +++++ tests/test-null.c | 7 +++++++ tests/test-ocaml.c | 5 +++++ tests/test-offset.c | 5 +++++ tests/test-oldstyle.c | 5 +++++ tests/test-partition.c | 5 +++++ tests/test-split.c | 5 +++++ tests/test-streaming.c | 5 +++++ tests/test-xz.c | 5 +++++ 16 files changed, 82 insertions(+) diff --git a/tests/test-connect.c b/tests/test-connect.c index 32ba79a..06c6163 100644 --- a/tests/test-connect.c +++ b/tests/test-connect.c @@ -62,6 +62,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -70,6 +74,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-delay.c b/tests/test-delay.c index 47bf380..f037097 100644 --- a/tests/test-delay.c +++ b/tests/test-delay.c @@ -63,6 +63,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -70,6 +74,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-file.c b/tests/test-file.c index 65a2568..6a81b9e 100644 --- a/tests/test-file.c +++ b/tests/test-file.c @@ -61,6 +61,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -68,6 +72,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-gzip.c b/tests/test-gzip.c index 8e9c286..13e243f 100644 --- a/tests/test-gzip.c +++ b/tests/test-gzip.c @@ -60,6 +60,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -68,6 +72,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-lang-plugins.c b/tests/test-lang-plugins.c index fc3cbef..915256f 100644 --- a/tests/test-lang-plugins.c +++ b/tests/test-lang-plugins.c @@ -70,6 +70,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -77,6 +81,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-memory.c b/tests/test-memory.c index fb2ff2a..281996e 100644 --- a/tests/test-memory.c +++ b/tests/test-memory.c @@ -60,6 +60,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -67,6 +71,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-nbd.c b/tests/test-nbd.c index 646c0c3..22f6424 100644 --- a/tests/test-nbd.c +++ b/tests/test-nbd.c @@ -80,6 +80,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -87,6 +91,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-newstyle.c b/tests/test-newstyle.c index 9835931..b6f193a 100644 --- a/tests/test-newstyle.c +++ b/tests/test-newstyle.c @@ -64,6 +64,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else /* Using any exportname causes qemu to use the newstyle protocol. */ r = guestfs_add_drive_opts (g, EXPORTNAME, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -72,6 +76,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-null.c b/tests/test-null.c index d7cf5e5..29ed280 100644 --- a/tests/test-null.c +++ b/tests/test-null.c @@ -64,6 +64,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -71,6 +75,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); @@ -93,6 +98,7 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifdef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -100,6 +106,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-ocaml.c b/tests/test-ocaml.c index 707c762..5471d06 100644 --- a/tests/test-ocaml.c +++ b/tests/test-ocaml.c @@ -70,6 +70,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -77,6 +81,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-offset.c b/tests/test-offset.c index d47066f..77e2005 100644 --- a/tests/test-offset.c +++ b/tests/test-offset.c @@ -89,6 +89,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -96,6 +100,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-oldstyle.c b/tests/test-oldstyle.c index a9ba01c..0fabdf8 100644 --- a/tests/test-oldstyle.c +++ b/tests/test-oldstyle.c @@ -61,6 +61,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else /* Using exportname = "" causes qemu to use the oldstyle protocol. */ r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -69,6 +73,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-partition.c b/tests/test-partition.c index 0087548..3e27b2c 100644 --- a/tests/test-partition.c +++ b/tests/test-partition.c @@ -64,6 +64,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -72,6 +76,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-split.c b/tests/test-split.c index f20e64b..22c9e72 100644 --- a/tests/test-split.c +++ b/tests/test-split.c @@ -63,6 +63,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -70,6 +74,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-streaming.c b/tests/test-streaming.c index 7807501..fbdf34b 100644 --- a/tests/test-streaming.c +++ b/tests/test-streaming.c @@ -108,6 +108,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", GUESTFS_ADD_DRIVE_OPTS_PROTOCOL, "nbd", @@ -115,6 +119,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); diff --git a/tests/test-xz.c b/tests/test-xz.c index ef58d59..34bc1ac 100644 --- a/tests/test-xz.c +++ b/tests/test-xz.c @@ -60,6 +60,10 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL + printf ("libguestfs too old to support nbd disk, skipping\n"); + exit (77); +#else r = guestfs_add_drive_opts (g, "", GUESTFS_ADD_DRIVE_OPTS_READONLY, 1, GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw", @@ -68,6 +72,7 @@ main (int argc, char *argv[]) -1); if (r == -1) exit (EXIT_FAILURE); +#endif if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); -- 2.14.3
Richard W.M. Jones
2018-Apr-06 09:26 UTC
Re: [Libguestfs] [nbdkit PATCH] tests: Skip guestfs tests on CentOS 6
On Thu, Apr 05, 2018 at 03:03:41PM -0500, Eric Blake wrote:> 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. The guestfs plugin can still be built, so no > configure changes are needed; but skip the tests that fail to > compile so that 'make check' can at least complete. > > Signed-off-by: Eric Blake <eblake@redhat.com>> +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOLThere's a symbol defined for this kind of test: #ifndef GUESTFS_HAVE_ADD_DRIVE_OPTS ... (from <guestfs.h>). However in this case I wonder if it would be better to test for this in the ./configure script and disable the HAVE_LIBGUESTFS automake conditional (but probably not error out -- we want to still compile on RHEL 6). What do you think? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Eric Blake
2018-Apr-06 14:02 UTC
Re: [Libguestfs] [nbdkit PATCH] tests: Skip guestfs tests on CentOS 6
On 04/06/2018 04:26 AM, Richard W.M. Jones wrote:> On Thu, Apr 05, 2018 at 03:03:41PM -0500, Eric Blake wrote: >> 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. The guestfs plugin can still be built, so no >> configure changes are needed; but skip the tests that fail to >> compile so that 'make check' can at least complete. >> >> Signed-off-by: Eric Blake <eblake@redhat.com> > > >> +#ifndef GUESTFS_ADD_DRIVE_OPTS_PROTOCOL > > There's a symbol defined for this kind of test: > > #ifndef GUESTFS_HAVE_ADD_DRIVE_OPTS > ... > > (from <guestfs.h>).The libguestfs on CentOS 6 does define GUESTFS_HAVE_ADD_DRIVE_OPTS (and the function family guestfs_add_drive_opts*), however, it only supports up through option 5 GUESTFS_ADD_DRIVE_OPTS_CACHEMODE. The compile failure was that GUESTFS_ADD_DRIVE_OPTS_PROTOCOL was undefined. (The documentation at http://libguestfs.org/guestfs.3.html#guestfs_add_drive doesn't list which version various options were added in, only that the function itself was added in 0.3, which predates 1.20.11).> > However in this case I wonder if it would be better to test for this > in the ./configure script and disable the HAVE_LIBGUESTFS automake > conditional (but probably not error out -- we want to still compile on > RHEL 6). What do you think?Might be easier; I'll play with it, and post a v2 patch along those lines (certainly a smaller patch, but it does mean that we won't even attempt to build plugins/guestfs - I guess that's still okay for an older release). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Apparently Analagous Threads
- [PATCH nbdkit v2 3/4] tests: Implement a better nbdkit-partition-filter test.
- [PATCH nbdkit v3 2/5] tests: Implement a better nbdkit-partition-filter test.
- Re: libguestfs init problem
- Re: [nbdkit PATCH] tests: Skip guestfs tests on CentOS 6
- Re: Use libguestfs with SAS URI of a disk image