Re: [libvirt] PATCH: Fix libvirtd test cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Meyering wrote:
> Daniel P. Berrange wrote:
>> The libvirtd tests have a number of bugs causing them to fail & generally
>> do bad things. They all currently fail on RHEL5 hosts.
>
> Odd that they'd all fail for you.
> Only one fails for me: libvirtd-pool
> and daemon-conf is mistakenly skipped due to use of ancient
> automake-1.9.
>
>>  - daemon-conf - the abs_topbuild_dir env var was not being set correctly
>
> As you know, that's because you're building with RHEL5's ancient
> version of automake.
> That is a no-no (for many reasons) but easy to work around.
> IMHO, no one should never build using such old autotools,
> but I do know how we're currently constrained.  no choice.
>
> Your change to tests/Makefile.am is fine.
>
>>    so it failed to find config.h. It also broken by changes in stderr
>>    debug output from libvirtd. This patch fixes the env var, and changes
>>    it to it just looks for the desired error message, not doing a diff
>>    across entire of stdout/err.
>
> Once I worked around automake-1.9's lack of abs_top_builddir,
> daemon-conf passed.
>
> What error did you see?

I've deduced that you were building --without-qemu.
Here's a less invasive patch that fixes those problems.
I've confirmed that it passes (or skips) all tests on RHEL5
when built both --with-qemu and --without-qemu.  Of course, it
still passes on F10/F11 and rawhide.

>From c478463429e223976c5dcebcf02635624564fd74 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Wed, 4 Mar 2009 00:27:09 -0500
Subject: [PATCH] tests: accommodate building with automake-1.9 and --without-qemu

* tests/Makefile.am: Export replacement definitions of variables
like $(abs_top_builddir) that are provided by reasonably recent
versions of automake, but lacking in automake-1.9.
* tests/test-lib.sh (require_qemu_): New function.
* tests/daemon-conf: Use it.
* tests/libvirtd-net-persist: Use it.
* tests/libvirtd-pool: Use it.
---
 tests/Makefile.am          |   13 +++++++------
 tests/daemon-conf          |    4 +---
 tests/libvirtd-net-persist |    1 +
 tests/libvirtd-pool        |    8 ++++++--
 tests/test-lib.sh          |    6 ++++++
 5 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8b4bd0c..3f79516 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -117,16 +117,17 @@ endif

 TESTS += nodedevxml2xmltest

-path_add = $$abs_top_builddir/src$(PATH_SEPARATOR)$$abs_top_builddir/qemud
-
 # NB, automake < 1.10 does not provide the real
 # abs_top_{src/build}dir variables, so don't rely
 # on them here. Fake them with 'pwd'
+export abs_top_builddir ?= $(shell cd '$(top_builddir)'; pwd)
+export abs_top_srcdir   ?= $(shell cd '$(top_srcdir)'; pwd)
+export abs_builddir     ?= $(shell cd '$(builddir)'; pwd)
+export abs_srcdir       ?= $(shell cd '$(srcdir)'; pwd)
+
+path_add = $(abs_top_builddir)/src$(PATH_SEPARATOR)$(abs_top_builddir)/qemud
+
 TESTS_ENVIRONMENT =				\
-  abs_top_builddir=`cd '$(top_builddir)'; pwd`	\
-  abs_top_srcdir=`cd '$(top_srcdir)'; pwd`	\
-  abs_builddir=`cd '$(builddir)'; pwd`		\
-  abs_srcdir=`cd '$(srcdir)'; pwd`		\
   CONFIG_HEADER='$(abs_top_builddir)/config.h'	\
   PATH="$(path_add)$(PATH_SEPARATOR)$$PATH"	\
   SHELL="$(SHELL)"				\
diff --git a/tests/daemon-conf b/tests/daemon-conf
index a5e86ae..e63ce01 100755
--- a/tests/daemon-conf
+++ b/tests/daemon-conf
@@ -9,9 +9,7 @@ fi
 test -z "$srcdir" && srcdir=$(pwd)
 test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
 . $srcdir/test-lib.sh
-
-grep '^#define WITH_QEMU 1' $CONFIG_HEADER > /dev/null ||
-  skip_test_ "configured without QEMU support"
+require_qemu_

 conf="$abs_top_srcdir/qemud/libvirtd.conf"

diff --git a/tests/libvirtd-net-persist b/tests/libvirtd-net-persist
index 50a1ef4..f03e669 100755
--- a/tests/libvirtd-net-persist
+++ b/tests/libvirtd-net-persist
@@ -10,6 +10,7 @@ fi
 test -z "$srcdir" && srcdir=$(pwd)
 test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
 . "$srcdir/test-lib.sh"
+require_qemu_

 fail=0

diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
index 370f3b1..b38dbb2 100755
--- a/tests/libvirtd-pool
+++ b/tests/libvirtd-pool
@@ -10,6 +10,7 @@ fi
 test -z "$srcdir" && srcdir=$(pwd)
 test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
 . "$srcdir/test-lib.sh"
+require_qemu_

 fail=0

@@ -31,6 +32,9 @@ virsh --connect "$url" pool-dumpxml P >> out 2>&1 || fail=1

 # remove random uuid
 sed 's/<uuid>.*/-/' out > k && mv k out || fail=1
+# filter out actual owner and group numbers
+sed 's/<owner>.*/-/' out > k && mv k out || fail=1
+sed 's/<group>.*/-/' out > k && mv k out || fail=1

 kill $pid

@@ -49,8 +53,8 @@ Pool P defined
     <path>/target-path</path>
     <permissions>
       <mode>0700</mode>
-      <owner>500</owner>
-      <group>500</group>
+      -
+      -
     </permissions>
   </target>
 </pool>
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index a007109..fd4cd2a 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -24,6 +24,12 @@ require_acl_()
     || skip_test_ "This test requires a local user named bin."
 }

+require_qemu_()
+{
+  grep '^#define WITH_QEMU 1' $CONFIG_HEADER > /dev/null ||
+    skip_test_ "configured without QEMU support"
+}
+
 require_ulimit_()
 {
   ulimit_works=yes
--
1.6.2.rc1.285.gc5f54

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]