[libvirt] [PATCH] tests: avoid dlsym mocking on mingw

Eric Blake eblake at redhat.com
Tue May 20 21:13:56 UTC 2014


I got a build failure when cross-compiling to mingw with the
mingw64-dbus package installed:

  CC       virmockdbus_la-virmockdbus.lo
../../tests/virmockdbus.c:29:6: error: 'dbus_connection_set_change_sigpipe' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_VOID_ARGS(dbus_connection_set_change_sigpipe,
      ^
../../tests/virmockdbus.c:33:18: error: 'dbus_bus_get' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_RET_ARGS(dbus_bus_get,
...

Well duh - mingw lacks dlopen and friends, even if it can support
dbus.  A similar failure occured in virsystemdtest.c; but in that
file, we know that systemd is a Linux-only concept.

* tests/virmockdbus.c: Cripple on mingw.
* tests/virsystemdtest.c: Cripple on non-Linux.

Signed-off-by: Eric Blake <eblake at redhat.com>
---

Pushing under the build-breaker rule

 tests/virmockdbus.c    | 6 +++---
 tests/virsystemdtest.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/virmockdbus.c b/tests/virmockdbus.c
index 8a01d9d..49db98c 100644
--- a/tests/virmockdbus.c
+++ b/tests/virmockdbus.c
@@ -1,7 +1,7 @@
 /*
  * virmockdbus.c: mocking of dbus message send/reply
  *
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013-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
@@ -22,7 +22,7 @@

 #include <config.h>

-#ifdef WITH_DBUS
+#if defined(WITH_DBUS) && !defined(WIN32)
 # include "virmock.h"
 # include <dbus/dbus.h>

@@ -61,4 +61,4 @@ VIR_MOCK_LINK_RET_ARGS(dbus_connection_send_with_reply_and_block,
                        int, timeout_milliseconds,
                        DBusError *, error)

-#endif /* WITH_DBUS */
+#endif /* WITH_DBUS && !WIN32 */
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 0fcd4e8..8f7b47e 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -22,7 +22,7 @@

 #include "testutils.h"

-#ifdef WITH_DBUS
+#if defined(WITH_DBUS) && defined(__linux__)

 # include <stdlib.h>
 # include <dbus/dbus.h>
@@ -477,7 +477,7 @@ mymain(void)

 VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virmockdbus.so")

-#else /* ! WITH_DBUS */
+#else /* ! (WITH_DBUS && __linux__) */
 int
 main(void)
 {
-- 
1.9.0




More information about the libvir-list mailing list