]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: avoid xend ABRT crash report
authorEric Blake <eblake@redhat.com>
Fri, 18 Nov 2011 21:21:54 +0000 (14:21 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 18 Nov 2011 22:00:18 +0000 (15:00 -0700)
I installed the xen development packages on my non-Xen F16 machine
in order to compile-test xen code and ensure we don't break things
on that front, but being a non-xen machine, /usr/sbin/xend is
obviously not running.  Unfortunately, xen-4.1.2-1.fc16 has a bug
where merely trying to probe xend status on a non-xen kernel causes
xend to issue an ABRT crash report:

https://bugzilla.redhat.com/show_bug.cgi?id=728696

Even though libvirt (correctly) skips the test, the xend crash report
is unnecessary noise.  Fix this by first filtering out non-xen
kernels even before attempting to probe xend.  The test still runs
and passes on a RHEL 5 xen kernel after this patch.

* tests/reconnect.c (mymain): Skip xend probe on non-xen kernel.
* tests/statstest.c (mymain): Likewise.

tests/reconnect.c
tests/statstest.c

index d4aa9f398d57a87b6271ba158a53127fff4b65a3..90af830bd42df2fb609d086b5fe15162178ba43f 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/utsname.h>
 
 #include "internal.h"
 #include "testutils.h"
@@ -20,8 +21,14 @@ mymain(void)
     virDomainPtr dom;
     int status;
     virCommandPtr cmd;
+    struct utsname ut;
 
-    /* skip test if xend is not running */
+    /* Skip test if xend is not running.  Calling xend on a non-xen
+       kernel causes some versions of xend to issue a crash report, so
+       we first probe uname results.  */
+    uname(&ut);
+    if (strstr(ut.release, "xen") == NULL)
+        return EXIT_AM_SKIP;
     cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
     if (virCommandRun(cmd, &status) != 0 || status != 0) {
         virCommandFree(cmd);
index 18cdc5c515427bcf3425b371ba68274b25bfeb39..fff69a3bd1dfbdb5e1e76578377b81385621df73 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/utsname.h>
 
 #include "stats_linux.h"
 #include "internal.h"
@@ -47,8 +48,14 @@ mymain(void)
     int ret = 0;
     int status;
     virCommandPtr cmd;
+    struct utsname ut;
 
-    /* skip test if xend is not running */
+    /* Skip test if xend is not running.  Calling xend on a non-xen
+       kernel causes some versions of xend to issue a crash report, so
+       we first probe uname results.  */
+    uname(&ut);
+    if (strstr(ut.release, "xen") == NULL)
+        return EXIT_AM_SKIP;
     cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
     if (virCommandRun(cmd, &status) != 0 || status != 0) {
         virCommandFree(cmd);