[libvirt] [PATCH 1/2] build: virrandommock.c not needed on mingw

Martin Kletzander mkletzan at redhat.com
Tue Jul 12 09:27:43 UTC 2016


On Mon, Jul 11, 2016 at 09:55:00PM -0600, Eric Blake wrote:
>We can't mock tests on Mingw, which lacks dlopen() and friends;
>follow the paradigms used in other mock files of conditionally
>compiling nothing when not building for Linux.
>
>Signed-off-by: Eric Blake <eblake at redhat.com>
>---
> tests/virrandommock.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
>diff --git a/tests/virrandommock.c b/tests/virrandommock.c
>index 1f2434e..a69712a 100644
>--- a/tests/virrandommock.c
>+++ b/tests/virrandommock.c
>@@ -20,11 +20,13 @@
>
> #include <config.h>
>
>-#include "internal.h"
>-#include "virrandom.h"
>-#include "virmock.h"
>+#ifndef WIN32
>
>-#define VIR_FROM_THIS VIR_FROM_NONE
>+# include "internal.h"
>+# include "virrandom.h"
>+# include "virmock.h"
>+
>+# define VIR_FROM_THIS VIR_FROM_NONE
>
> int
> virRandomBytes(unsigned char *buf,
>@@ -39,9 +41,9 @@ virRandomBytes(unsigned char *buf,
> }
>
>
>-#ifdef WITH_GNUTLS
>-# include <stdio.h>
>-# include <gnutls/gnutls.h>
>+# ifdef WITH_GNUTLS
>+#  include <stdio.h>
>+#  include <gnutls/gnutls.h>
>
> static int (*real_gnutls_dh_params_generate2)(gnutls_dh_params_t dparams,
>                                               unsigned int bits);
>@@ -76,4 +78,7 @@ gnutls_dh_params_generate2(gnutls_dh_params_t dparams,
>
>     return gnutls_dh_params_cpy(dparams, params_cache);
> }
>+# endif
>+#else /* WIN32 */
>+/* Can't mock on WIN32 */

Is taht really true?  For both cygwin and mingw?  If we can't mock on
WIN32 why don't we just disable those tests and the mocks in Makefile?
I wish I knew that when I was spending so much time fixing that gnulib
bug that was causing mingw fails for almost two months =)

> #endif
>--
>2.5.5
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160712/83463d10/attachment-0001.sig>


More information about the libvir-list mailing list