[libvirt] [PATCH 0/2] mingw build fixes

If I don't get a review in a couple of days, I can probably justify them under the build-breaker rule; on the other hand, since mingw doesn't get as much testing, I'm not in a rush to push right away. Eric Blake (2): build: virrandommock.c not needed on mingw build: drop hack for old mingw ssize_t gnulib/local/m4/ssize_t.m4.diff | 34 ---------------------------------- tests/virrandommock.c | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 gnulib/local/m4/ssize_t.m4.diff -- 2.5.5

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@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 */ #endif -- 2.5.5

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@redhat.com> --- tests/virrandommock.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
ACK 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 :|

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@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@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Tue, Jul 12, 2016 at 11:27:43AM +0200, Martin Kletzander wrote:
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@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 =)
Well historical practice for the tests directory is that we do it all in the .c file, not the makefile. We could re-visit this, but if we do then any change should be done throughout tests/, not just to this file. 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 :|

On Tue, Jul 12, 2016 at 10:45:12AM +0100, Daniel P. Berrange wrote:
On Tue, Jul 12, 2016 at 11:27:43AM +0200, Martin Kletzander wrote:
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@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 =)
Well historical practice for the tests directory is that we do it all in the .c file, not the makefile. We could re-visit this, but if we do then any change should be done throughout tests/, not just to this file.
OK then, if that's the practice. I forgot we are doing SKIPs for unsupported tests.
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 :|
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 07/12/2016 03:27 AM, Martin Kletzander wrote:
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@redhat.com> --- +# 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 =)
Cygwin supports dlopen(), and therefore mocking. However, cygwin is NOT a WIN32 compile (it is so much closer to Linux than windows, that compiling it with WIN32 is actively wrong). On the other hand, we don't have a working port of libvirt to cygwin. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

The old 32-bit-only mingw project had a mismatch in its <sys/types.h> that omitted ssize_t, but where size_t was a different rank than int. But now that mingw64 (both 32- and 64-bit) is the more popular platform (Fedora has dropped mingw in favor of mingw64), we no longer need to carry a hack to gnulib to cater to the old mingw. This reverts part of commit 1012dc29333. Signed-off-by: Eric Blake <eblake@redhat.com> --- gnulib/local/m4/ssize_t.m4.diff | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 gnulib/local/m4/ssize_t.m4.diff diff --git a/gnulib/local/m4/ssize_t.m4.diff b/gnulib/local/m4/ssize_t.m4.diff deleted file mode 100644 index c4863b9..0000000 --- a/gnulib/local/m4/ssize_t.m4.diff +++ /dev/null @@ -1,34 +0,0 @@ -diff --git i/m4/ssize_t.m4 w/m4/ssize_t.m4 -index 209d64c..5ea72a1 100644 ---- i/m4/ssize_t.m4 -+++ w/m4/ssize_t.m4 -@@ -1,4 +1,4 @@ --# ssize_t.m4 serial 5 (gettext-0.18.2) -+# ssize_t.m4 serial 6 (gettext-0.18.2) - dnl Copyright (C) 2001-2003, 2006, 2010-2016 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -17,7 +17,21 @@ AC_DEFUN([gt_TYPE_SSIZE_T], - return !x;]])], - [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) - if test $gt_cv_ssize_t = no; then -- AC_DEFINE([ssize_t], [int], -- [Define as a signed type of the same size as size_t.]) -+ AC_CACHE_CHECK([for rank of size_t], [gt_cv_size_t_rank], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include <sys/types.h> -+ #ifdef __cplusplus -+ extern "C" { -+ #endif -+ int foo(unsigned long bar); -+ int foo(size_t bar); -+ #ifdef __cplusplus -+ } -+ #endif -+ ]])], -+ [gt_cv_size_t_rank=long], [gt_cv_size_t_rank=int])]) -+ AC_DEFINE_UNQUOTED([ssize_t], [$gt_cv_size_t_rank], -+ [Define as a signed type of the same size and rank as size_t.]) - fi - ]) -- 2.5.5

On Mon, Jul 11, 2016 at 09:55:01PM -0600, Eric Blake wrote:
The old 32-bit-only mingw project had a mismatch in its <sys/types.h> that omitted ssize_t, but where size_t was a different rank than int. But now that mingw64 (both 32- and 64-bit) is the more popular platform (Fedora has dropped mingw in favor of mingw64), we no longer need to carry a hack to gnulib to cater to the old mingw. This reverts part of commit 1012dc29333.
Signed-off-by: Eric Blake <eblake@redhat.com> --- gnulib/local/m4/ssize_t.m4.diff | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 gnulib/local/m4/ssize_t.m4.diff
ACK 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 :|

On 07/12/2016 02:05 AM, Daniel P. Berrange wrote:
On Mon, Jul 11, 2016 at 09:55:01PM -0600, Eric Blake wrote:
The old 32-bit-only mingw project had a mismatch in its <sys/types.h> that omitted ssize_t, but where size_t was a different rank than int. But now that mingw64 (both 32- and 64-bit) is the more popular platform (Fedora has dropped mingw in favor of mingw64), we no longer need to carry a hack to gnulib to cater to the old mingw. This reverts part of commit 1012dc29333.
Signed-off-by: Eric Blake <eblake@redhat.com> --- gnulib/local/m4/ssize_t.m4.diff | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 gnulib/local/m4/ssize_t.m4.diff
ACK
Thanks; series pushed. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Martin Kletzander