]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: avoid ld_preload tests on mingw v1.2.2-rc2
authorEric Blake <eblake@redhat.com>
Wed, 26 Feb 2014 00:24:58 +0000 (17:24 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 26 Feb 2014 01:51:11 +0000 (18:51 -0700)
Running ./autobuild.sh complained during the mingw cross-compile:

  CC       libvirportallocatormock_la-virportallocatortest.lo
../../tests/virportallocatortest.c:32:20: fatal error: dlfcn.h: No such file or directory
 # include <dlfcn.h>
                    ^
compilation terminated.  With that fixed, the next failure was:

  CCLD     qemuxml2argvmock.la
libtool: link: libtool library `qemuxml2argvmock.la' must begin with `lib'
libtool: link: Try `libtool --help --mode=link' for more information.

While we don't need to limit all LD_PRELOAD tests to just Linux, we
do need to limit them to platforms that actually support loading;
we also need to avoid building qemu tests when qemu is not enabled.

* tests/virportallocatortest.c: Make conditional on <dlfcn.h>.
* tests/Makefile.am (test_libraries): Only build qemu mock library
when building qemu tests.

Signed-off-by: Eric Blake <eblake@redhat.com>
tests/Makefile.am
tests/virportallocatortest.c

index 91eeeac6b57c7a292081ee89d9b8953da4d2e89b..c374f1452e618ecb51779e442b41eb7913f4b9be 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-## Copyright (C) 2005-2013 Red Hat, Inc.
+## Copyright (C) 2005-2014 Red Hat, Inc.
 ##
 ## This library is free software; you can redistribute it and/or
 ## modify it under the terms of the GNU Lesser General Public
@@ -333,10 +333,11 @@ test_libraries = libshunload.la \
                virnetserverclientmock.la \
                vircgroupmock.la \
                virpcimock.la \
-               qemuxml2argvmock.la \
                $(NULL)
 if WITH_QEMU
-test_libraries += libqemumonitortestutils.la
+test_libraries += libqemumonitortestutils.la \
+               qemuxml2argvmock.la \
+               $(NULL)
 endif WITH_QEMU
 
 if WITH_DBUS
index 7fe18df55fcea4fdaa5322da386f7b737e1f41aa..34843e314d1979cafc902b886b9b8fd5d19f3a80 100644 (file)
 #include <config.h>
 #include <stdlib.h>
 #include "virfile.h"
+#include "testutils.h"
 
-#ifdef MOCK_HELPER
-# include "internal.h"
-# include <sys/socket.h>
-# include <errno.h>
-# include <arpa/inet.h>
-# include <netinet/in.h>
-# include <stdio.h>
-# include <dlfcn.h>
+#if HAVE_DLFCN_H
+
+# ifdef MOCK_HELPER
+#  include "internal.h"
+#  include <sys/socket.h>
+#  include <errno.h>
+#  include <arpa/inet.h>
+#  include <netinet/in.h>
+#  include <stdio.h>
+#  include <dlfcn.h>
 
 static bool host_has_ipv6 = false;
 static int (*realsocket)(int domain, int type, int protocol);
@@ -102,17 +105,16 @@ int bind(int sockfd ATTRIBUTE_UNUSED,
     return 0;
 }
 
-#else
+# else
 
-# include "testutils.h"
-# include "virutil.h"
-# include "virerror.h"
-# include "viralloc.h"
-# include "virlog.h"
-# include "virportallocator.h"
-# include "virstring.h"
+#  include "virutil.h"
+#  include "virerror.h"
+#  include "viralloc.h"
+#  include "virlog.h"
+#  include "virportallocator.h"
+#  include "virstring.h"
 
-# define VIR_FROM_THIS VIR_FROM_RPC
+#  define VIR_FROM_THIS VIR_FROM_RPC
 
 
 static int testAllocAll(const void *args ATTRIBUTE_UNUSED)
@@ -261,4 +263,12 @@ mymain(void)
 }
 
 VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/libvirportallocatormock.so")
+# endif
+
+#else /* ! HAVE_DLFCN_H */
+int
+main(void)
+{
+    return EXIT_AM_SKIP;
+}
 #endif