I hit some issues while running ./autobuild.sh on a machine set up
for a mingw cross build; pushing this series under the build-breaker
rule.
Eric Blake (2):
build: fix cgroups on non-Linux
build: avoid ld_preload tests on mingw
src/util/vircgroup.c | 27 +++++++++++++++++++++++++-
tests/Makefile.am | 7 ++++---
tests/virportallocatortest.c | 45 +++++++++++++++++++++++++++-----------------
3 files changed, 58 insertions(+), 21 deletions(-)
--
1.8.5.3
Show replies by date
Running ./autobuild.sh detected a mingw failure:
CCLD libvirt.la
Cannot export virCgroupGetPercpuStats: symbol not defined
Cannot export virCgroupSetOwner: symbol not defined
* src/util/vircgroup.c (virCgroupGetPercpuStats)
(virCgroupSetOwner): Implement stubs.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/util/vircgroup.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a8987b7..0f04b4d 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1,7 +1,7 @@
/*
* vircgroup.c: methods for managing control cgroups
*
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* This library is free software; you can redistribute it and/or
@@ -4379,4 +4379,29 @@ virCgroupSupportsCpuBW(virCgroupPtr cgroup ATTRIBUTE_UNUSED)
return false;
}
+
+int
+virCgroupGetPercpuStats(virCgroupPtr group ATTRIBUTE_UNUSED,
+ virTypedParameterPtr params ATTRIBUTE_UNUSED,
+ unsigned int nparams ATTRIBUTE_UNUSED,
+ int start_cpu ATTRIBUTE_UNUSED,
+ unsigned int ncpus ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Control groups not supported on this platform"));
+ return -1;
+}
+
+
+int
+virCgroupSetOwner(virCgroupPtr cgroup ATTRIBUTE_UNUSED,
+ uid_t uid ATTRIBUTE_UNUSED,
+ gid_t gid ATTRIBUTE_UNUSED,
+ int controllers ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Control groups not supported on this platform"));
+ return -1;
+}
+
#endif /* !VIR_CGROUP_SUPPORTED */
--
1.8.5.3
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(a)redhat.com>
---
tests/Makefile.am | 7 ++++---
tests/virportallocatortest.c | 45 +++++++++++++++++++++++++++-----------------
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 91eeeac..c374f14 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c
index 7fe18df..309aea7 100644
--- a/tests/virportallocatortest.c
+++ b/tests/virportallocatortest.c
@@ -21,15 +21,18 @@
#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,13 @@ 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
+
--
1.8.5.3