mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
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.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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" "$@"
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user