[Libguestfs] [nbdkit PATCH v2] tests: Skip guestfs code on CentOS 6

Eric Blake eblake at redhat.com
Fri Apr 6 19:50:06 UTC 2018


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 at 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




More information about the Libguestfs mailing list