142 lines
4.1 KiB
Diff
142 lines
4.1 KiB
Diff
commit 41828514bb91953e9a47453d5d4e667ccfd74b71
|
|
Author: Jim Fehlig <jfehlig@novell.com>
|
|
Date: Thu Jul 7 15:53:41 2011 -0600
|
|
|
|
Skip some xen tests if xend is not running
|
|
|
|
Currently, the xen statstest and reconnect tests are only compiled
|
|
if xend is running. Compile them unconditionally if xen headers
|
|
are present, but skip the tests at runtime if xend is not running.
|
|
|
|
This is in response to Eric's suggestion here
|
|
|
|
https://www.redhat.com/archives/libvir-list/2011-July/msg00367.html
|
|
|
|
Index: libvirt-0.9.3/configure.ac
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/configure.ac
|
|
+++ libvirt-0.9.3/configure.ac
|
|
@@ -1982,30 +1982,6 @@ AM_CONDITIONAL([WITH_PYTHON], [test "$wi
|
|
AC_SUBST([PYTHON_VERSION])
|
|
AC_SUBST([PYTHON_INCLUDES])
|
|
|
|
-
|
|
-
|
|
-AC_MSG_CHECKING([whether this host is running a Xen kernel])
|
|
-RUNNING_XEN=
|
|
-if test -d /proc/sys/xen
|
|
-then
|
|
- RUNNING_XEN=yes
|
|
-else
|
|
- RUNNING_XEN=no
|
|
-fi
|
|
-AC_MSG_RESULT($RUNNING_XEN)
|
|
-
|
|
-AC_MSG_CHECKING([If XenD UNIX socket /var/run/xend/xmlrpc.sock is accessible])
|
|
-RUNNING_XEND=
|
|
-if test -S /var/run/xend/xmlrpc.sock
|
|
-then
|
|
- RUNNING_XEND=yes
|
|
-else
|
|
- RUNNING_XEND=no
|
|
-fi
|
|
-AC_MSG_RESULT($RUNNING_XEND)
|
|
-
|
|
-AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" && test "$RUNNING_XEND" != "no"])
|
|
-
|
|
AC_ARG_ENABLE([test-coverage],
|
|
AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
|
|
[case "${enableval}" in
|
|
Index: libvirt-0.9.3/tests/Makefile.am
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/tests/Makefile.am
|
|
+++ libvirt-0.9.3/tests/Makefile.am
|
|
@@ -93,10 +93,7 @@ ssh_LDADD = $(COVERAGE_LDFLAGS)
|
|
|
|
if WITH_XEN
|
|
check_PROGRAMS += xml2sexprtest sexpr2xmltest \
|
|
- xmconfigtest xencapstest
|
|
-if ENABLE_XEN_TESTS
|
|
-check_PROGRAMS += statstest reconnect
|
|
-endif
|
|
+ xmconfigtest xencapstest statstest reconnect
|
|
endif
|
|
if WITH_QEMU
|
|
check_PROGRAMS += qemuxml2argvtest qemuxml2xmltest qemuargv2xmltest qemuhelptest
|
|
@@ -214,10 +211,9 @@ if WITH_XEN
|
|
TESTS += xml2sexprtest \
|
|
sexpr2xmltest \
|
|
xmconfigtest \
|
|
- xencapstest
|
|
-if ENABLE_XEN_TESTS
|
|
-TESTS += reconnect statstest
|
|
-endif
|
|
+ xencapstest \
|
|
+ reconnect \
|
|
+ statstest
|
|
endif
|
|
|
|
if WITH_QEMU
|
|
Index: libvirt-0.9.3/tests/reconnect.c
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/tests/reconnect.c
|
|
+++ libvirt-0.9.3/tests/reconnect.c
|
|
@@ -4,6 +4,8 @@
|
|
#include <stdlib.h>
|
|
|
|
#include "internal.h"
|
|
+#include "testutils.h"
|
|
+#include "command.h"
|
|
|
|
static void errorHandler(void *userData ATTRIBUTE_UNUSED,
|
|
virErrorPtr error ATTRIBUTE_UNUSED) {
|
|
@@ -14,6 +16,16 @@ int main(void) {
|
|
int ro = 0;
|
|
virConnectPtr conn;
|
|
virDomainPtr dom;
|
|
+ int status;
|
|
+ virCommandPtr cmd;
|
|
+
|
|
+ /* skip test if xend is not running */
|
|
+ cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
|
+ if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
|
+ virCommandFree(cmd);
|
|
+ return EXIT_AM_SKIP;
|
|
+ }
|
|
+ virCommandFree(cmd);
|
|
|
|
virSetErrorFunc(NULL, errorHandler);
|
|
|
|
Index: libvirt-0.9.3/tests/statstest.c
|
|
===================================================================
|
|
--- libvirt-0.9.3.orig/tests/statstest.c
|
|
+++ libvirt-0.9.3/tests/statstest.c
|
|
@@ -8,6 +8,7 @@
|
|
#include "internal.h"
|
|
#include "xen/block_stats.h"
|
|
#include "testutils.h"
|
|
+#include "command.h"
|
|
|
|
static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
|
virErrorPtr error ATTRIBUTE_UNUSED)
|
|
@@ -44,7 +45,18 @@ static int
|
|
mymain(void)
|
|
{
|
|
int ret = 0;
|
|
- /* Some of our tests delibrately test failure cases, so
|
|
+ int status;
|
|
+ virCommandPtr cmd;
|
|
+
|
|
+ /* skip test if xend is not running */
|
|
+ cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
|
+ if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
|
+ virCommandFree(cmd);
|
|
+ return EXIT_AM_SKIP;
|
|
+ }
|
|
+ virCommandFree(cmd);
|
|
+
|
|
+ /* Some of our tests deliberately test failure cases, so
|
|
* register a handler to stop error messages cluttering
|
|
* up display
|
|
*/
|