[Libguestfs] [PATCH v2 nbdkit 3/5] tests: Move common code for testing every plugin to tests/functions.sh.

Richard W.M. Jones rjones at redhat.com
Thu Sep 13 18:49:34 UTC 2018


On Thu, Sep 13, 2018 at 12:51:26PM -0500, Eric Blake wrote:
> >+    case "$1${NBDKIT_VALGRIND:+-valgrind}" in
> >          vddk | vddk-valgrind)
> >              # VDDK won't run without special environment variables
> >              # being set, so ignore it.
> 
> Not for this patch, but is it worth making 'nbdkit vddk --help'
> display something useful even when env-vars are not set?

It possibly should do, but the way it works now the load() method in
this plugin tries to dlopen the VDDK library first thing.  After the
dlopen succeeds, a bunch of function pointers are set to non-NULL
pointers into the VDDK library.  (If the dlopen fails you get an
descriptive error and nbdkit immediately exits.)

Making it not do the dlopen is possible, but a bit hairy since all of
the VDDK function pointers will be NULL, so any accidental call of
those functions before we end up doing the --help will segfault.

However I don't think this is a huge problem since there is already a
simplistic test of VDDK (as much as can be tested without the
proprietary library of course):

  https://github.com/libguestfs/nbdkit/blob/master/tests/test-vddk.sh

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




More information about the Libguestfs mailing list