[libvirt] [PATCH 1/2] tests: mock gnutls_dh_params_generate2

Daniel P. Berrange berrange at redhat.com
Thu Jun 23 09:15:26 UTC 2016


On Fri, Jun 17, 2016 at 01:16:35PM +0200, Peter Krempa wrote:
> On Thu, Jun 16, 2016 at 10:46:42 +0200, Ján Tomko wrote:
> > This function generates some big random numbers.
> > Skip it in tests to save time.
> > ---
> >  tests/virnettlscontexttest.c |  2 +-
> >  tests/virnettlssessiontest.c |  2 +-
> >  tests/virrandommock.c        | 12 ++++++++++++
> >  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> [...]
> 
> > diff --git a/tests/virrandommock.c b/tests/virrandommock.c
> > index 6df5e20..05c7a23 100644
> > --- a/tests/virrandommock.c
> > +++ b/tests/virrandommock.c
> > @@ -37,3 +37,15 @@ virRandomBytes(unsigned char *buf,
> >  
> >      return 0;
> >  }
> > +
> > +#ifdef WITH_GNUTLS
> > +# include <stdio.h>
> > +# include <gnutls/gnutls.h>
> > +
> > +int
> > +gnutls_dh_params_generate2(gnutls_dh_params_t dparams ATTRIBUTE_UNUSED,
> > +                           unsigned int bits ATTRIBUTE_UNUSED)
> > +{
> 
> I'm not okay with completely removing this function here since
> virnettlssessiontest is creating a session and thus this might either
> reduce test coverage or introduce a problem in some cases.
> 
> I suggest that you call it just once and then use gnutls_dh_params_cpy
> to cache it in the test itself rather than just skipping the init.

We already have the private key stored inline to the test suite. It might
be possible to also pre-generate DH params and store them inline too.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list