diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-09-15 17:10:34 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-09-15 17:36:15 +0100 |
commit | e6bd0b87eb753fa96b6533b0dbe498697701ad3a (patch) | |
tree | b58fc9cfc73284bd9281d177341f5c75eb11f33c /tests | |
parent | 2fd51c28fd5bb3114b4a078d1698732a6e66bfc1 (diff) | |
download | libguestfs-e6bd0b87eb753fa96b6533b0dbe498697701ad3a.tar.gz libguestfs-e6bd0b87eb753fa96b6533b0dbe498697701ad3a.tar.xz libguestfs-e6bd0b87eb753fa96b6533b0dbe498697701ad3a.zip |
extra-tests: Write a qemu wrapper script on the fly.
Passing the $upstream_qemu environment variable is not reliable when
libvirt is involved: Environment variables are passed to the first
instance of the session libvirtd, but because libvirt reuses the
session libvirtd, subsequent environment variable settings are lost
(this is filed as RHBZ#856619).
Bypass all of this by writing a custom qemu-wrapper.sh which contains
the hard-coded values we want.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/extra/qemu-wrapper.sh | 18 | ||||
-rwxr-xr-x | tests/extra/test-with-upstream-qemu.sh | 21 |
2 files changed, 13 insertions, 26 deletions
diff --git a/tests/extra/qemu-wrapper.sh b/tests/extra/qemu-wrapper.sh deleted file mode 100755 index bec2bc0b..00000000 --- a/tests/extra/qemu-wrapper.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2012 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -exec "$upstream_qemu" -L "$QEMUDIR/pc-bios" "$@" diff --git a/tests/extra/test-with-upstream-qemu.sh b/tests/extra/test-with-upstream-qemu.sh index 58036332..7c883288 100755 --- a/tests/extra/test-with-upstream-qemu.sh +++ b/tests/extra/test-with-upstream-qemu.sh @@ -23,7 +23,6 @@ if [ ! -d "$QEMUDIR" ]; then exit 77 fi -# Note that Makefile sets 'QEMU', so we cannot use that variable. upstream_qemu="$QEMUDIR/x86_64-softmmu/qemu-system-x86_64" if ! "$upstream_qemu" --help >/dev/null 2>&1; then echo "$0: $upstream_qemu not executable, tests against upstream qemu skipped" @@ -32,14 +31,20 @@ fi "$upstream_qemu" --version -LIBGUESTFS_QEMU=$abs_srcdir/qemu-wrapper.sh - -if [ ! -f "$LIBGUESTFS_QEMU" ]; then - echo "$0: internal error: \$LIBGUESTFS_QEMU not a file" - exit 1 -fi +# Write a custom wrapper script for this invocation. (Since multiple +# parallel 'make extra-tests' should not be running in the same +# libguestfs directory, this should be safe). +LIBGUESTFS_QEMU="$abs_srcdir/qemu-wrapper.sh" +rm -f "$LIBGUESTFS_QEMU" "$LIBGUESTFS_QEMU"-t +cat > "$LIBGUESTFS_QEMU"-t <<EOF +#!/bin/sh - +# Wrapper generated by '$0'. +# Do not edit this file directly. +exec "$upstream_qemu" -L "$QEMUDIR/pc-bios" "\$@" +EOF +chmod +x "$LIBGUESTFS_QEMU"-t +mv "$LIBGUESTFS_QEMU"-t "$LIBGUESTFS_QEMU" export LIBGUESTFS_QEMU -export upstream_qemu exec $MAKE extra-tests-non-recursive |