[Libguestfs] [PATCH 3/4] Fixes for various tests in out-of-tree builds

Richard W.M. Jones rjones at redhat.com
Tue Mar 4 07:57:57 UTC 2014


On Tue, Mar 04, 2014 at 12:07:31AM +0100, Hilko Bengen wrote:
> ---
>  builder/test-config/virt-builder/repos.d/test-index.conf.in |  2 +-
>  tests/9p/Makefile.am                                        |  3 ++-
>  tests/9p/test-9p.sh                                         |  2 +-
>  tests/disks/Makefile.am                                     |  1 +
>  tests/disks/test-qemu-drive-libvirt.sh                      | 11 ++++++++---
>  tests/disks/test-qemu-drive.sh                              |  4 ++--
>  tests/guests/guest-aux/make-fedora-img.pl                   |  6 +++---
>  tests/guests/guest-aux/make-windows-img.sh                  |  4 ++--
>  8 files changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/builder/test-config/virt-builder/repos.d/test-index.conf.in b/builder/test-config/virt-builder/repos.d/test-index.conf.in
> index 3755e75..22e03c4 100644
> --- a/builder/test-config/virt-builder/repos.d/test-index.conf.in
> +++ b/builder/test-config/virt-builder/repos.d/test-index.conf.in
> @@ -1,2 +1,2 @@
>  [test-index]
> -uri=file://@abs_top_srcdir@/builder/test-index
> +uri=file://@abs_top_builddir@/builder/test-index
> diff --git a/tests/9p/Makefile.am b/tests/9p/Makefile.am
> index 949e6d5..9b3c880 100644
> --- a/tests/9p/Makefile.am
> +++ b/tests/9p/Makefile.am
> @@ -21,4 +21,5 @@ EXTRA_DIST = $(TESTS)
>  
>  TESTS = test-9p.sh
>  
> -TESTS_ENVIRONMENT = $(top_builddir)/run --test
> +TESTS_ENVIRONMENT = abs_srcdir=$(abs_srcdir) \
> +	$(top_builddir)/run --test
> diff --git a/tests/9p/test-9p.sh b/tests/9p/test-9p.sh
> index 16e9e4c..6733fd9 100755
> --- a/tests/9p/test-9p.sh
> +++ b/tests/9p/test-9p.sh
> @@ -50,7 +50,7 @@ rm -f test-9p.img test-9p.out
>  sparse test-9p.img 1M
>  
>  config -device '$virtio_9p,fsdev=test9p,mount_tag=test9p'
> -config -fsdev 'local,id=test9p,path=$(pwd),security_model=passthrough'
> +config -fsdev 'local,id=test9p,path=${abs_srcdir},security_model=passthrough'
>  
>  run
>  
> diff --git a/tests/disks/Makefile.am b/tests/disks/Makefile.am
> index 1315e71..2a94279 100644
> --- a/tests/disks/Makefile.am
> +++ b/tests/disks/Makefile.am
> @@ -24,6 +24,7 @@ TESTS = \
>  
>  TESTS_ENVIRONMENT = \
>  	abs_srcdir=$(abs_srcdir) \
> +	abs_builddir=$(abs_builddir) \
>  	$(top_builddir)/run --test
>  
>  EXTRA_DIST = \
> diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
> index 8467fe4..1ba014b 100755
> --- a/tests/disks/test-qemu-drive-libvirt.sh
> +++ b/tests/disks/test-qemu-drive-libvirt.sh
> @@ -26,6 +26,11 @@ if [ -z "$abs_srcdir" ]; then
>      exit 1
>  fi
>  
> +if [ -z "$abs_builddir" ]; then
> +    echo "$0: abs_builddir environment variable must be set"
> +    exit 1
> +fi
> +
>  if [ ! -x ../../src/libvirt-is-version ]; then
>      echo "$0: test skipped because libvirt-is-version is not built yet"
>      exit 77
> @@ -37,11 +42,11 @@ if ! ../../src/libvirt-is-version 1 1 3; then
>  fi
>  
>  guestfish="\
> -  ../../fish/guestfish -c test://$abs_srcdir/test-qemu-drive-libvirt.xml"
> +  ../../fish/guestfish -c test://$abs_builddir/test-qemu-drive-libvirt.xml"
>  
>  export LIBGUESTFS_BACKEND=direct
> -export LIBGUESTFS_HV="$(pwd)/debug-qemu.sh"
> -export DEBUG_QEMU_FILE="$(pwd)/test-qemu-drive-libvirt.out"
> +export LIBGUESTFS_HV="${abs_srcdir}/debug-qemu.sh"
> +export DEBUG_QEMU_FILE="${abs_builddir}/test-qemu-drive-libvirt.out"
>  
>  function check_output ()
>  {
> diff --git a/tests/disks/test-qemu-drive.sh b/tests/disks/test-qemu-drive.sh
> index 4f10cdb..91677bd 100755
> --- a/tests/disks/test-qemu-drive.sh
> +++ b/tests/disks/test-qemu-drive.sh
> @@ -24,8 +24,8 @@ set -e
>  guestfish=../../fish/guestfish
>  
>  export LIBGUESTFS_BACKEND=direct
> -export LIBGUESTFS_HV="$(pwd)/debug-qemu.sh"
> -export DEBUG_QEMU_FILE="$(pwd)/test-qemu-drive.out"
> +export LIBGUESTFS_HV="${abs_srcdir}/debug-qemu.sh"
> +export DEBUG_QEMU_FILE="${abs_builddir}/test-qemu-drive.out"
>  
>  function check_output ()
>  {
> diff --git a/tests/guests/guest-aux/make-fedora-img.pl b/tests/guests/guest-aux/make-fedora-img.pl
> index 4eb08b5..1c23b6d 100755
> --- a/tests/guests/guest-aux/make-fedora-img.pl
> +++ b/tests/guests/guest-aux/make-fedora-img.pl
> @@ -217,12 +217,12 @@ if (-f "mdadm.tmp.$$") {
>    unlink ("mdadm.tmp.$$") or die;
>  }
>  
> -$g->upload ('guest-aux/fedora-name.db', '/var/lib/rpm/Name');
> -$g->upload ('guest-aux/fedora-packages.db', '/var/lib/rpm/Packages');
> +$g->upload ($ENV{SRCDIR}.'/guest-aux/fedora-name.db', '/var/lib/rpm/Name');
> +$g->upload ($ENV{SRCDIR}.'/guest-aux/fedora-packages.db', '/var/lib/rpm/Packages');
>  
>  $g->upload ($ENV{SRCDIR}.'/../data/bin-x86_64-dynamic', '/bin/ls');
>  
> -$g->txz_in ('guest-aux/fedora-journal.tar.xz', '/var/log/journal');
> +$g->txz_in ($ENV{SRCDIR}.'/guest-aux/fedora-journal.tar.xz', '/var/log/journal');
>  
>  $g->mkdir ('/boot/grub');
>  $g->touch ('/boot/grub/grub.conf');
> diff --git a/tests/guests/guest-aux/make-windows-img.sh b/tests/guests/guest-aux/make-windows-img.sh
> index 41b1d48..860ec06 100755
> --- a/tests/guests/guest-aux/make-windows-img.sh
> +++ b/tests/guests/guest-aux/make-windows-img.sh
> @@ -58,8 +58,8 @@ mkfs ntfs /dev/sda2
>  mount /dev/sda2 /
>  mkdir-p /Windows/System32/Config
>  
> -upload guest-aux/windows-software /Windows/System32/Config/SOFTWARE
> -upload guest-aux/windows-system /Windows/System32/Config/SYSTEM
> +upload $SRCDIR/guest-aux/windows-software /Windows/System32/Config/SOFTWARE
> +upload $SRCDIR/guest-aux/windows-system /Windows/System32/Config/SYSTEM
>  
>  upload $SRCDIR/../data/bin-win32.exe /Windows/System32/cmd.exe

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list