From e6bd0b87eb753fa96b6533b0dbe498697701ad3a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 15 Sep 2012 17:10:34 +0100 Subject: 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. --- .gitignore | 1 + tests/extra/qemu-wrapper.sh | 18 ------------------ tests/extra/test-with-upstream-qemu.sh | 21 +++++++++++++-------- 3 files changed, 14 insertions(+), 26 deletions(-) delete mode 100755 tests/extra/qemu-wrapper.sh diff --git a/.gitignore b/.gitignore index 3fd4e0a8..6e1480aa 100644 --- a/.gitignore +++ b/.gitignore @@ -397,6 +397,7 @@ Makefile.in /tests/data/initrd-x86_64.img.gz /tests/data/test-grep.txt.gz /tests/data/test.iso +/tests/extra/qemu-wrapper.sh /tests/extra/valgrind.log /tests/guests/debian.img /tests/guests/fedora.img 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 <